From 3e57c7257ba05716c544989b46b394780b5a461b Mon Sep 17 00:00:00 2001 From: siemargl Date: Sun, 31 Jul 2016 14:43:54 +0000 Subject: [PATCH] init checkbox, add frame git-svn-id: svn://kolibrios.org@6466 a494cfbc-eb01-0410-851d-a64ba20cac60 --- contrib/C_Layer/ASM/loadboxlib.asm | 1 + .../EXAMPLE/libguic_kolibri/boardmsg.c | 10 ++-- contrib/C_Layer/INCLUDE/kolibri_checkbox.h | 14 ++++-- contrib/C_Layer/INCLUDE/kolibri_frame.h | 50 +++++++++---------- .../C_Layer/INCLUDE/kolibri_gui_elements.h | 1 - 5 files changed, 41 insertions(+), 35 deletions(-) diff --git a/contrib/C_Layer/ASM/loadboxlib.asm b/contrib/C_Layer/ASM/loadboxlib.asm index bd358d191a..c1735d6ebe 100644 --- a/contrib/C_Layer/ASM/loadboxlib.asm +++ b/contrib/C_Layer/ASM/loadboxlib.asm @@ -134,6 +134,7 @@ public edit_box_mouse as '_edit_box_mouse' public check_box_draw2 as '_check_box_draw2' public check_box_mouse2 as '_check_box_mouse2' +public init_checkbox2 as '_init_checkbox2' public progressbar_draw as '_progressbar_draw' public progressbar_progress as '_progressbar_progress' diff --git a/contrib/C_Layer/EXAMPLE/libguic_kolibri/boardmsg.c b/contrib/C_Layer/EXAMPLE/libguic_kolibri/boardmsg.c index acc002f700..d00894842d 100644 --- a/contrib/C_Layer/EXAMPLE/libguic_kolibri/boardmsg.c +++ b/contrib/C_Layer/EXAMPLE/libguic_kolibri/boardmsg.c @@ -13,13 +13,15 @@ int main() oskey_t key; kolibri_window *main_window = kolibri_new_window(50, 50, 400, 100, "BoardMsg: OpenDialog 0.12"); - check_box *checkbox = kolibri_new_check_box(20, 40, 12, 12, "Append BOARDMSG to entered message."); - edit_box *textbox = kolibri_new_edit_box(20, 55, 40); - kolibri_button *button = kolibri_new_button(310, 55, 24, 14, 0x21, kolibri_color_table.color_work_button); + check_box *checkbox = kolibri_new_check_box(20, 45, 12, 12, "Append BOARDMSG to entered message."); + edit_box *textbox = kolibri_new_edit_box(20, 60, 40); + kolibri_button *button = kolibri_new_button(310, 60, 24, 14, 0x21, kolibri_color_table.color_work_button); + frame *fr = kolibri_new_frame(12, 35, 350, 50, 0x00FCFCFC, 0x00DCDCDC, 1, "Frame Title", 0, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area); kolibri_window_add_element(main_window, KOLIBRI_EDIT_BOX, textbox); kolibri_window_add_element(main_window, KOLIBRI_CHECK_BOX, checkbox); kolibri_window_add_element(main_window, KOLIBRI_BUTTON, button); + kolibri_window_add_element(main_window, KOLIBRI_FRAME, fr); extern volatile unsigned press_key; @@ -66,7 +68,7 @@ int main() kolibri_handle_event_mouse(main_window); } - } while(gui_event = get_os_event()); /* End of main activity loop */ + } while((gui_event = get_os_event())); /* End of main activity loop */ /* kolibri_quit(); */ diff --git a/contrib/C_Layer/INCLUDE/kolibri_checkbox.h b/contrib/C_Layer/INCLUDE/kolibri_checkbox.h index 8ce12c1e75..647790ff80 100644 --- a/contrib/C_Layer/INCLUDE/kolibri_checkbox.h +++ b/contrib/C_Layer/INCLUDE/kolibri_checkbox.h @@ -2,7 +2,7 @@ #define KOLIBRI_CHECKBOX_H #include "kolibri_colors.h" - + enum CHECKBOX_FLAGS { CHECKBOX_IS_SET = 0x00000002 /* Add more flags later */ @@ -20,7 +20,11 @@ typedef struct { /* Users can use members above this */ unsigned int size_of_str; -}check_box; +}check_box; + +extern void (*check_box_draw2)(check_box *) __attribute__((__stdcall__)); +extern void (*check_box_mouse2)(check_box *)__attribute__((__stdcall__)); +extern void (*init_checkbox2)(check_box *)__attribute__((__stdcall__)); check_box* kolibri_new_check_box(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey, char *label_text) { @@ -32,12 +36,12 @@ check_box* kolibri_new_check_box(unsigned int tlx, unsigned int tly, unsigned in new_checkbox -> border_color = kolibri_color_table.color_work_graph; new_checkbox -> text_color = kolibri_color_table.color_work_text; new_checkbox -> text = label_text; - new_checkbox -> flags = 0x00000008; + new_checkbox -> flags = 0x00000008; + + (*init_checkbox2)(new_checkbox); // count text width for mouse action and set flags return new_checkbox; } -extern void (*check_box_draw2)(check_box *) __attribute__((__stdcall__)); -extern void (*check_box_mouse2)(check_box *)__attribute__((__stdcall__)); #endif /* KOLIBRI_CHECKBOX_H */ diff --git a/contrib/C_Layer/INCLUDE/kolibri_frame.h b/contrib/C_Layer/INCLUDE/kolibri_frame.h index c8eb37cc80..9a173bf585 100644 --- a/contrib/C_Layer/INCLUDE/kolibri_frame.h +++ b/contrib/C_Layer/INCLUDE/kolibri_frame.h @@ -8,37 +8,37 @@ enum { typedef struct { unsigned int type; - uint16_t size_x; - uint16_t start_x; - uint16_t size_y; - uint16_t start_y; - unsigned int ext_col; - unsigned int int_col; - unsigned int draw_text_flag; - char *text_pointer; - unsigned int text_position; - unsigned int font_number; - unsigned int font_size_y; - unsigned int font_color; + uint16_t size_x; + uint16_t start_x; + uint16_t size_y; + uint16_t start_y; + unsigned int ext_col; + unsigned int int_col; + unsigned int draw_text_flag; + char *text_pointer; + unsigned int text_position; + unsigned int font_number; + unsigned int font_size_y; + unsigned int font_color; unsigned int font_backgr_color; -}frame; +}frame; frame* kolibri_new_frame(uint16_t tlx, uint16_t tly, uint16_t sizex, uint16_t sizey, unsigned int ext_col, unsigned int int_col, unsigned int draw_text_flag, char *text_pointer, unsigned int text_position, unsigned int font_color, unsigned int font_bgcolor) { frame *new_frame = (frame *)malloc(sizeof(frame)); new_frame -> type = 0; - new_frame -> size_x = sizex; - new_frame -> start_x = tlx; - new_frame -> size_y = sizey; - new_frame -> start_y = tly; - new_frame -> ext_col = ext_col; - new_frame -> int_col = int_col; - new_frame -> draw_text_flag = draw_text_flag; - new_frame -> text_pointer = text_pointer; - new_frame -> text_position = text_position; - new_frame -> font_number = 1; - new_frame -> font_size_y = 12; - new_frame -> font_color = font_color; + new_frame -> size_x = sizex; + new_frame -> start_x = tlx; + new_frame -> size_y = sizey; + new_frame -> start_y = tly; + new_frame -> ext_col = ext_col; + new_frame -> int_col = int_col; + new_frame -> draw_text_flag = draw_text_flag; + new_frame -> text_pointer = text_pointer; + new_frame -> text_position = text_position; + new_frame -> font_number = 0; // 0 == font 6x9, 1==8x16 + new_frame -> font_size_y = 9; + new_frame -> font_color = font_color; new_frame -> font_backgr_color = font_bgcolor; return new_frame; } diff --git a/contrib/C_Layer/INCLUDE/kolibri_gui_elements.h b/contrib/C_Layer/INCLUDE/kolibri_gui_elements.h index 735d1b8a6e..d26eed9962 100644 --- a/contrib/C_Layer/INCLUDE/kolibri_gui_elements.h +++ b/contrib/C_Layer/INCLUDE/kolibri_gui_elements.h @@ -39,7 +39,6 @@ typedef struct{ void *next, *prev; }kolibri_window_element; - typedef void (*cb_elem_boxlib)(void *) __attribute__((__stdcall__)); /* Generic structure for supporting functions on various elements of Kolibri's GUI */