Rev 6489 | Rev 6559 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6489 | Rev 6516 | ||
---|---|---|---|
Line 66... | Line 66... | ||
66 | // pos_t mouse_pos; |
66 | // pos_t mouse_pos; |
67 | oskey_t keypress; |
67 | oskey_t keypress; |
Line 68... | Line 68... | ||
68 | 68 | ||
69 | 69 | ||
70 | // creating GUI using library functions |
70 | // creating GUI using library functions |
Line 71... | Line 71... | ||
71 | kolibri_window *main_window = kolibri_new_window(50, 50, 400, 160, "OptionBox and Menu demo"); |
71 | kolibri_window *main_window = kolibri_new_window(50, 40, 400, 160, "OptionBox and Menu demo"); |
72 | //check_box *checkbox = kolibri_new_check_box(20, 45, 12, 12, "Append BOARDMSG to entered message."); |
72 | //check_box *checkbox = kolibri_new_check_box(20, 45, 12, 12, "Append BOARDMSG to entered message."); |
Line 73... | Line 73... | ||
73 | 73 | ||
74 | option_box opts1[3]; |
74 | option_box opts1[3]; |
75 | option_box *option1sel = opts1; // intially selected RED |
75 | option_box *option1sel = opts1; // intially selected RED |
76 | 76 | ||
Line 77... | Line 77... | ||
77 | option_box *op1_1 = gui_optionbox(opts1, X_Y(20, 60), "G1 Item RED", &option1sel); |
77 | option_box *op1_1 = gui_optionbox(opts1, X_Y(20, 50), "G1 Item RED", &option1sel); |
78 | option_box *op1_2 = gui_optionbox(opts1+1, X_Y(20, 80), "G1 Item GREEN", &option1sel); |
78 | option_box *op1_2 = gui_optionbox(opts1+1, X_Y(20, 70), "G1 Item GREEN", &option1sel); |
79 | option_box *op1_3 = gui_optionbox(opts1+2, X_Y(20, 100), "G1 Item BLUE", &option1sel); |
79 | option_box *op1_3 = gui_optionbox(opts1+2, X_Y(20, 90), "G1 Item BLUE", &option1sel); |
80 | option_box* option_group1[] = {op1_1, op1_2, op1_3, NULL}; |
80 | option_box* option_group1[] = {op1_1, op1_2, op1_3, NULL}; |
81 | 81 | ||
82 | option_box opts2[3]; |
82 | option_box opts2[3]; |
Line 83... | Line 83... | ||
83 | option_box *option2sel = opts2 + 1; // intially selected #2 |
83 | option_box *option2sel = opts2 + 1; // intially selected #2 |
84 | option_box *op2_1 = gui_optionbox(&opts2[0], X_Y(140, 60), "G2 Item 1st", &option2sel); |
84 | option_box *op2_1 = gui_optionbox(&opts2[0], X_Y(140, 50), "G2 Item 1st", &option2sel); |
Line 85... | Line 85... | ||
85 | option_box *op2_2 = gui_optionbox(&opts2[1], X_Y(140, 80), "G2 Item 2nd", &option2sel); |
85 | option_box *op2_2 = gui_optionbox(&opts2[1], X_Y(140, 70), "G2 Item 2nd", &option2sel); |
86 | option_box *op2_3 = gui_optionbox(&opts2[2], X_Y(140, 100), "G2 Item 3rd", &option2sel); |
86 | option_box *op2_3 = gui_optionbox(&opts2[2], X_Y(140, 90), "G2 Item 3rd", &option2sel); |
87 | option_box* option_group2[] = {op2_1, op2_2, op2_3, NULL}; |
87 | option_box* option_group2[] = {op2_1, op2_2, op2_3, NULL}; |
88 | 88 | ||
Line 89... | Line 89... | ||
89 | frame *fr1 = kolibri_new_frame_def(X_Y(12, 110), X_Y(50, 70), "Option 1"); |
89 | frame *fr1 = kolibri_new_frame_def(X_Y(12, 110), X_Y(40, 70), "Option 1"); |
90 | frame *fr2 = kolibri_new_frame_def(X_Y(132, 100), X_Y(50, 70), "Option 2"); |
90 | frame *fr2 = kolibri_new_frame_def(X_Y(132, 100), X_Y(40, 70), "Option 2"); |
Line 91... | Line 91... | ||
91 | 91 | ||
92 | gui_add_optiongroup(main_window, option_group1); // new syntax |
92 | gui_add_optiongroup(main_window, option_group1); // new syntax |
93 | gui_add_optiongroup(main_window, option_group2); |
93 | gui_add_optiongroup(main_window, option_group2); |
Line 94... | Line 94... | ||
94 | gui_add_frame(main_window, fr1); |
94 | gui_add_frame(main_window, fr1); |
95 | gui_add_frame(main_window, fr2); |
95 | gui_add_frame(main_window, fr2); |
96 | 96 | ||
Line 97... | Line 97... | ||
97 | int option_index1 = 0; // index of selected option |
97 | int option_index1 = 0; // index of selected option |
98 | int option_index2 = 0; |
98 | int option_index2 = 0; |
99 | 99 | ||
100 | char *menu1stru[] = {"Menu1", "Set RED", "Set GREEN", "Set BLUE", NULL}; |
100 | char *menu1stru[] = {"Menu1", "Set RED", "Set GREEN", "Set BLUE", NULL}; |