Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. // writed by maxcodehack
  2. // adaptation of clayer for ktcc
  3. #ifndef KOLIBRI_BOXLIB_H
  4. #define KOLIBRI_BOXLIB_H
  5.  
  6. extern int kolibri_boxlib_init(void);
  7.  
  8. // SCROLLBAR
  9. typedef struct {
  10.         uint16_t xsize;
  11.     uint16_t xpos;
  12.     uint16_t ysize;
  13.     uint16_t ypos;
  14.     uint32_t btn_height;
  15.     uint32_t type;  // type 1 - stylish frame, type 2 - ?, type 0 - ?
  16.     uint32_t max_area;
  17.     uint32_t cur_area;
  18.     uint32_t position;
  19.     uint32_t back_color;
  20.     uint32_t front_color;
  21.     uint32_t line_color;
  22.     uint32_t redraw;
  23.     uint16_t delta;
  24.     uint16_t delta2;
  25.     uint16_t r_size_x;
  26.     uint16_t r_start_x;
  27.     uint16_t r_size_y;
  28.     uint16_t r_start_y;
  29.     uint32_t m_pos;
  30.     uint32_t m_pos2;
  31.     uint32_t m_keys;
  32.     uint32_t run_size;
  33.     uint32_t position2;
  34.     uint32_t work_size;
  35.     uint32_t all_redraw;  // need to be set =1 before each redraw
  36.     uint32_t ar_offset;
  37. } __attribute__ ((__packed__)) scrollbar;
  38.  
  39. extern void (*scrollbar_h_draw)(scrollbar*) __attribute__((__stdcall__));
  40. extern void (*scrollbar_h_mouse)(scrollbar*) __attribute__((__stdcall__));
  41. extern void (*scrollbar_v_draw)(scrollbar*) __attribute__((__stdcall__));
  42. extern void (*scrollbar_v_mouse)(scrollbar*) __attribute__((__stdcall__));
  43.  
  44. // CHECKBOX
  45. typedef struct {
  46.     unsigned int left_s;
  47.     unsigned int top_s;
  48.     unsigned int ch_text_margin;
  49.     unsigned int color;
  50.     unsigned int border_color;
  51.     unsigned int text_color;
  52.     char *text;
  53.     unsigned int flags;
  54.  
  55.     /* Users can use members above this */
  56.     unsigned int size_of_str;
  57. }check_box;
  58.  
  59. extern void (*check_box_draw2)(check_box *) __attribute__((__stdcall__));
  60. extern void (*check_box_mouse2)(check_box *)__attribute__((__stdcall__));
  61. extern void (*init_checkbox2)(check_box *)__attribute__((__stdcall__));
  62.  
  63. // DBUTTON
  64. typedef struct {
  65.         uint32_t type;
  66.         uint32_t x_w;
  67.         uint32_t y_h;
  68.         uint32_t mouse_pos;
  69.     uint32_t mouse_keys;
  70.     uint32_t mouse_keys_old;
  71.     void*    active_raw;        //active bitmap
  72.     void*    passive_raw;       //passive bitmap
  73.     void*    click_raw;         //pressed bitmap
  74.     uint32_t resolution_raw; // bpp, as esi fn65
  75.     void*    palette_raw;    // palette, as edi fn65
  76.     uint32_t offset_raw;     // width as ebp fn65
  77.     uint32_t select;         // internal state: 0 - passive, 2 - pressed, 1 - clicked
  78.     uint32_t click;          // clicked - 1, zero it after tested
  79. } pict_button;
  80.  
  81. extern void (*dynamic_button_draw)(pict_button *) __attribute__((__stdcall__));
  82. extern void (*dynamic_button_mouse)(pict_button *) __attribute__((__stdcall__));
  83.  
  84. // EDITBOX
  85.  
  86. typedef struct edit_box_t {
  87.   unsigned int width;
  88.     unsigned int left;
  89.     unsigned int top;
  90.     unsigned int color;
  91.     unsigned int shift_color;   // selected text color
  92.     unsigned int focus_border_color;
  93.     unsigned int blur_border_color;
  94.     unsigned int text_color;
  95.     unsigned int max;
  96.     char        *text;
  97.     void        *mouse_variable; // must be pointer edit_box** to save focused editbox
  98.     unsigned int flags;
  99.  
  100.     unsigned int size;  // used symbols in buffer without trailing zero
  101.     unsigned int pos;  // cursor position
  102. /* The following struct members are not used by the users of API */
  103.     unsigned int offset;
  104.     unsigned int cl_curs_x;
  105.     unsigned int cl_curs_y;
  106.     unsigned int shift;
  107.     unsigned int shift_old;
  108.     unsigned int height;
  109.     unsigned int char_width;
  110. }edit_box;
  111.  
  112. extern void (*edit_box_draw)(edit_box *) __attribute__((__stdcall__));
  113. extern void (*edit_box_key)(edit_box *) __attribute__((__stdcall__));
  114. extern void (*edit_box_mouse)(edit_box *) __attribute__((__stdcall__));
  115. extern void (*edit_box_set_text)(edit_box *, char *) __attribute__((__stdcall__));
  116. extern volatile unsigned press_key;
  117.  
  118. // FRAME
  119. typedef struct {
  120.         uint32_t type;
  121.         uint32_t x_w;
  122.         uint32_t y_h;
  123.         color_t ext_col;
  124.         color_t int_col;
  125.         uint32_t flags;
  126.         char *text_pointer;
  127.         uint32_t text_position;
  128.         uint32_t font_number;
  129.         uint32_t font_size_y;
  130.         color_t font_color;
  131.         color_t font_bg_color;
  132. }frame;
  133.  
  134. extern void (*frame_draw)(frame *) __attribute__((__stdcall__));
  135.  
  136. // MENUBAR
  137. typedef struct
  138. {
  139.         uint32_t type;   // 1 åñëè íåò ïîäìåíþ, ïðîñòî ïóíêò
  140.  
  141.         uint32_t x_w;   // âåðõíèé ïóíêò
  142.         uint32_t y_h;
  143.  
  144.         char* text_pointer;
  145.         char* pos_pointer;
  146.         char* text_end;
  147.         uint32_t mouse_pos;
  148.         uint32_t mouse_keys;
  149.  
  150.         uint32_t x_w1;  // ïîäìåíþ
  151.         uint32_t y_h1;
  152.  
  153.         color_t bckg_col;  // ôîí âåðõíåãî ïóêòà
  154.         color_t frnt_col;  // ôîí âûáðàííîãî âåðõíåãî ïóíêòà
  155.         color_t menu_col;  // ôîí âûïàäàþùåé ÷àñòè (ïîäïóêòû)
  156.         uint32_t select;
  157.         uint32_t out_select;
  158.         char* buf_adress;
  159.         char* procinfo;
  160.         uint32_t click;
  161.         uint32_t cursor;
  162.         uint32_t cursor_old;
  163.         uint32_t interval;
  164.         uint32_t cursor_max;
  165.         uint32_t extended_key;
  166.         color_t menu_sel_col;  // öâåò ôîíà âûáðàííîãî ïîäïóíêòà
  167.         color_t bckg_text_col; // öâåò øðèôòà íåâûáðàííîãî ïóíêòà
  168.         color_t frnt_text_col;  // öâåò øðèôòà âûáðàííîãî ïóíêòà
  169.         uint32_t mouse_keys_old;
  170.         uint32_t font_height;
  171.         uint32_t cursor_out;
  172.         uint32_t get_mouse_flag;
  173. } menubar;
  174.  
  175. extern void (*menu_bar_draw)(menubar *) __attribute__((__stdcall__));
  176. extern void (*menu_bar_mouse)(menubar *) __attribute__((__stdcall__));
  177. extern void (*menu_bar_activate)(menubar *) __attribute__((__stdcall__));
  178.  
  179. // OPTIONBOX
  180. typedef struct __attribute__ ((__packed__)) option_box_t {
  181.     struct option_box_t **selected;
  182.     uint16_t posx;
  183.     uint16_t posy;
  184.     uint32_t text_margin; // = 4 ðàññòîÿíèå îò ïðÿìîóãîëüíèêà ÷åê áîêñà äî íàäïèñè
  185.     uint32_t size;       // 12 ðàçìåð êâàäðàòà ÷åê áîêñà
  186.     color_t color;
  187.     color_t border_color; // individual border
  188.     color_t text_color;
  189.     char *text;
  190.     uint32_t text_len;
  191.     uint32_t flags;
  192. }option_box;
  193.  
  194. extern void (*option_box_draw)(option_box **) __attribute__((__stdcall__));
  195. extern void (*option_box_mouse)(option_box **)__attribute__((__stdcall__));
  196.  
  197. // PATHSHOW
  198. typedef struct {
  199.         uint32_t type;
  200.         uint32_t x_y;
  201.         uint16_t font_size_x;  // 6 - for font 0, 8 - for font 1
  202.         uint16_t area_size_x;
  203.     uint32_t font_number;  // 0 - monospace, 1 - variable, as fn4 (2bit only 0-3)
  204.     uint32_t background_flag; // as fn4, if 0, bk_color unneeded
  205.     color_t  font_color;      // as fn4
  206.     color_t  background_color; // as fn4
  207.     char* text_pointer;       // 4096 ?
  208.     char* work_area_pointer;  // 4096 ?
  209.     uint32_t temp_text_length;
  210. } __attribute__ ((__packed__)) pathview;
  211.  
  212. extern void (*path_show_prepare)(pathview *) __attribute__((__stdcall__));
  213. extern void (*path_show_draw)(pathview *) __attribute__((__stdcall__));
  214.  
  215. // PROGRESSBAR
  216. typedef struct {
  217.         unsigned int value;
  218.     unsigned int left;
  219.     unsigned int top;
  220.     unsigned int width;
  221.     unsigned int height;
  222.     unsigned int style;
  223.     unsigned int min;
  224.     unsigned int max;
  225.     unsigned int back_color;
  226.     unsigned int progress_color;
  227.     unsigned int frame_color;
  228. } progressbar;
  229.  
  230. extern void (*progressbar_draw)(progressbar *) __attribute__((__stdcall__));
  231. extern void (*progressbar_progress)(progressbar *) __attribute__((__stdcall__));
  232.  
  233.  
  234. #endif /* KOLIBRI_BOXLIB_H */
  235.