Rev 6612 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6612 | Rev 8581 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | 3 | ||
4 | typedef struct __attribute__ ((__packed__)) { |
4 | typedef struct __attribute__ ((__packed__)) { |
5 | // uint16_t xsize; |
5 | // uint16_t xsize; |
6 | // uint16_t xpos; |
6 | // uint16_t xpos; |
7 | // uint16_t ysize; |
7 | // uint16_t ysize; |
8 | // uint16_t ypos; |
8 | // uint16_t ypos; |
9 | uint32_t x_w; |
9 | uint32_t x_w; |
10 | uint32_t y_h; |
10 | uint32_t y_h; |
11 | uint32_t btn_height; |
11 | uint32_t btn_height; |
12 | uint32_t type; // type 1 - stylish frame, type 2 - ?, type 0 - ? |
12 | uint32_t type; // type 1 - stylish frame, type 2 - ?, type 0 - ? |
Line 31... | Line 31... | ||
31 | uint32_t work_size; |
31 | uint32_t work_size; |
32 | uint32_t all_redraw; // need to be set =1 before each redraw |
32 | uint32_t all_redraw; // need to be set =1 before each redraw |
33 | uint32_t ar_offset; |
33 | uint32_t ar_offset; |
34 | } scrollbar; |
34 | } scrollbar; |
Line 35... | Line 35... | ||
35 | 35 | ||
36 | inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area, |
36 | static inline scrollbar* kolibri_scrollbar(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area, |
37 | uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color) |
37 | uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color) |
38 | { |
38 | { |
Line 39... | Line 39... | ||
39 | memset(sb, 0, sizeof(scrollbar)); |
39 | memset(sb, 0, sizeof(scrollbar)); |
40 | 40 | ||
41 | sb->x_w = x_w; |
41 | sb->x_w = x_w; |
42 | sb->y_h = y_h; |
42 | sb->y_h = y_h; |
43 | sb->btn_height = btn_height; |
43 | sb->btn_height = btn_height; |
44 | sb->type = 1; |
44 | sb->type = 1; |
45 | sb->max_area = max_area; |
45 | sb->max_area = max_area; |
46 | sb->cur_area = cur_area; |
46 | sb->cur_area = cur_area; |
47 | sb->position = position; |
47 | sb->position = position; |
48 | sb->line_color = line_color; |
48 | sb->line_color = line_color; |
49 | sb->back_color = back_color; // 0xeeeeee |
49 | sb->back_color = back_color; // 0xeeeeee |
50 | sb->front_color = front_color; // 0xbbddff |
50 | sb->front_color = front_color; // 0xbbddff |
51 | sb->ar_offset = max_area / 30; // temporary step 3% |
51 | sb->ar_offset = max_area / 30; // temporary step 3% |
52 | sb->all_redraw = 1; |
52 | sb->all_redraw = 1; |
53 | return sb; |
53 | return sb; |
54 | }; |
54 | }; |
55 | 55 | ||
56 | inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area, |
56 | static inline scrollbar* kolibri_new_scrollbar(uint32_t x_w, uint32_t y_h, uint32_t btn_height, uint32_t max_area, |
57 | uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color) |
57 | uint32_t cur_area, uint32_t position, uint32_t back_color, uint32_t front_color, uint32_t line_color) |
58 | { |
58 | { |
59 | scrollbar *sb = (scrollbar *)malloc(sizeof(scrollbar)); |
59 | scrollbar *sb = (scrollbar *)malloc(sizeof(scrollbar)); |
60 | 60 | ||
61 | return kolibri_scrollbar(sb, x_w, y_h, btn_height, max_area, cur_area, position, back_color, front_color, line_color); |
61 | return kolibri_scrollbar(sb, x_w, y_h, btn_height, max_area, cur_area, position, back_color, front_color, line_color); |
62 | }; |
62 | }; |
63 | 63 | ||
64 | inline scrollbar* kolibri_scrollbar_def(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position) |
64 | static inline scrollbar* kolibri_scrollbar_def(scrollbar* sb, uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position) |
65 | { |
65 | { |
66 | return kolibri_scrollbar(sb, x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text); |
66 | return kolibri_scrollbar(sb, x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text); |
67 | }; |
67 | }; |
68 | 68 | ||
69 | inline scrollbar* kolibri_new_scrollbar_def(uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position) |
69 | static inline scrollbar* kolibri_new_scrollbar_def(uint32_t x_w, uint32_t y_h, uint32_t max_area, uint32_t cur_area, uint32_t position) |
70 | { |
70 | { |
71 | return kolibri_new_scrollbar(x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text); |
71 | return kolibri_new_scrollbar(x_w, y_h, 15, max_area, cur_area, position, kolibri_color_table.color_work_area, kolibri_color_table.color_work_button, kolibri_color_table.color_work_button_text); |
72 | }; |
72 | }; |
73 | 73 | ||
74 | inline void gui_add_scrollbar_h(kolibri_window *wnd, scrollbar* sb) |
74 | static inline void gui_add_scrollbar_h(kolibri_window *wnd, scrollbar* sb) |
75 | { |
75 | { |
Line 76... | Line 76... | ||
76 | kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_H, sb); |
76 | kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_H, sb); |
77 | } |
77 | } |
78 | 78 | ||
79 | inline void gui_add_scrollbar_v(kolibri_window *wnd, scrollbar* sb) |
79 | static inline void gui_add_scrollbar_v(kolibri_window *wnd, scrollbar* sb) |
80 | { |
80 | { |
81 | kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_V, sb); |
81 | kolibri_window_add_element(wnd, KOLIBRI_SCROLL_BAR_V, sb); |
82 | } |
82 | } |
83 | 83 | ||
84 | extern void (*scrollbar_h_draw)(scrollbar*) __attribute__((__stdcall__)); |
84 | extern void (*scrollbar_h_draw)(scrollbar*) __attribute__((__stdcall__)); |