Subversion Repositories Kolibri OS

Rev

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

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