Subversion Repositories Kolibri OS

Rev

Rev 6470 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6391 ashmew2 1
#ifndef KOLIBRI_CHECKBOX_H
2
#define KOLIBRI_CHECKBOX_H
3
 
4
#include "kolibri_colors.h"
6466 siemargl 5
 
6470 siemargl 6
/*
7
ch_flag_en - флаг установленного чек бокса
8
ch_flag_top - флаг расположения текста вверху
9
ch_flag_middle - флаг расположения текста в центре
10
ch_flag_bottom - флаг расположения текста в низу т.е. по умолчанию принимается значение внизу
11
*/
12
 
6391 ashmew2 13
enum CHECKBOX_FLAGS {
14
     CHECKBOX_IS_SET = 0x00000002
15
     /* Add more flags later */
16
};
17
 
6457 punk_joker 18
typedef struct {
6391 ashmew2 19
    unsigned int left_s;
20
    unsigned int top_s;
21
    unsigned int ch_text_margin;
22
    unsigned int color;
23
    unsigned int border_color;
24
    unsigned int text_color;
25
    char *text;
26
    unsigned int flags;
27
 
28
    /* Users can use members above this */
29
    unsigned int size_of_str;
6466 siemargl 30
}check_box;
31
 
32
extern void (*check_box_draw2)(check_box *) __attribute__((__stdcall__));
33
extern void (*check_box_mouse2)(check_box *)__attribute__((__stdcall__));
34
extern void (*init_checkbox2)(check_box *)__attribute__((__stdcall__));
6391 ashmew2 35
 
6457 punk_joker 36
check_box* kolibri_new_check_box(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey, char *label_text)
6391 ashmew2 37
{
6457 punk_joker 38
     check_box* new_checkbox = (check_box *)malloc(sizeof(check_box));
6391 ashmew2 39
     new_checkbox -> left_s = (tlx << 16) + sizex;
40
     new_checkbox -> top_s  = (tly << 16) + sizey;
41
     new_checkbox -> ch_text_margin = 10;
6482 siemargl 42
     new_checkbox -> color = kolibri_color_table.color_work_area; // 0xFFFFFFFF; // 0x80AABBCC, 31-bit mus be set asciiz
6391 ashmew2 43
     new_checkbox -> border_color = kolibri_color_table.color_work_graph;
44
     new_checkbox -> text_color = kolibri_color_table.color_work_text;
45
     new_checkbox -> text = label_text;
6466 siemargl 46
     new_checkbox -> flags = 0x00000008;
47
 
48
     (*init_checkbox2)(new_checkbox); // count text width for mouse action and set flags
6391 ashmew2 49
 
50
     return new_checkbox;
51
}
52
 
53
 
54
#endif /* KOLIBRI_CHECKBOX_H */