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