5 #include <F_Menu_Button.H>
6 #include <F_Text_Output.H>
10 F_Text_Output *to = 0;
12 void button_cb(F_Button *b, void *arg)
14 // debug("button callback, bid - %d, arg - %d", b->id(), (long) arg);
15 to->addf("button %d pressed", (long) arg);
18 void menu_button_cb(F_Menu_Button *b, void *arg)
20 to->addf("menu button %d pressed", (long) arg);
23 void input_cb(F_Input *i, void *arg)
25 to->addf("input text %s", i->size() ? i->value() : "empty");
29 void console_ui::init(void)
31 F_Window *win1 = new F_Window(5, 7, 45, 18, "Window1");
32 win1->border(F_SINGLE_BORDER);
33 to = new F_Text_Output(F_UP_BOX, 1, 1, 43, 16, "Screen Log");
34 to->color(F_BLACK, F_WHITE);
35 to->add("very loooooooooooooooooooooooooooooooooooooooooooooong line");
38 F_Window *win2 = new F_Window(10, 3, 35, 15, "ïËÎÏ2");
39 win2->border(F_DOUBLE_BORDER);
40 F_Button *button = new F_Button(F_UP_BOX, 7, 4, 10, 1, " ëÎÏÐËÁ 2 ");
41 button->color(F_BLACK, F_WHITE);
42 button->callback((F_Callback *)button_cb, (void *)2);
45 F_Menu_Button *mb = new F_Menu_Button(F_UP_BOX, 10, 7, 15, 1, " ëÎÏÐËÁ-Menu ");
46 mb->color(F_BLACK, F_WHITE);
47 mb->add("MenÀ éÔÅÍ 1");
48 mb->add("MenÀ éÔÅÍ 2");
49 mb->add("MenÀ éÔÅÍ 3");
50 mb->mode(0, F_MENU_TOGGLE);
51 mb->mode(1, F_MENU_TOGGLE);
52 mb->mode(2, F_MENU_TOGGLE);
55 mb->callback(0, (F_Callback *)menu_button_cb, (void *)1);
56 mb->callback(1, (F_Callback *)menu_button_cb, (void *)2);
57 mb->callback(2, (F_Callback *)menu_button_cb, (void *)3);
60 F_Text *txt = new F_Text(F_UP_BOX, 2, 2, 18, 1, "ðÒÉ×ÅÔ, ÞÕÞÕÎÄÒÁ !");
61 txt->color(F_RED, F_WHITE);
64 F_Window *win3 = new F_Window(23, 10, 30, 10, "ïËÎÏ3");
65 win3->border(F_DOUBLE_BORDER);
67 txt = new F_Text(F_UP_BOX, 3, 2, 14, 1, "Hello, world !");
68 txt->color(F_BLACK, F_GREEN);
71 button = new F_Button(F_UP_BOX, 8, 4, 10, 1, " Button 1 ");
72 button->callback((F_Callback *)button_cb, (void *)1);
75 F_Input *i = new F_Input(F_UP_BOX, 7, 6, 14, 2, "Some Input");
76 i->color(F_BLACK, F_MAGENTA);
77 i->callback((F_Callback *)input_cb);
83 win1->color(F_BLUE, F_BRIGHT_YELLOW);
85 win2->color(F_RED, F_WHITE);
87 win3->color(F_BLACK, F_WHITE);