Subversion Repositories Kolibri OS

Rev

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

  1. //BOX_LIB - Asper
  2. #ifndef INCLUDE_BOX_LIB_H
  3. #define INCLUDE_BOX_LIB_H
  4.  
  5. #ifndef INCLUDE_KOLIBRI_H
  6. #include "../lib/kolibri.h"
  7. #endif
  8.  
  9. #ifndef INCLUDE_DLL_H
  10. #include "../lib/dll.h"
  11. #endif
  12.  
  13. dword boxlib = #aEdit_box_lib;
  14. char aEdit_box_lib[]="/sys/lib/box_lib.obj";
  15.  
  16. dword box_lib_init   = #aboxlib_init;
  17.  
  18. dword edit_box_draw     = #aEdit_box_draw;
  19. dword edit_box_key      = #aEdit_box_key;
  20. dword edit_box_mouse    = #aEdit_box_mouse;
  21. dword edit_box_set_text = #aEdit_box_set_text;
  22. dword version_ed        = #aVersion_ed;
  23.  
  24. dword scrollbar_v_draw  = #aScrollbar_v_draw;
  25. dword scrollbar_v_mouse = #aScrollbar_v_mouse;
  26. dword scrollbar_h_draw  = #aScrollbar_h_draw;
  27. dword scrollbar_h_mouse = #aScrollbar_h_mouse;
  28. dword version_scrollbar = #aVersion_scrollbar;
  29.  
  30. dword PathShow_prepare  = #aPathShow_prepare;
  31. dword PathShow_draw     = #aPathShow_draw;
  32.  
  33. dword progressbar_draw = #aProgressbar_draw;
  34. dword progressbar_progress = #aProgressbar_progress;
  35.  
  36. dword frame_draw = #aFrame_draw;
  37.  
  38. $DD 2 dup 0
  39.  
  40. char aEdit_box_draw []    = "edit_box";
  41. char aEdit_box_key  []    = "edit_box_key";
  42. char aEdit_box_mouse[]    = "edit_box_mouse";
  43. char aEdit_box_set_text[] = "edit_box_set_text";
  44. char aVersion_ed    []    = "version_ed";
  45.  
  46. char aboxlib_init[]        = "lib_init";
  47. char aScrollbar_v_draw [] = "scrollbar_v_draw";
  48. char aScrollbar_v_mouse[] = "scrollbar_v_mouse";
  49. char aScrollbar_h_draw [] = "scrollbar_h_draw";
  50. char aScrollbar_h_mouse[] = "scrollbar_h_mouse";
  51. char aVersion_scrollbar[] = "version_scrollbar";
  52.  
  53. char aPathShow_prepare [] = "PathShow_prepare";
  54. char aPathShow_draw    [] = "PathShow_draw";
  55.  
  56. char aProgressbar_draw  [] = "progressbar_draw";
  57. char aProgressbar_progress[] = "progressbar_progress";
  58.  
  59. char aFrame_draw[] = "frame_draw";
  60.  
  61.  
  62. struct PathShow_data
  63. {
  64. dword type;
  65. word start_y,
  66.         start_x,
  67.         font_size_x,    // 6 - for font 0, 8 - for font 1
  68.         area_size_x;
  69. dword font_number,  // 0 - monospace, 1 - variable
  70.         background_flag,
  71.         font_color,
  72.         background_color,
  73.         text_pointer,
  74.         work_area_pointer,
  75.         temp_text_length;
  76. };
  77. /*
  78. char temp[128];
  79. PathShow_data PathShow = {0, 100,20, 6, 200, 0, 1, 0x0, 0xFFFfff, #email_text, #temp, 0};
  80. PathShow_prepare stdcall(#PathShow);
  81. PathShow_draw stdcall(#PathShow);
  82. */
  83.  
  84. //editbox flags
  85. #define ed_pass                        1b
  86. #define ed_focus                      10b   //focused
  87. #define ed_shift                     100b   //flag is set when Shift is pressed
  88. #define ed_shift_on                 1000b
  89. #define ed_shift_bac               10000b   //bit for Shift reset, if set the smth is selected
  90. #define ed_left_fl                100000b
  91. #define ed_offset_fl             1000000b
  92. #define ed_insert               10000000b
  93. #define ed_mouse_on            100000000b
  94. #define ed_mouse_adn_b         100011000b
  95. #define ed_disabled         100000000000b
  96. #define ed_always_focus  100000000000000b
  97. #define ed_figure_only  1000000000000000b   //numbers only
  98. #define ed_shift_cl     1111111111100011b
  99. #define ed_shift_mcl    1111111111111011b
  100. #define ed_shift_off    1111111111111011b
  101. #define ed_shift_on_off 1111111111110111b
  102. #define ed_shift_bac_cl 1111111111101111b
  103. #define ed_right_fl     1111111111011111b
  104. #define ed_offset_cl    1111111110111111b
  105. #define ed_insert_cl    1111111101111111b
  106. #define ed_mouse_on_off 1111111011111111b
  107.  
  108. struct edit_box{
  109. dword width,
  110.         left,
  111.         top,
  112.         color,
  113.         shift_color,
  114.         focus_border_color,
  115.         blur_border_color,
  116.         text_color,
  117.         max,
  118.         text,
  119.         mouse_variable,
  120.         flags,
  121.         size,
  122.         pos,
  123.         offset,
  124.         cl_curs_x,
  125.         cl_curs_y,
  126.         shift,
  127.         shift_old,
  128.         height,
  129.         char_width;
  130. };
  131.  
  132. :void EditBox_UpdateText(dword ed, _flags)
  133. {
  134.         dword ed_text;
  135.         ESI = ed;
  136.         ESI.edit_box.offset = ESI.edit_box.shift = ESI.edit_box.shift_old = 0;
  137.         ESI.edit_box.flags = _flags;
  138.         ed_text = ESI.edit_box.text;
  139.         ESI.edit_box.pos = ESI.edit_box.size = strlen(ed_text);
  140. }
  141.  
  142. struct scroll_bar
  143. {
  144.         word size_x,
  145.         start_x,
  146.         size_y,
  147.         start_y;
  148.         dword btn_height,
  149.         type,
  150.         max_area,
  151.         cur_area,
  152.         position,
  153.         bckg_col,
  154.         frnt_col,
  155.         line_col,
  156.         redraw;
  157.         word delta,
  158.         delta2,
  159.         r_size_x,
  160.         r_start_x,
  161.         r_size_y,
  162.         r_start_y;
  163.         dword m_pos,
  164.         m_pos_2,
  165.         m_keys,
  166.         run_size,
  167.         position2,
  168.         work_size,
  169.         all_redraw,
  170.         ar_offset;
  171. };
  172.  
  173. struct progress_bar
  174. {
  175.   dword
  176.         value,
  177.         left,
  178.         top,
  179.         width,
  180.         height,
  181.         style,
  182.         min,
  183.         max,
  184.         back_color,
  185.         progress_color,
  186.         frame_color;
  187. };
  188.  
  189. struct frame
  190. {
  191.         dword type;
  192.         word size_x; //start_x, size_x => Mario, WTF? Is this so complex to use x/y/w/h ?                  
  193.         word start_x;                
  194.         word size_y;                  
  195.         word start_y;                
  196.         dword ext_col;            
  197.         dword int_col;            
  198.         dword flags;  // see FR_FLAGS
  199.         dword text_pointer;          
  200.         dword text_position;   //  0-up,1-bottom
  201.         dword font_number;     //  0-monospace,1-variable
  202.         dword font_size_y;          
  203.         dword font_color;            
  204.         dword font_backgr_color;
  205. };
  206.  
  207. // FR_FLAGS = [x][yyy][z]
  208. // z        -  Caption
  209. // yyy      -  BorderStyle
  210. // x        -  BackStyle
  211. #define FR_CAPTION 00001b // [z]
  212. #define FR_DOUBLE  00000b // [yyy]
  213. #define FR_RAISED  00010b // [yyy]
  214. #define FR_SUNKEN  00100b // [yyy]
  215. #define FR_ETCHED  00110b // [yyy]
  216. #define FR_RIDGED  01000b // [yyy]
  217. #define FR_FILLED  10000b // [x]
  218.  
  219. :frame frame123 = { 0, 260, 10, 60, 16, NULL, 0xFFFfff, 1, NULL, 0, 1, 12, 0x000111, 0xCCCccc };
  220. :void DrawFrame(dword x,y,w,h,text)
  221. {
  222.         frame123.font_color = system.color.work_text;
  223.         frame123.ext_col = system.color.work_graph;
  224.         frame123.int_col = system.color.work_light;
  225.         frame123.font_backgr_color = system.color.work;
  226.  
  227.         frame123.start_x = x;
  228.         frame123.start_y = y;
  229.         frame123.size_x = w;
  230.         frame123.size_y = h;
  231.         frame123.text_pointer = text;
  232.         if (!text) frame123.flags=0; else frame123.flags=FR_CAPTION;
  233.         frame_draw stdcall (#frame123);
  234. }
  235.  
  236.  
  237. #endif