Subversion Repositories Kolibri OS

Rev

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

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