Subversion Repositories Kolibri OS

Rev

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