Rev 6589 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6589 | Rev 8581 | ||
---|---|---|---|
1 | #ifndef KOLIBRI_FRAME_H |
1 | #ifndef KOLIBRI_FRAME_H |
2 | #define KOLIBRI_FRAME_H |
2 | #define KOLIBRI_FRAME_H |
3 | 3 | ||
4 | enum fr_text_position_t { |
4 | enum fr_text_position_t { |
5 | FR_TOP, |
5 | FR_TOP, |
6 | FR_BOTTON |
6 | FR_BOTTON |
7 | }; |
7 | }; |
8 | 8 | ||
9 | /* |
9 | /* |
10 | ; FR_FLAGS = [x][yyy][z] |
10 | ; FR_FLAGS = [x][yyy][z] |
11 | ; z - Caption |
11 | ; z - Caption |
12 | ; yyy - BorderStyle |
12 | ; yyy - BorderStyle |
13 | ; x - BackStyle |
13 | ; x - BackStyle |
14 | */ |
14 | */ |
15 | enum fr_flags_t { |
15 | enum fr_flags_t { |
16 | FR_CAPTION = 1, // if text != null set auto |
16 | FR_CAPTION = 1, // if text != null set auto |
17 | FR_DOUBLE = 0, // default |
17 | FR_DOUBLE = 0, // default |
18 | FR_RAISED = 2, |
18 | FR_RAISED = 2, |
19 | FR_SUNKEN = 4, |
19 | FR_SUNKEN = 4, |
20 | FR_ETCHED = 6, |
20 | FR_ETCHED = 6, |
21 | FR_RINGED = 8, |
21 | FR_RINGED = 8, |
22 | FR_FILLED = 0x10 |
22 | FR_FILLED = 0x10 |
23 | }; |
23 | }; |
24 | 24 | ||
25 | typedef struct { |
25 | typedef struct { |
26 | uint32_t type; |
26 | uint32_t type; |
27 | uint32_t x_w; |
27 | uint32_t x_w; |
28 | uint32_t y_h; |
28 | uint32_t y_h; |
29 | color_t ext_col; |
29 | color_t ext_col; |
30 | color_t int_col; |
30 | color_t int_col; |
31 | uint32_t flags; |
31 | uint32_t flags; |
32 | char *text_pointer; |
32 | char *text_pointer; |
33 | uint32_t text_position; |
33 | uint32_t text_position; |
34 | uint32_t font_number; |
34 | uint32_t font_number; |
35 | uint32_t font_size_y; |
35 | uint32_t font_size_y; |
36 | color_t font_color; |
36 | color_t font_color; |
37 | color_t font_bg_color; |
37 | color_t font_bg_color; |
38 | }frame; |
38 | }frame; |
39 | 39 | ||
40 | inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position, |
40 | static inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position, |
41 | color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) |
41 | color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) |
42 | { |
42 | { |
43 | f->type = 0; |
43 | f->type = 0; |
44 | f->x_w = x_w; |
44 | f->x_w = x_w; |
45 | f->y_h = y_h; |
45 | f->y_h = y_h; |
46 | f->ext_col = ext_col; |
46 | f->ext_col = ext_col; |
47 | f->int_col = int_col; |
47 | f->int_col = int_col; |
48 | f->flags = flags; |
48 | f->flags = flags; |
49 | if (text) f->flags |= FR_CAPTION; |
49 | if (text) f->flags |= FR_CAPTION; |
50 | f->text_pointer = text; |
50 | f->text_pointer = text; |
51 | f->text_position = text_position; |
51 | f->text_position = text_position; |
52 | f->font_number = 0; // 0 == font 6x9, 1==8x16 |
52 | f->font_number = 0; // 0 == font 6x9, 1==8x16 |
53 | f->font_size_y = 9; |
53 | f->font_size_y = 9; |
54 | f->font_color = font_color | 0x80000000; |
54 | f->font_color = font_color | 0x80000000; |
55 | f->font_bg_color = font_bgcolor; |
55 | f->font_bg_color = font_bgcolor; |
56 | 56 | ||
57 | 57 | ||
58 | return f; |
58 | return f; |
59 | } |
59 | } |
60 | 60 | ||
61 | inline frame* kolibri_new_frame(uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position, |
61 | static inline frame* kolibri_new_frame(uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, enum fr_text_position_t text_position, |
62 | color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) |
62 | color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) |
63 | { |
63 | { |
64 | frame *new_frame = (frame *)malloc(sizeof(frame)); |
64 | frame *new_frame = (frame *)malloc(sizeof(frame)); |
65 | return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor, flags); |
65 | return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor, flags); |
66 | } |
66 | } |
67 | 67 | ||
68 | inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text) |
68 | static inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text) |
69 | { |
69 | { |
70 | return kolibri_frame(f, x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0); |
70 | return kolibri_frame(f, x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0); |
71 | } |
71 | } |
72 | 72 | ||
73 | inline frame* kolibri_new_frame_def(uint32_t x_w, uint32_t y_h, char *text) |
73 | static inline frame* kolibri_new_frame_def(uint32_t x_w, uint32_t y_h, char *text) |
74 | { |
74 | { |
75 | return kolibri_new_frame(x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0); |
75 | return kolibri_new_frame(x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, FR_TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area, 0); |
76 | } |
76 | } |
77 | 77 | ||
78 | inline void gui_add_frame(kolibri_window *wnd, frame* f) |
78 | static inline void gui_add_frame(kolibri_window *wnd, frame* f) |
79 | { |
79 | { |
80 | kolibri_window_add_element(wnd, KOLIBRI_FRAME, f); |
80 | kolibri_window_add_element(wnd, KOLIBRI_FRAME, f); |
81 | } |
81 | } |
82 | 82 | ||
83 | 83 | ||
84 | extern void (*frame_draw)(frame *) __attribute__((__stdcall__)); |
84 | extern void (*frame_draw)(frame *) __attribute__((__stdcall__)); |
85 | 85 | ||
86 | #endif /* KOLIBRI_FRAME_H */ |
86 | #endif /* KOLIBRI_FRAME_H */ |