Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.        service  structures of libGUI
  3. */
  4.  
  5. typedef unsigned int                            DWORD;
  6. typedef unsigned char                           BYTE;
  7. typedef unsigned short int                      WORD;
  8. typedef unsigned int                            size_t;
  9.  
  10. #define stdcall     __stdcall
  11. #define cdecl       __cdecl
  12.  
  13. /////////////////////////////////////////////////////////////////////////
  14. //                      libGUI sysyem messages types
  15. /////////////////////////////////////////////////////////////////////////
  16. #define         MESSAGE_FULL_REDRAW_ALL                                 1
  17. #define         MESSAGE_KEYS_EVENT                                      2
  18. #define         MESSAGE_SPECIALIZED                                     3
  19. #define         MESSAGE_SET_FOCUSE                                      4
  20. #define         MESSAGE_CHANGE_FOCUSE                                   5
  21. #define         MESSAGE_MOUSE_EVENT                                     6
  22. #define         MESSAGE_CHANGE_POSITION_EVENT                           7
  23. #define         MESSAGE_CHANGESIZE_EVENT                                8
  24. #define         MESSAGE_CALL_TIMER_EVENT                                9
  25. #define         MESSAGE_FULL_REDRAW_ALL_WITH_FINITION                   10
  26. #define         MESSAGE_SET_MAIN_PARENT                                 11
  27. #define         MESSAGE_DESTROY_CONTROL                                 -1
  28.  
  29. /////////////////////////////////////////////////////////////////////////
  30. //                      system keys states
  31. /////////////////////////////////////////////////////////////////////////
  32. #define KEY_DOWN                                                16
  33. #define KEY_UP                                                  17
  34. #define KEY_HOTKEY                                              18
  35. /////////////////////////////////////////////////////////////////////////
  36. //                      system mouse buttons states
  37. /////////////////////////////////////////////////////////////////////////
  38. #define MOUSE_LEFT_BUTTON_DOWN                          19
  39. #define MOUSE_LEFT_BUTTON_UP                                    20
  40. #define MOUSE_RIGHT_BUTTON_DOWN                         21
  41. #define MOUSE_RIGHT_BUTTON_UP                           22
  42. #define MOUSE_MIDDLE_BUTTON_DOWN                                23
  43. #define MOUSE_MIDDLE_BUTTON_UP                          24
  44. #define MOUSE_4_BUTTON_DOWN                                     25
  45. #define MOUSE_4_BUTTON_UP                                       26
  46. #define MOUSE_5_BUTTON_DOWN                                     27
  47. #define MOUSE_5_BUTTON_UP                                       28
  48.  
  49.  
  50. //-----------------------------------------------------------------------
  51. //              CONNECT EVENTS FOR CALLBACKs
  52. //-----------------------------------------------------------------------
  53.  
  54. ////////////////////////////////////////////////////////////////
  55. //              connect events for button
  56. ////////////////////////////////////////////////////////////////
  57. #define BUTTON_ENTER_EVENT                                      29
  58. #define BUTTON_LEAVE_EVENT                                      30
  59. #define BUTTON_PRESSED_EVENT                                    31
  60. #define BUTTON_RELEASED_EVENT                           32
  61.  
  62. ////////////////////////////////////////////////////////////////
  63. //              connect events for scroll bar
  64. ////////////////////////////////////////////////////////////////
  65. #define SCROLLBAR_CHANGED_EVENT                         33
  66.  
  67. ////////////////////////////////////////////////////////////////
  68. //              connect events for main parent window
  69. ////////////////////////////////////////////////////////////////
  70. #define DELETE_EVENT                                            36
  71.  
  72. ////////////////////////////////////////////////////////////////
  73. //                      font type structure
  74. ////////////////////////////////////////////////////////////////
  75. #pragma pack(push,1)
  76. struct  FONT
  77. {
  78.         DWORD           *fnt_draw;
  79.         DWORD           *fnt_unpacker;
  80.         DWORD           *fnt_fd;
  81.         DWORD           *fnt_bk;
  82.         int             sizex;
  83.         int             sizey;
  84.         int             size;
  85.         int             encoding_type;
  86.         char            *font;
  87.         char            *fnt_name;
  88.         DWORD           type;
  89.         DWORD           flags;
  90. };
  91. #pragma pack(pop)
  92.  
  93. typedef struct  FONT    font_t;
  94.  
  95. ////////////////////////////////////////////////////////////////
  96. //      header of parent of control
  97. ////////////////////////////////////////////////////////////////
  98.  
  99. #pragma pack(push,1)
  100. struct HEADERPARENT
  101. {
  102.         DWORD   *ctrl_proc;
  103.         DWORD   *ctrl_fd;
  104.         DWORD   *ctrl_bk;
  105.         DWORD   *child_fd;
  106.         DWORD   *child_bk;
  107.         DWORD   *parent;
  108.         DWORD   *main_parent;
  109.         DWORD   ctrl_x;
  110.         DWORD   ctrl_y;
  111.         DWORD   ctrl_sizex;
  112.         DWORD   ctrl_sizey;
  113.         DWORD   ctrl_ID;
  114.         DWORD   *active_control_for_keys;
  115.         DWORD   *active_control_for_mouse;
  116.         DWORD   *callback;
  117.         DWORD   *finition;
  118.         DWORD   *timer;
  119.         DWORD   flags;
  120.  
  121.         DWORD   **control_for_callback_function;
  122.         DWORD   **callback_for_control_callback;
  123.         DWORD   number_callbacks;
  124.         DWORD   *global_active_control_for_keys;
  125.         DWORD   *message;
  126.         DWORD   *timer_bk;
  127.         DWORD   *timer_fd;
  128.         DWORD   number_timers_for_controls;
  129.         DWORD   *calev_bk;
  130.         DWORD   *calev_fd;
  131.         DWORD   *IDL_func;
  132.         DWORD   *IDL_func_data;
  133. };
  134. #pragma pack(pop)
  135.  
  136. typedef struct HEADERPARENT parent_t;
  137.  
  138. ////////////////////////////////////////////////////////////////
  139. //      header of control
  140. ////////////////////////////////////////////////////////////////
  141. #pragma pack(push,1)
  142. struct HEADER
  143. {
  144.         DWORD   *ctrl_proc;
  145.         DWORD   *ctrl_fd;
  146.         DWORD   *ctrl_bk;
  147.         DWORD   *child_fd;
  148.         DWORD   *child_bk;
  149.         DWORD   *parent;
  150.         DWORD   *main_parent;
  151.         DWORD   ctrl_x;
  152.         DWORD   ctrl_y;
  153.         DWORD   ctrl_sizex;
  154.         DWORD   ctrl_sizey;
  155.         DWORD   ctrl_ID;
  156.         DWORD   *active_control_for_keys;
  157.         DWORD   *active_control_for_mouse;
  158.         DWORD   *callback;
  159.         DWORD   *finition;
  160.         DWORD   *timer;
  161.         DWORD   flags;
  162. };
  163. #pragma pack(pop)
  164.  
  165. typedef struct HEADER header_t;
  166. ////////////////////////////////////////////////////////////////
  167. //      callback structure for callback function of control
  168. ////////////////////////////////////////////////////////////////
  169. #pragma pack(push,1)
  170. struct CALLBACK
  171. {
  172.         DWORD   *clb_bk;
  173.         DWORD   *clb_fd;
  174.         DWORD   *clb_control;
  175.         DWORD   *func;
  176.         DWORD   *func_data;
  177.         DWORD   connect_event;
  178.         DWORD   flags;
  179. };
  180. #pragma pack(pop)
  181.  
  182. typedef struct CALLBACK gui_callback_t;
  183. ////////////////////////////////////////////////////////////////
  184. //                      timer
  185. ////////////////////////////////////////////////////////////////
  186. #pragma pack(push,1)
  187. struct TIMER
  188. {
  189.         DWORD   *tmr_bk;
  190.         DWORD   *tmr_fd;
  191.         DWORD   *tmr_parent;
  192.         DWORD   *func;
  193.         DWORD   *func_data;
  194.         DWORD   last_time;
  195.         DWORD   time_tick;
  196.         DWORD   flags;
  197. };
  198. #pragma pack(pop)
  199.  
  200. typedef struct TIMER gui_timer_t;
  201. ////////////////////////////////////////////////////////////////
  202. //              structure for callback events
  203. ////////////////////////////////////////////////////////////////
  204. #pragma pack(push,1)
  205. struct CALLBACKEVENT
  206. {
  207.         DWORD   *calev_bk;
  208.         DWORD   *calev_fd;
  209.         DWORD   *calev_parent;
  210.         DWORD   *func;
  211.         DWORD   *func_data;
  212.         DWORD   event_type;
  213. };
  214. #pragma pack(pop)
  215.  
  216. typedef struct CALLBACKEVENT gui_callbackevent_t;
  217.  
  218. ////////////////////////////////////////////////////////////////
  219. //              type of data - structure message
  220. ////////////////////////////////////////////////////////////////
  221. #pragma pack(push,1)
  222. struct MESSAGE
  223. {
  224.         DWORD   type;
  225.         DWORD   arg1;
  226.         DWORD   arg2;
  227.         DWORD   arg3;
  228.         DWORD   arg4;
  229. };
  230. #pragma pack(pop)
  231.  
  232. typedef struct MESSAGE gui_message_t;
  233.  
  234. ////////////////////////////////////////////////////////////////
  235. //                              button
  236. ////////////////////////////////////////////////////////////////
  237. #pragma pack(push,1)
  238. struct ControlButton
  239. {
  240.         DWORD   *ctrl_proc;
  241.         DWORD   *ctrl_fd;
  242.         DWORD   *ctrl_bk;
  243.         DWORD   *child_fd;
  244.         DWORD   *child_bk;
  245.         DWORD   *parent;
  246.         DWORD   *main_parent;
  247.         DWORD   ctrl_x;
  248.         DWORD   ctrl_y;
  249.         DWORD   ctrl_sizex;
  250.         DWORD   ctrl_sizey;
  251.         DWORD   ctrl_ID;
  252.         DWORD   *active_control_for_keys;
  253.         DWORD   *active_control_for_mouse;
  254.         DWORD   *callback;
  255.         DWORD   *finition;
  256.         DWORD   *timer;
  257.         DWORD   flags;
  258.  
  259.         //button's data
  260.         BYTE    btn_flags;
  261. };
  262. #pragma pack(pop)
  263.  
  264. typedef struct ControlButton gui_button_t;
  265.  
  266. // information for creating control Button
  267. #pragma pack(push,1)
  268. struct ButtonData
  269. {
  270.         int     x;
  271.         int     y;
  272.         int     width;
  273.         int     height;
  274. };
  275. #pragma pack(pop)
  276.  
  277. typedef struct ButtonData gui_button_data_t;
  278.  
  279. ////////////////////////////////////////////////////////////////
  280. //      scroller
  281. ////////////////////////////////////////////////////////////////
  282. #pragma pack(push,1)
  283. struct ControlScrollBar
  284. {
  285.         DWORD   *ctrl_proc;
  286.         DWORD   *ctrl_fd;
  287.         DWORD   *ctrl_bk;
  288.         DWORD   *child_fd;
  289.         DWORD   *child_bk;
  290.         DWORD   *parent;
  291.         DWORD   *main_parent;
  292.         DWORD   ctrl_x;
  293.         DWORD   ctrl_y;
  294.         DWORD   ctrl_sizex;
  295.         DWORD   ctrl_sizey;
  296.         DWORD   ctrl_ID;
  297.         DWORD   *active_control_for_keys;
  298.         DWORD   *active_control_for_mouse;
  299.         DWORD   *callback;
  300.         DWORD   *finition;
  301.         DWORD   *timer;
  302.         DWORD   flags;
  303.  
  304.         //scroll bar's data
  305.         float   ruller_size;
  306.         float   ruller_pos;
  307.         float   ruller_step;
  308.         BYTE    scb_flags;
  309. };
  310. #pragma pack(pop)
  311.  
  312. typedef struct ControlScrollBar gui_scroll_bar_t;
  313.  
  314. #pragma pack(push,1)
  315. struct ScrollBarData
  316. {
  317.         int     x;
  318.         int     y;
  319.         int     width;
  320.         int     height;
  321.         float   ruller_size;
  322.         float   ruller_pos;
  323.         float   ruller_step;
  324. };
  325. #pragma pack(pop)
  326.  
  327. typedef struct ScrollBarData gui_scroll_bar_data_t;
  328. ////////////////////////////////////////////////////////////////
  329. //      progressbar
  330. ////////////////////////////////////////////////////////////////
  331. #pragma pack(push,1)
  332. struct ControlProgressBar
  333. {
  334.         DWORD   *ctrl_proc;
  335.         DWORD   *ctrl_fd;
  336.         DWORD   *ctrl_bk;
  337.         DWORD   *child_fd;
  338.         DWORD   *child_bk;
  339.         DWORD   *parent;
  340.         DWORD   *main_parent;
  341.         DWORD   ctrl_x;
  342.         DWORD   ctrl_y;
  343.         DWORD   ctrl_sizex;
  344.         DWORD   ctrl_sizey;
  345.         DWORD   ctrl_ID;
  346.         DWORD   *active_control_for_keys;
  347.         DWORD   *active_control_for_mouse;
  348.         DWORD   *callback;
  349.         DWORD   *finition;
  350.         DWORD   *timer;
  351.         DWORD   flags;
  352.  
  353.         //progress bar's data
  354.         float   progress;
  355.         BYTE    prb_flags;
  356. };
  357. #pragma pack(pop)
  358.  
  359. typedef struct ControlProgressBar gui_progress_bar_t;
  360.  
  361. #pragma pack(push,1)
  362. struct ProgressBarData
  363. {
  364.         int     x;
  365.         int     y;
  366.         int     width;
  367.         int     height;
  368.         float   progress;
  369. };
  370. #pragma pack(pop)
  371.  
  372. typedef struct ProgressBarData gui_progress_bar_data_t;
  373. ////////////////////////////////////////////////////////////////
  374. //      scrolled window
  375. ////////////////////////////////////////////////////////////////
  376. #pragma pack(push,1)
  377. struct ControlScrolledWindow
  378. {
  379.         DWORD   *ctrl_proc;
  380.         DWORD   *ctrl_fd;
  381.         DWORD   *ctrl_bk;
  382.         DWORD   *child_fd;
  383.         DWORD   *child_bk;
  384.         DWORD   *parent;
  385.         DWORD   *main_parent;
  386.         DWORD   ctrl_x;
  387.         DWORD   ctrl_y;
  388.         DWORD   ctrl_sizex;
  389.         DWORD   ctrl_sizey;
  390.         DWORD   ctrl_ID;
  391.         DWORD   *active_control_for_keys;
  392.         DWORD   *active_control_for_mouse;
  393.         DWORD   *callback;
  394.         DWORD   *finition;
  395.         DWORD   *timer;
  396.         DWORD   flags;
  397.  
  398.         //scrolled windows's data
  399.         DWORD   virtual_x;
  400.         DWORD   virtual_y;
  401.         DWORD   virtual_sizex;
  402.         DWORD   virtual_sizey;
  403.         DWORD   *virtual_controls_x;
  404.         DWORD   *virtual_controls_y;
  405.         DWORD   number_virtual_controls;
  406.         DWORD   scroll_arrea_sizex;
  407.         DWORD   scroll_arrea_sizey;
  408.         DWORD   *horizontal_scroll;
  409.         DWORD   *vertical_scroll;
  410.         BYTE    scw_flags;
  411. };
  412. #pragma pack(pop)
  413.  
  414. typedef struct ControlScrolledWindow gui_scrolled_window_t;
  415.  
  416. #pragma pack(push,1)
  417. struct ScrolledWindowData
  418. {
  419.         int     x;
  420.         int     y;
  421.         int     width;
  422.         int     height;
  423. };
  424. #pragma pack(pop)
  425.  
  426. typedef struct ScrolledWindowData gui_scrolled_window_data_t;
  427.  
  428. ////////////////////////////////////////////////////////////////
  429. //      image
  430. ////////////////////////////////////////////////////////////////
  431. #pragma pack(push,1)
  432. struct ControlImage
  433. {
  434.         DWORD   *ctrl_proc;
  435.         DWORD   *ctrl_fd;
  436.         DWORD   *ctrl_bk;
  437.         DWORD   *child_fd;
  438.         DWORD   *child_bk;
  439.         DWORD   *parent;
  440.         DWORD   *main_parent;
  441.         DWORD   ctrl_x;
  442.         DWORD   ctrl_y;
  443.         DWORD   ctrl_sizex;
  444.         DWORD   ctrl_sizey;
  445.         DWORD   ctrl_ID;
  446.         DWORD   *active_control_for_keys;
  447.         DWORD   *active_control_for_mouse;
  448.         DWORD   *callback;
  449.         DWORD   *finition;
  450.         DWORD   *timer;
  451.         DWORD   flags;
  452.  
  453.         char    bits_per_pixel;
  454.         char    bytes_per_pixel;
  455.         char    *img;
  456. };
  457. #pragma pack(pop)
  458.  
  459. typedef struct ControlImage gui_image_t;
  460.  
  461. #pragma pack(push,1)
  462. struct ImageData
  463. {
  464.         int     x;
  465.         int     y;
  466.         int     width;
  467.         int     height;
  468.         char    bits_per_pixel;
  469. };
  470. #pragma pack(pop)
  471.  
  472. typedef struct ImageData gui_image_data_t;
  473.  
  474. ////////////////////////////////////////////////////////////////
  475. //      text
  476. ////////////////////////////////////////////////////////////////
  477. #pragma pack(push,1)
  478. struct ControlText
  479. {
  480.         DWORD   *ctrl_proc;
  481.         DWORD   *ctrl_fd;
  482.         DWORD   *ctrl_bk;
  483.         DWORD   *child_fd;
  484.         DWORD   *child_bk;
  485.         DWORD   *parent;
  486.         DWORD   *main_parent;
  487.         DWORD   ctrl_x;
  488.         DWORD   ctrl_y;
  489.         DWORD   ctrl_sizex;
  490.         DWORD   ctrl_sizey;
  491.         DWORD   ctrl_ID;
  492.         DWORD   *active_control_for_keys;
  493.         DWORD   *active_control_for_mouse;
  494.         DWORD   *callback;
  495.         DWORD   *finition;
  496.         DWORD   *timer;
  497.         DWORD   flags;
  498.  
  499.         DWORD   *font;  
  500.         DWORD   color;
  501.         DWORD   background_color;
  502.         char    *text;
  503.         BYTE    txt_flags;
  504. };
  505. #pragma pack(pop)
  506.  
  507. typedef struct ControlText gui_text_t;
  508.  
  509. #pragma pack(push,1)
  510. struct TextData
  511. {
  512.         int     x;
  513.         int     y;
  514.         DWORD   *font;  
  515.         DWORD   color;
  516.         DWORD   background_color;
  517.         char    background;
  518.         char    *text;  
  519. };
  520. #pragma pack(pop)
  521.  
  522. typedef struct TextData gui_text_data_t;
  523. /////////////////////////////////////////////////////////////////
  524. //           load libGUI library and link functions
  525. /////////////////////////////////////////////////////////////////
  526. void    LoadLibGUI(char *lib_path);
  527.  
  528. //**********************************************************************
  529. //                      libGUI service functions
  530. //**********************************************************************
  531.  
  532. DWORD (stdcall *LibGUIversion)(void);
  533. char  (stdcall *InitLibGUI)(void);
  534. void  (stdcall *LibGUImain)(parent_t *WindowParent);
  535. void  (stdcall *QuitLibGUI)(parent_t *window);
  536.  
  537. parent_t* (stdcall *CreateWindow)(void);
  538. void  (stdcall *SetWindowSizeRequest)(parent_t *WindowParent,int size_x,int size_y);
  539.  
  540. void  (stdcall *PackControls)(void *Parent,void *control);
  541. void  (stdcall *DestroyControl)(void *control);
  542. void  (stdcall *SetControlSizeRequest)(void *Control,int new_size_x,int new_size_y);
  543. int   (stdcall *GetControlSizeX)(void *Control);
  544. int   (stdcall *GetControlSizeY)(void *Control);
  545. void  (stdcall *SetControlNewPosition)(void *Control,int new_x,int new_y);
  546. int   (stdcall *GetControlPositionX)(void *Control);
  547. int   (stdcall *GetControlPositionY)(void *Control);
  548. void* (stdcall *SetFocuse)(void *Control);
  549. void  (stdcall *RedrawControl)(void *Control);
  550. void  (stdcall *SpecialRedrawControl)(void *Control);
  551.  
  552. gui_callback_t* (stdcall *SetCallbackFunction)(void *Control,
  553.                                         int event_name,void *callback_func,
  554.                                         void *callback_func_data);
  555. void  (stdcall *BlockCallbackFunction)(void *Control,gui_callback_t *callback_ID);
  556. void  (stdcall *UnblockCallbackFunction)(void *Control,gui_callback_t *callback_ID);
  557.  
  558. void  (stdcall *SetIDL_Function)(parent_t *Parent,void *function,void *function_data);
  559. void  (stdcall *DestroyIDL_Function)(parent_t *Parent);
  560.  
  561. gui_timer_t* (stdcall *SetTimerCallbackForFunction)(parent_t *parent_window,
  562.                                         int time_tick,void *func,void *func_data);
  563. void (stdcall *DestroyTimerCallbackForFunction)(gui_timer_t *timer);
  564.  
  565. gui_callbackevent_t* (stdcall *SetCallbackFunctionForEvent)(parent_t *parent_window,
  566.                                         int event_type,void *func,void *func_data);
  567. void (stdcall *DestroyCallbackFunctionForEvent)(gui_callbackevent_t *callback_event);
  568.  
  569. gui_button_t* (stdcall *CreateButton)(gui_button_data_t *info_for_control);
  570. gui_button_t* (stdcall *CreateButtonWithText)(gui_button_data_t *info,char *txt);
  571.  
  572. gui_progress_bar_t* (stdcall *CreateProgressBar)(gui_progress_bar_data_t *info_for_control);
  573. void (stdcall *SetProgressBarPulse)(gui_progress_bar_t *ProgressBar,int time_update);
  574. void (stdcall *ProgressBarSetText)(gui_progress_bar_t *pbar,char *txt);
  575. char* (stdcall *ProgressBarGetText)(gui_progress_bar_t *pbar);
  576.  
  577. gui_scroll_bar_t* (stdcall *CreateHorizontalScrollBar)(gui_scroll_bar_data_t *info_for_control);
  578. gui_scroll_bar_t* (stdcall *CreateVerticalScrollBar)(gui_scroll_bar_data_t *info_for_control);
  579.  
  580. gui_scrolled_window_t* (stdcall *CreateScrolledWindow)(gui_scrolled_window_data_t *info_for_control);
  581. void (stdcall *ScrolledWindowPackControls)(gui_scrolled_window_t *parent,void *Control);
  582.  
  583. gui_image_t* (stdcall *CreateImage)(gui_image_data_t *info_for_control);
  584.  
  585. gui_text_t* (stdcall *CreateText)(gui_text_data_t *info_for_control);
  586. void (stdcall *TextBackgroundOn)(gui_text_t *Text);
  587. void (stdcall *TextBackgroundOff)(gui_text_t *Text);
  588.  
  589. font_t* (stdcall *LoadFont)(char *fullfontname);
  590. void (stdcall *FreeFont)(font_t *font);
  591.  
  592.