20 |
*/ |
*/ |
21 |
|
|
22 |
|
|
23 |
/* This demo shows the use of menu's. |
/* This demo shows the use of menu's. |
24 |
* The first two are PUSH_MENUs (pop-up). |
* The first two are PUSH_MENUs (pop-up). |
25 |
* The third one is PULLDOWN_MENU |
* The third one is PULLDOWN_MENU |
26 |
* and the last one is TOUCH_MENU |
* and the last one is TOUCH_MENU |
54 |
for (i=0; i<4; i++) |
for (i=0; i<4; i++) |
55 |
{ |
{ |
56 |
fl_show_menu_symbol(menu[i], 1); |
fl_show_menu_symbol(menu[i], 1); |
57 |
fl_set_menu(menu[i], |
fl_set_menu(menu[i], |
58 |
"Red%r1|Green%r1|Yellow%r1|Blue%r1|Purple%r1|Cyran%r1|White%r1"); |
"Red%r1|Green%r1|Yellow%r1|Blue%r1|Purple%r1|Cyran%r1|White%r1"); |
59 |
fl_set_menu_item_shortcut(menu[i], 1, "Rr#R#r"); |
fl_set_menu_item_shortcut(menu[i], 1, "Rr#R#r"); |
60 |
fl_set_menu_item_shortcut(menu[i], 2, "Gg#G#g"); |
fl_set_menu_item_shortcut(menu[i], 2, "Gg#G#g"); |
65 |
fl_set_menu_item_shortcut(menu[i], 7, "Ww#W#w"); |
fl_set_menu_item_shortcut(menu[i], 7, "Ww#W#w"); |
66 |
|
|
67 |
/* initially the last three entries are enabled */ |
/* initially the last three entries are enabled */ |
68 |
for (j=5; j<=7; j++) |
for (j=5; j<=7; j++) |
69 |
fl_set_menu_item_mode(menu[i], j, FL_PUP_RADIO); |
fl_set_menu_item_mode(menu[i], j, FL_PUP_RADIO); |
70 |
/* the first four are disabled except the item (i+1) */ |
/* the first four are disabled except the item (i+1) */ |
71 |
for (j=1; j<=4; j++) |
for (j=1; j<=4; j++) |
74 |
fl_set_object_color(abox[i], FL_BLACK+set[i], FL_BLACK); |
fl_set_object_color(abox[i], FL_BLACK+set[i], FL_BLACK); |
75 |
fl_set_menu_item_mode(menu[i], set[i], FL_PUP_CHECK | FL_PUP_RADIO); |
fl_set_menu_item_mode(menu[i], set[i], FL_PUP_CHECK | FL_PUP_RADIO); |
76 |
} |
} |
77 |
|
|
78 |
fl_show_form(form,FL_PLACE_CENTER,FL_TRANSIENT,"Menu"); |
fl_show_form(form,FL_PLACE_CENTER,FL_TRANSIENT,"Menu"); |
79 |
|
|
80 |
fl_do_forms(); |
fl_do_forms(); |
83 |
} |
} |
84 |
|
|
85 |
/* m is the menu index 0 - 3 */ |
/* m is the menu index 0 - 3 */ |
86 |
static void |
static void |
87 |
menu_cb(FL_OBJECT *ob, long m) |
menu_cb(FL_OBJECT *ob, long m) |
88 |
{ |
{ |
89 |
int i, item = fl_get_menu(ob); |
int i, item = fl_get_menu(ob); |
103 |
} |
} |
104 |
set[m] = item; |
set[m] = item; |
105 |
fl_set_object_color(abox[m], FL_BLACK+item, FL_BLACK); |
fl_set_object_color(abox[m], FL_BLACK+item, FL_BLACK); |
106 |
} |
} |
107 |
|
|
108 |
static void |
static void |
109 |
done_cb(FL_OBJECT *ob, long data) |
done_cb(FL_OBJECT *ob, long data) |