- 生成 24 个 _cfl*.vp(10327 条 extern 声明)+ _types/_enums 常量 - __init__.vp 提供 Fl/Fl_Widget/Fl_Window/Fl_Button/Fl_Input/Fl_Text_Buffer/Fl_Group/Fl_Menu_Bar/Fl_Native_File_Chooser 等包装类 - 回调(Fl_Callback)按 bytes 不透明处理,菜单回调位传 t.CPtr(0) - 新增 examples/hello.vp、dialog.vp 冒烟样例,26 个 .vp 全部通过 vast parse - 内嵌 cfltk(C API 封装)与 FLTK 1.4 完整源码,构建目标 cfltk2
43 lines
1019 B
C
43 lines
1019 B
C
#include <cfltk2/cfl.h> // Fl_init_all
|
|
#include <cfltk2/cfl_box.h>
|
|
#include <cfltk2/cfl_button.h>
|
|
#include <cfltk2/cfl_enums.h> // EventNames, Event_PUSH
|
|
#include <cfltk2/cfl_window.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
Fl_Window *win;
|
|
|
|
int cb(Fl_Widget *w, int e, void *data) {
|
|
switch (e) {
|
|
case Fl_Event_Push:
|
|
Fl_handle(31, win);
|
|
// return 1 when handled, 0 otherwise
|
|
return 1;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
int box_cb(Fl_Widget *w, int e, void *data) {
|
|
switch (e) {
|
|
case 31:
|
|
Fl_Box_set_label((Fl_Box *)w, "Pushed");
|
|
// return 1 when handled, 0 otherwise
|
|
return 1;
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
win = Fl_Window_new(100, 100, 400, 300, NULL);
|
|
Fl_Box *f = Fl_Box_new(0, 0, 400, 200, NULL);
|
|
Fl_Button *b = Fl_Button_new(160, 210, 80, 40, "Click me");
|
|
Fl_Window_end(win);
|
|
Fl_Window_show(win);
|
|
Fl_Box_handle(f, box_cb, NULL);
|
|
Fl_Button_handle(b, cb, NULL);
|
|
return Fl_run();
|
|
}
|