Rev 6479 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6450 | punk_joker | 1 | #ifndef KOLIBRI_FRAME_H |
2 | #define KOLIBRI_FRAME_H |
||
3 | |||
6589 | siemargl | 4 | enum fr_text_position_t { |
5 | FR_TOP, |
||
6 | FR_BOTTON |
||
6450 | punk_joker | 7 | }; |
6589 | siemargl | 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, |
||
22 | FR_FILLED = 0x10 |
||
23 | }; |
||
6450 | punk_joker | 24 | |
6457 | punk_joker | 25 | typedef struct { |
6479 | siemargl | 26 | uint32_t type; |
27 | uint32_t x_w; |
||
28 | uint32_t y_h; |
||
29 | color_t ext_col; |
||
30 | color_t int_col; |
||
6589 | siemargl | 31 | uint32_t flags; |
6466 | siemargl | 32 | char *text_pointer; |
6479 | siemargl | 33 | uint32_t text_position; |
34 | uint32_t font_number; |
||
35 | uint32_t font_size_y; |
||
36 | color_t font_color; |
||
37 | color_t font_bg_color; |
||
6466 | siemargl | 38 | }frame; |
6479 | siemargl | 39 | |
6589 | siemargl | 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, |
41 | color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) |
||
6479 | siemargl | 42 | { |
43 | f->type = 0; |
||
44 | f->x_w = x_w; |
||
45 | f->y_h = y_h; |
||
46 | f->ext_col = ext_col; |
||
47 | f->int_col = int_col; |
||
6589 | siemargl | 48 | f->flags = flags; |
49 | if (text) f->flags |= FR_CAPTION; |
||
6479 | siemargl | 50 | f->text_pointer = text; |
51 | f->text_position = text_position; |
||
52 | f->font_number = 0; // 0 == font 6x9, 1==8x16 |
||
53 | f->font_size_y = 9; |
||
54 | f->font_color = font_color | 0x80000000; |
||
55 | f->font_bg_color = font_bgcolor; |
||
56 | |||
6589 | siemargl | 57 | |
6479 | siemargl | 58 | return f; |
59 | } |
||
6450 | punk_joker | 60 | |
6589 | siemargl | 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, |
62 | color_t font_color, color_t font_bgcolor, enum fr_flags_t flags) |
||
6450 | punk_joker | 63 | { |
6457 | punk_joker | 64 | frame *new_frame = (frame *)malloc(sizeof(frame)); |
6589 | siemargl | 65 | return kolibri_frame(new_frame, x_w, y_h, ext_col, int_col, text, text_position, font_color, font_bgcolor, flags); |
6479 | siemargl | 66 | } |
67 | |||
68 | inline frame* kolibri_frame_def(frame* f, uint32_t x_w, uint32_t y_h, char *text) |
||
69 | { |
||
6589 | siemargl | 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); |
6479 | siemargl | 71 | } |
72 | |||
73 | inline frame* kolibri_new_frame_def(uint32_t x_w, uint32_t y_h, char *text) |
||
74 | { |
||
6589 | siemargl | 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); |
6479 | siemargl | 76 | } |
77 | |||
78 | inline void gui_add_frame(kolibri_window *wnd, frame* f) |
||
79 | { |
||
80 | kolibri_window_add_element(wnd, KOLIBRI_FRAME, f); |
||
81 | } |
||
6450 | punk_joker | 82 | |
6479 | siemargl | 83 | |
6457 | punk_joker | 84 | extern void (*frame_draw)(frame *) __attribute__((__stdcall__)); |
6450 | punk_joker | 85 | |
86 | #endif /* KOLIBRI_FRAME_H */ |