- 生成 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
35 lines
990 B
C
35 lines
990 B
C
|
|
// Example for android themed app
|
|
|
|
#include <cfltk2/cfl.h> // Fl_init_all, Fl_lock, Fl_run
|
|
#include <cfltk2/cfl_button.h>
|
|
#include <cfltk2/cfl_enums.h>
|
|
#include <cfltk2/cfl_widget.h>
|
|
#include <cfltk2/cfl_window.h>
|
|
#include <stdlib.h>
|
|
|
|
void cb(Fl_Widget *w, void *data) {
|
|
char buf[8];
|
|
int v = atoi(Fl_Widget_label(w));
|
|
v++;
|
|
snprintf(buf, 8, "%d", v);
|
|
Fl_Widget_set_label(w, buf);
|
|
}
|
|
|
|
int main(void) {
|
|
Fl_init_all();
|
|
Fl_Window *w = Fl_Window_new(0, 40, 600, 800 - 80, NULL);
|
|
Fl_Button *b = Fl_Button_new(220, 500, 160, 80, "0");
|
|
Fl_Window_end(w);
|
|
Fl_Window_show(w);
|
|
Fl_Window_set_color(w, Fl_Color_White);
|
|
Fl_Button_set_color(b, Fl_Color_Magenta);
|
|
Fl_Button_set_label_color(b, Fl_Color_White);
|
|
Fl_Button_clear_visible_focus(b);
|
|
Fl_Button_set_selection_color(b, Fl_Color_DarkMagenta);
|
|
Fl_Button_set_box(b, Fl_BoxType_RFlatBox);
|
|
Fl_Button_set_label_size(b, 36);
|
|
Fl_Button_set_callback(b, cb, NULL);
|
|
return Fl_run();
|
|
}
|