Subversion Repositories Kolibri OS

Rev

Rev 6589 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6589 Rev 8581
1
#ifndef KOLIBRI_OPTIONBOX_H
1
#ifndef KOLIBRI_OPTIONBOX_H
2
#define KOLIBRI_OPTIONBOX_H
2
#define KOLIBRI_OPTIONBOX_H
3
 
3
 
4
typedef struct __attribute__ ((__packed__)) option_box_t {
4
typedef struct __attribute__ ((__packed__)) option_box_t {
5
    struct option_box_t **selected;
5
    struct option_box_t **selected;
6
    uint16_t posx;
6
    uint16_t posx;
7
    uint16_t posy;
7
    uint16_t posy;
8
    uint32_t text_margin; // = 4 ðàññòîÿíèå îò ïðÿìîóãîëüíèêà ÷åê áîêñà äî íàäïèñè
8
    uint32_t text_margin; // = 4 ���������� �� �������������� ��� ����� �� �������
9
    uint32_t size;       // 12 ðàçìåð êâàäðàòà ÷åê áîêñà
9
    uint32_t size;       // 12 ������ �������� ��� �����
10
    color_t color;
10
    color_t color;
11
    color_t border_color; // individual border
11
    color_t border_color; // individual border
12
    color_t text_color;
12
    color_t text_color;
13
    char *text;
13
    char *text;
14
    uint32_t text_len;
14
    uint32_t text_len;
15
    uint32_t flags;
15
    uint32_t flags;
16
}option_box;
16
}option_box;
17
 
17
 
18
extern void (*option_box_draw)(option_box **) __attribute__((__stdcall__));
18
extern void (*option_box_draw)(option_box **) __attribute__((__stdcall__));
19
extern void (*option_box_mouse)(option_box **)__attribute__((__stdcall__));
19
extern void (*option_box_mouse)(option_box **)__attribute__((__stdcall__));
20
 
20
 
21
inline option_box* gui_optionbox(option_box* ob, uint32_t x_y, char* text, option_box**select)
21
static inline option_box* gui_optionbox(option_box* ob, uint32_t x_y, char* text, option_box**select)
22
{
22
{
23
    ob->selected = select;
23
    ob->selected = select;
24
    ob->posx = x_y >> 16;
24
    ob->posx = x_y >> 16;
25
    ob->posy = x_y & 0xFFFF;
25
    ob->posy = x_y & 0xFFFF;
26
    ob->text_margin = 4;
26
    ob->text_margin = 4;
27
    ob->size = 12;
27
    ob->size = 12;
28
    ob->color = kolibri_color_table.color_work_button_text;
28
    ob->color = kolibri_color_table.color_work_button_text;
29
    ob->border_color = kolibri_color_table.color_work_button;
29
    ob->border_color = kolibri_color_table.color_work_button;
30
    ob->text_color = kolibri_color_table.color_work_text | 0x80000000;
30
    ob->text_color = kolibri_color_table.color_work_text | 0x80000000;
31
    ob->text = text;
31
    ob->text = text;
32
    ob->text_len = strlen(text);
32
    ob->text_len = strlen(text);
33
    ob->flags = 0; // not used
33
    ob->flags = 0; // not used
34
 
34
 
35
    return ob;
35
    return ob;
36
}
36
}
37
 
37
 
38
inline option_box* gui_new_optionbox(uint32_t x_y, char* text, option_box**select)
38
static inline option_box* gui_new_optionbox(uint32_t x_y, char* text, option_box**select)
39
{
39
{
40
    option_box* ob = malloc(sizeof(option_box));
40
    option_box* ob = malloc(sizeof(option_box));
41
 
41
 
42
    return gui_optionbox(ob, x_y, text, select);
42
    return gui_optionbox(ob, x_y, text, select);
43
}
43
}
44
 
44
 
45
#define gui_optionbox_def(a,b,c,d) gui_optionbox(a,b,c,d)
45
#define gui_optionbox_def(a,b,c,d) gui_optionbox(a,b,c,d)
46
 
46
 
47
#define gui_new_optionbox_def(a,b,c) gui_new_optionbox(a,b,c)
47
#define gui_new_optionbox_def(a,b,c) gui_new_optionbox(a,b,c)
48
 
48
 
49
inline void gui_add_optiongroup(kolibri_window *wnd, option_box** option_group)
49
static inline void gui_add_optiongroup(kolibri_window *wnd, option_box** option_group)
50
{
50
{
51
    kolibri_window_add_element(wnd, KOLIBRI_OPTIONGROUP, option_group);
51
    kolibri_window_add_element(wnd, KOLIBRI_OPTIONGROUP, option_group);
52
}
52
}
53
 
53
 
54
 
54
 
55
#endif /* KOLIBRI_OPTIONBOX_H */
55
#endif /* KOLIBRI_OPTIONBOX_H */