Rev 6479 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6479 | Rev 6589 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef KOLIBRI_FRAME_H |
1 | #ifndef KOLIBRI_FRAME_H |
2 | #define KOLIBRI_FRAME_H |
2 | #define KOLIBRI_FRAME_H |
Line 3... | Line 3... | ||
3 | 3 | ||
4 | enum { |
4 | enum fr_text_position_t { |
5 | TOP, |
5 | FR_TOP, |
- | 6 | FR_BOTTON |
|
- | 7 | }; |
|
- | 8 | ||
- | 9 | /* |
|
- | 10 | ; FR_FLAGS = [x][yyy][z] |
|
- | 11 | ; z - Caption |
|
- | 12 | ; yyy - BorderStyle |
|
- | 13 | ; x - BackStyle |
|
- | 14 | */ |
|
- | 15 | enum fr_flags_t { |
|
- | 16 | FR_CAPTION = 1, // if text != null set auto |
|
- | 17 | FR_DOUBLE = 0, // default |
|
- | 18 | FR_RAISED = 2, |
|
- | 19 | FR_SUNKEN = 4, |
|
- | 20 | FR_ETCHED = 6, |
|
- | 21 | FR_RINGED = 8, |
|
6 | BOTTON |
22 | FR_FILLED = 0x10 |
Line 7... | Line 23... | ||
7 | }; |
23 | }; |
8 | 24 | ||
9 | typedef struct { |
25 | typedef struct { |
10 | uint32_t type; |
26 | uint32_t type; |
11 | uint32_t x_w; |
27 | uint32_t x_w; |
12 | uint32_t y_h; |
28 | uint32_t y_h; |
13 | color_t ext_col; |
29 | color_t ext_col; |
14 | color_t int_col; |
30 | color_t int_col; |
15 | uint32_t draw_text_flag; |
31 | uint32_t flags; |
16 | char *text_pointer; |
32 | char *text_pointer; |
17 | uint32_t text_position; |
33 | uint32_t text_position; |
18 | uint32_t font_number; |
34 | uint32_t font_number; |
19 | uint32_t font_size_y; |
35 | uint32_t font_size_y; |
20 | color_t font_color; |
36 | color_t font_color; |
Line 21... | Line 37... | ||
21 | color_t font_bg_color; |
37 | color_t font_bg_color; |
- | 38 | }frame; |
|
22 | }frame; |
39 | |
23 | 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, |
|
24 | inline frame* kolibri_frame(frame* f, uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, uint32_t text_position, color_t font_color, color_t font_bgcolor) |
41 | color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) |
25 | { |
42 | { |
26 | f->type = 0; |
43 | f->type = 0; |
27 | f->x_w = x_w; |
44 | f->x_w = x_w; |
- | 45 | f->y_h = y_h; |
|
28 | f->y_h = y_h; |
46 | f->ext_col = ext_col; |
29 | f->ext_col = ext_col; |
47 | f->int_col = int_col; |
30 | f->int_col = int_col; |
48 | f->flags = flags; |
31 | f->draw_text_flag = text != NULL; |
49 | if (text) f->flags |= FR_CAPTION; |
32 | f->text_pointer = text; |
50 | f->text_pointer = text; |
33 | f->text_position = text_position; |
51 | f->text_position = text_position; |
34 | f->font_number = 0; // 0 == font 6x9, 1==8x16 |
52 | f->font_number = 0; // 0 == font 6x9, 1==8x16 |
Line -... | Line 53... | ||
- | 53 | f->font_size_y = 9; |
|
35 | f->font_size_y = 9; |
54 | f->font_color = font_color | 0x80000000; |
36 | f->font_color = font_color | 0x80000000; |
55 | f->font_bg_color = font_bgcolor; |
Line 37... | Line 56... | ||
37 | f->font_bg_color = font_bgcolor; |
56 | |
- | 57 | ||
38 | 58 | return f; |
|
39 | return f; |
59 | } |
40 | } |
60 | |
41 | 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, |
|
Line 42... | Line 62... | ||
42 | inline frame* kolibri_new_frame(uint32_t x_w, uint32_t y_h, color_t ext_col, color_t int_col, char *text, uint32_t text_position, color_t font_color, color_t font_bgcolor) |
62 | color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) |
43 | { |
63 | { |
44 | frame *new_frame = (frame *)malloc(sizeof(frame)); |
64 | frame *new_frame = (frame *)malloc(sizeof(frame)); |
45 | return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor); |
65 | return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor, flags); |
Line 46... | Line 66... | ||
46 | } |
66 | } |
47 | 67 | ||
48 | inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text) |
68 | inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text) |
49 | { |
69 | { |
Line 50... | Line 70... | ||
50 | return kolibri_frame(f, x_w, y_h, 0x00FCFCFC, 0x00DCDCDC, text, TOP, kolibri_color_table.color_work_text, kolibri_color_table.color_work_area); |
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); |
51 | } |
71 | } |
52 | 72 |