Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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