From 0b68ccc4d0cea6620323ca43ae32fb973ce8ada4 Mon Sep 17 00:00:00 2001 From: siemargl Date: Tue, 8 Nov 2016 00:42:19 +0000 Subject: [PATCH] sync editbox change git-svn-id: svn://kolibrios.org@6690 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../C_Layer/EXAMPLE/libguic_kolibri/editor_tree_msgbox.c | 9 +++++---- contrib/C_Layer/INCLUDE/kolibri_editbox.h | 2 ++ contrib/C_Layer/INCLUDE/kolibri_treelist.h | 5 ++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/contrib/C_Layer/EXAMPLE/libguic_kolibri/editor_tree_msgbox.c b/contrib/C_Layer/EXAMPLE/libguic_kolibri/editor_tree_msgbox.c index 36ec69a4d9..54ed792f4c 100644 --- a/contrib/C_Layer/EXAMPLE/libguic_kolibri/editor_tree_msgbox.c +++ b/contrib/C_Layer/EXAMPLE/libguic_kolibri/editor_tree_msgbox.c @@ -80,7 +80,7 @@ int main(int argc, char **argv) (*ted_text_add)(ed, sampletext, strlen(sampletext), 0); // treelist as tree - treelist *tl = kolibri_new_treelist(X_Y(0, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, TL_KEY_NO_EDIT | TL_DRAW_PAR_LINE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); + treelist *tl = kolibri_new_treelist(X_Y(0, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, /*TL_KEY_NO_EDIT |*/ TL_DRAW_PAR_LINE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); (*tl_data_init)(tl); // читаем файл с курсорами и линиями @@ -113,12 +113,13 @@ int main(int argc, char **argv) (*tl_cur_beg)(tl); //;ставим курсор на начало списка gui_add_treelist(main_window, tl); - // treelist as listbox - treelist *tl2 = kolibri_new_treelist(X_Y(220, 200), X_Y(200, 200), 16, X_Y(16, 16), 100, 50, 0, 0, TL_LISTBOX_MODE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); + // treelist as listbox, no caption, no icons + treelist *tl2 = kolibri_new_treelist(X_Y(220, 200), X_Y(200, 200), 0, X_Y(16, 16), 100, 50, 0, 0, TL_LISTBOX_MODE, &ed_lock, 0x8080ff, 0x0000ff, 0xffffff); (*tl_data_init)(tl2); + // tl->col_zag |= 0x10000000; // 0x10 in txt color must give font 9x16, but this not work, only 6x8 font ( tl2->data_img_sys = tl->data_img_sys; - tl2->data_img = tl->data_img; + //tl2->data_img = tl->data_img; - no icons will be drawed treelist_node_add(tl2, "list1", 0, 0, 0); // где 1 номер иконки с книгой (*tl_cur_next)(tl2); diff --git a/contrib/C_Layer/INCLUDE/kolibri_editbox.h b/contrib/C_Layer/INCLUDE/kolibri_editbox.h index f6497960bb..1b88fec957 100644 --- a/contrib/C_Layer/INCLUDE/kolibri_editbox.h +++ b/contrib/C_Layer/INCLUDE/kolibri_editbox.h @@ -55,6 +55,8 @@ typedef struct edit_box_t { unsigned int cl_curs_y; unsigned int shift; unsigned int shift_old; + unsigned int height; + unsigned int char_width; }edit_box; /* Initializes an Editbox with sane settings, sufficient for most use. diff --git a/contrib/C_Layer/INCLUDE/kolibri_treelist.h b/contrib/C_Layer/INCLUDE/kolibri_treelist.h index 8d3b56a672..cf6443a93a 100644 --- a/contrib/C_Layer/INCLUDE/kolibri_treelist.h +++ b/contrib/C_Layer/INCLUDE/kolibri_treelist.h @@ -4,7 +4,7 @@ /// константы стиля enum tl_style { - TL_KEY_NO_EDIT = 1, // элемент нельзя редактировать на клавиатуре (изменять уровни, удалять) + TL_KEY_NO_EDIT = 1, // элемент нельзя редактировать на клавиатуре (изменять уровни стрелками, удалять DEL) TL_DRAW_PAR_LINE = 2, // рисовать линии к родительскому узлу TL_LISTBOX_MODE = 4 //стиль не отображает уровни (как в ListBox все одного уровня) }; @@ -55,6 +55,8 @@ typedef struct __attribute__ ((__packed__)) { void *on_press; // +84 указатель на функцию, которая вызывается при нажатии Enter } treelist; +// capt_cy may be 0 = no caption +// if icon_size is 16x16, and data_img id NULL, no icons - useful in list mode static inline treelist* kolibri_new_treelist( uint32_t x_w, uint32_t y_h, uint16_t capt_cy, uint32_t icon_size_xy, uint16_t info_size, uint32_t info_max_count, uint16_t info_capt_len, uint16_t info_capt_offs, enum tl_style style, void *el_focus, color_t back, color_t title, color_t txt) { @@ -74,6 +76,7 @@ static inline treelist* kolibri_new_treelist( uint32_t x_w, uint32_t y_h, uint16 tl->info_capt_len = info_capt_len; tl->info_capt_offs = info_capt_offs; tl->el_focus = el_focus; + tl->capt_cy = capt_cy; tl->p_scroll = kolibri_new_scrollbar_def(X_Y(0, 16), X_Y(0, 0), 100, 30, 0); return tl; }