sync editbox change

git-svn-id: svn://kolibrios.org@6690 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
siemargl 2016-11-08 00:42:19 +00:00
parent 14032d12c8
commit 0b68ccc4d0
3 changed files with 11 additions and 5 deletions

View File

@ -80,7 +80,7 @@ int main(int argc, char **argv)
(*ted_text_add)(ed, sampletext, strlen(sampletext), 0); (*ted_text_add)(ed, sampletext, strlen(sampletext), 0);
// treelist as tree // 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); (*tl_data_init)(tl);
// ÷èòàåì ôàéë ñ êóðñîðàìè è ëèíèÿìè // ÷èòàåì ôàéë ñ êóðñîðàìè è ëèíèÿìè
@ -113,12 +113,13 @@ int main(int argc, char **argv)
(*tl_cur_beg)(tl); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà (*tl_cur_beg)(tl); //;ñòàâèì êóðñîð íà íà÷àëî ñïèñêà
gui_add_treelist(main_window, tl); gui_add_treelist(main_window, tl);
// treelist as listbox // treelist as listbox, no caption, no icons
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 *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_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_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 íîìåð èêîíêè ñ êíèãîé treelist_node_add(tl2, "list1", 0, 0, 0); // ãäå 1 íîìåð èêîíêè ñ êíèãîé
(*tl_cur_next)(tl2); (*tl_cur_next)(tl2);

View File

@ -55,6 +55,8 @@ typedef struct edit_box_t {
unsigned int cl_curs_y; unsigned int cl_curs_y;
unsigned int shift; unsigned int shift;
unsigned int shift_old; unsigned int shift_old;
unsigned int height;
unsigned int char_width;
}edit_box; }edit_box;
/* Initializes an Editbox with sane settings, sufficient for most use. /* Initializes an Editbox with sane settings, sufficient for most use.

View File

@ -4,7 +4,7 @@
/// êîíñòàíòû ñòèëÿ /// êîíñòàíòû ñòèëÿ
enum tl_style { enum tl_style {
TL_KEY_NO_EDIT = 1, // элемент нельзя редактировать на клавиатуре (изменять уровни, удалять) TL_KEY_NO_EDIT = 1, // ýëåìåíò íåëüçÿ ðåäàêòèðîâàòü íà êëàâèàòóðå (èçìåíÿòü óðîâíè ñòðåëêàìè, óäàëÿòü DEL)
TL_DRAW_PAR_LINE = 2, // ðèñîâàòü ëèíèè ê ðîäèòåëüñêîìó óçëó TL_DRAW_PAR_LINE = 2, // ðèñîâàòü ëèíèè ê ðîäèòåëüñêîìó óçëó
TL_LISTBOX_MODE = 4 //ñòèëü íå îòîáðàæàåò óðîâíè (êàê â ListBox âñå îäíîãî óðîâíÿ) TL_LISTBOX_MODE = 4 //ñòèëü íå îòîáðàæàåò óðîâíè (êàê â ListBox âñå îäíîãî óðîâíÿ)
}; };
@ -55,6 +55,8 @@ typedef struct __attribute__ ((__packed__)) {
void *on_press; // +84 óêàçàòåëü íà ôóíêöèþ, êîòîðàÿ âûçûâàåòñÿ ïðè íàæàòèè Enter void *on_press; // +84 óêàçàòåëü íà ôóíêöèþ, êîòîðàÿ âûçûâàåòñÿ ïðè íàæàòèè Enter
} treelist; } 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, 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) 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_len = info_capt_len;
tl->info_capt_offs = info_capt_offs; tl->info_capt_offs = info_capt_offs;
tl->el_focus = el_focus; 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); tl->p_scroll = kolibri_new_scrollbar_def(X_Y(0, 16), X_Y(0, 0), 100, 30, 0);
return tl; return tl;
} }