Subversion Repositories Kolibri OS

Rev

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 __attribute__ ((stdcall))
  12. #define cdecl           __attribute__ ((cdecl))
  13. #define pack            __attribute__   ((packed))
  14.  
  15. /////////////////////////////////////////////////////////////////////////
  16. //                      libGUI sysyem messages types
  17. /////////////////////////////////////////////////////////////////////////
  18. #define         MESSAGE_FULL_REDRAW_ALL                         1
  19. #define         MESSAGE_KEYS_EVENT                                      2
  20. #define         MESSAGE_SPECIALIZED                                     3
  21. #define         MESSAGE_SET_FOCUSE                                      4
  22. #define         MESSAGE_CHANGE_FOCUSE                           5
  23. #define         MESSAGE_MOUSE_EVENT                                     6
  24. #define         MESSAGE_CHANGE_POSITION_EVENT                   7
  25. #define         MESSAGE_CHANGESIZE_EVENT                                8
  26. #define         MESSAGE_CALL_TIMER_EVENT                                9
  27. #define         MESSAGE_FULL_REDRAW_ALL_WITH_FINITION           10
  28. #define         MESSAGE_SET_MAIN_PARENT                         11
  29. #define         MESSAGE_DESTROY_CONTROL                         -1
  30.  
  31. /////////////////////////////////////////////////////////////////////////
  32. //                      system keys states
  33. /////////////////////////////////////////////////////////////////////////
  34. #define KEY_DOWN                                                16
  35. #define KEY_UP                                                  17
  36. #define KEY_HOTKEY                                              18
  37. /////////////////////////////////////////////////////////////////////////
  38. //                      system mouse buttons states
  39. /////////////////////////////////////////////////////////////////////////
  40. #define MOUSE_LEFT_BUTTON_DOWN                          19
  41. #define MOUSE_LEFT_BUTTON_UP                                    20
  42. #define MOUSE_RIGHT_BUTTON_DOWN                         21
  43. #define MOUSE_RIGHT_BUTTON_UP                           22
  44. #define MOUSE_MIDDLE_BUTTON_DOWN                                23
  45. #define MOUSE_MIDDLE_BUTTON_UP                          24
  46. #define MOUSE_4_BUTTON_DOWN                                     25
  47. #define MOUSE_4_BUTTON_UP                                       26
  48. #define MOUSE_5_BUTTON_DOWN                                     27
  49. #define MOUSE_5_BUTTON_UP                                       28
  50.  
  51.  
  52. //-----------------------------------------------------------------------
  53. //              CONNECT EVENTS FOR CALLBACKs
  54. //-----------------------------------------------------------------------
  55.  
  56. ////////////////////////////////////////////////////////////////
  57. //              connect events for button
  58. ////////////////////////////////////////////////////////////////
  59. #define BUTTON_ENTER_EVENT                                      29
  60. #define BUTTON_LEAVE_EVENT                                      30
  61. #define BUTTON_PRESSED_EVENT                                    31
  62. #define BUTTON_RELEASED_EVENT                           32
  63.  
  64. ////////////////////////////////////////////////////////////////
  65. //              connect events for scroll bar
  66. ////////////////////////////////////////////////////////////////
  67. #define SCROLLBAR_CHANGED_EVENT                         33
  68.  
  69. ////////////////////////////////////////////////////////////////
  70. //              connect events for main parent window
  71. ////////////////////////////////////////////////////////////////
  72. #define DELETE_EVENT                                            36
  73.  
  74. ////////////////////////////////////////////////////////////////
  75. //                      font type structure
  76. ////////////////////////////////////////////////////////////////
  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. }pack;
  92.  
  93. typedef struct  FONT    font_t;
  94.  
  95. ////////////////////////////////////////////////////////////////
  96. //      header of parent of control
  97. ////////////////////////////////////////////////////////////////
  98.  
  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. }pack;
  133.  
  134. typedef struct HEADERPARENT parent_t;
  135.  
  136. ////////////////////////////////////////////////////////////////
  137. //      header of control
  138. ////////////////////////////////////////////////////////////////
  139.  
  140. struct HEADER
  141. {
  142.         DWORD   *ctrl_proc;
  143.         DWORD   *ctrl_fd;
  144.         DWORD   *ctrl_bk;
  145.         DWORD   *child_fd;
  146.         DWORD   *child_bk;
  147.         DWORD   *parent;
  148.         DWORD   *main_parent;
  149.         DWORD   ctrl_x;
  150.         DWORD   ctrl_y;
  151.         DWORD   ctrl_sizex;
  152.         DWORD   ctrl_sizey;
  153.         DWORD   ctrl_ID;
  154.         DWORD   *active_control_for_keys;
  155.         DWORD   *active_control_for_mouse;
  156.         DWORD   *callback;
  157.         DWORD   *finition;
  158.         DWORD   *timer;
  159.         DWORD   flags;
  160. }pack;
  161.  
  162.  
  163. typedef struct HEADER header_t;
  164. ////////////////////////////////////////////////////////////////
  165. //      callback structure for callback function of control
  166. ////////////////////////////////////////////////////////////////
  167.  
  168. struct CALLBACK
  169. {
  170.         DWORD   *clb_bk;
  171.         DWORD   *clb_fd;
  172.         DWORD   *clb_control;
  173.         DWORD   *func;
  174.         DWORD   *func_data;
  175.         DWORD   connect_event;
  176.         DWORD   flags;
  177. }pack;
  178.  
  179.  
  180. typedef struct CALLBACK gui_callback_t;
  181. ////////////////////////////////////////////////////////////////
  182. //                      timer
  183. ////////////////////////////////////////////////////////////////
  184.  
  185. struct TIMER
  186. {
  187.         DWORD   *tmr_bk;
  188.         DWORD   *tmr_fd;
  189.         DWORD   *tmr_parent;
  190.         DWORD   *func;
  191.         DWORD   *func_data;
  192.         DWORD   last_time;
  193.         DWORD   time_tick;
  194.         DWORD   flags;
  195. }pack;
  196.  
  197.  
  198. typedef struct TIMER gui_timer_t;
  199. ////////////////////////////////////////////////////////////////
  200. //              structure for callback events
  201. ////////////////////////////////////////////////////////////////
  202.  
  203. struct CALLBACKEVENT
  204. {
  205.         DWORD   *calev_bk;
  206.         DWORD   *calev_fd;
  207.         DWORD   *calev_parent;
  208.         DWORD   *func;
  209.         DWORD   *func_data;
  210.         DWORD   event_type;
  211. }pack;
  212.  
  213.  
  214. typedef struct CALLBACKEVENT gui_callbackevent_t;
  215.  
  216. ////////////////////////////////////////////////////////////////
  217. //              type of data - structure message
  218. ////////////////////////////////////////////////////////////////
  219.  
  220. struct MESSAGE
  221. {
  222.         DWORD   type;
  223.         DWORD   arg1;
  224.         DWORD   arg2;
  225.         DWORD   arg3;
  226.         DWORD   arg4;
  227. }pack;
  228.  
  229.  
  230. typedef struct MESSAGE gui_message_t;
  231.  
  232. ////////////////////////////////////////////////////////////////
  233. //                              button
  234. ////////////////////////////////////////////////////////////////
  235.  
  236. struct ControlButton
  237. {
  238.         DWORD   *ctrl_proc;
  239.         DWORD   *ctrl_fd;
  240.         DWORD   *ctrl_bk;
  241.         DWORD   *child_fd;
  242.         DWORD   *child_bk;
  243.         DWORD   *parent;
  244.         DWORD   *main_parent;
  245.         DWORD   ctrl_x;
  246.         DWORD   ctrl_y;
  247.         DWORD   ctrl_sizex;
  248.         DWORD   ctrl_sizey;
  249.         DWORD   ctrl_ID;
  250.         DWORD   *active_control_for_keys;
  251.         DWORD   *active_control_for_mouse;
  252.         DWORD   *callback;
  253.         DWORD   *finition;
  254.         DWORD   *timer;
  255.         DWORD   flags;
  256.  
  257.         //button's data
  258.         BYTE    btn_flags;
  259.  
  260. }pack;
  261.  
  262.  
  263. typedef struct ControlButton gui_button_t;
  264.  
  265. // information for creating control Button
  266.  
  267. struct ButtonData
  268. {
  269.         int     x;
  270.         int     y;
  271.         int     width;
  272.         int     height;
  273. }pack;
  274.  
  275.  
  276. typedef struct ButtonData gui_button_data_t;
  277.  
  278. ////////////////////////////////////////////////////////////////
  279. //      scroller
  280. ////////////////////////////////////////////////////////////////
  281.  
  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. }pack;
  309.  
  310.  
  311. typedef struct ControlScrollBar gui_scroll_bar_t;
  312.  
  313.  
  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. }pack;
  324.  
  325.  
  326. typedef struct ScrollBarData gui_scroll_bar_data_t;
  327. ////////////////////////////////////////////////////////////////
  328. //      progressbar
  329. ////////////////////////////////////////////////////////////////
  330.  
  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. }pack;
  356.  
  357.  
  358. typedef struct ControlProgressBar gui_progress_bar_t;
  359.  
  360.  
  361. struct ProgressBarData
  362. {
  363.         int     x;
  364.         int     y;
  365.         int     width;
  366.         int     height;
  367.         float   progress;
  368. }pack;
  369.  
  370.  
  371. typedef struct ProgressBarData gui_progress_bar_data_t;
  372. ////////////////////////////////////////////////////////////////
  373. //      scrolled window
  374. ////////////////////////////////////////////////////////////////
  375.  
  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. }pack;
  411.  
  412.  
  413. typedef struct ControlScrolledWindow gui_scrolled_window_t;
  414.  
  415.  
  416. struct ScrolledWindowData
  417. {
  418.         int     x;
  419.         int     y;
  420.         int     width;
  421.         int     height;
  422. }pack;
  423.  
  424.  
  425. typedef struct ScrolledWindowData gui_scrolled_window_data_t;
  426.  
  427. ////////////////////////////////////////////////////////////////
  428. //      image
  429. ////////////////////////////////////////////////////////////////
  430.  
  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. }pack;
  456.  
  457.  
  458. typedef struct ControlImage gui_image_t;
  459.  
  460.  
  461. struct ImageData
  462. {
  463.         int     x;
  464.         int     y;
  465.         int     width;
  466.         int     height;
  467.         char    bits_per_pixel;
  468. }pack;
  469.  
  470.  
  471. typedef struct ImageData gui_image_data_t;
  472.  
  473. ////////////////////////////////////////////////////////////////
  474. //      text
  475. ////////////////////////////////////////////////////////////////
  476.  
  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. }pack;
  504.  
  505.  
  506. typedef struct ControlText gui_text_t;
  507.  
  508.  
  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. }pack;
  519.  
  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. //                      libGUI service functions
  529. //**********************************************************************
  530.  
  531. DWORD stdcall (*LibGUIversion)(void);
  532. char  stdcall (*InitLibGUI)(void);
  533. void  stdcall (*LibGUImain)(parent_t *WindowParent);
  534. void  stdcall (*QuitLibGUI)(parent_t *window);
  535.  
  536. void* stdcall (*CreateWindow)(void);
  537. void  stdcall (*SetWindowSizeRequest)(parent_t *WindowParent,int size_x,int size_y);
  538.  
  539. void  stdcall (*PackControls)(void *Parent,void *control);
  540. void  stdcall (*DestroyControl)(void *control);
  541. void  stdcall (*SetControlSizeRequest)(void *Control,int new_size_x,int new_size_y);
  542. int   stdcall (*GetControlSizeX)(void *Control);
  543. int   stdcall (*GetControlSizeY)(void *Control);
  544. void  stdcall (*SetControlNewPosition)(void *Control,int new_x,int new_y);
  545. int   stdcall (*GetControlPositionX)(void *Control);
  546. int   stdcall (*GetControlPositionY)(void *Control);
  547. void* stdcall (*SetFocuse)(void *Control);
  548. void  stdcall (*RedrawControl)(void *Control);
  549. void  stdcall (*SpecialRedrawControl)(void *Control);
  550.  
  551. gui_callback_t* stdcall (*SetCallbackFunction)(void *Control,
  552.                                         int event_name,void *callback_func,
  553.                                         void *callback_func_data);
  554. void  stdcall (*BlockCallbackFunction)(void *Control,gui_callback_t *callback_ID);
  555. void  stdcall (*UnblockCallbackFunction)(void *Control,gui_callback_t *callback_ID);
  556.  
  557. void  stdcall (*SetIDL_Function)(parent_t *Parent,void *function,void *function_data);
  558. void  stdcall (*DestroyIDL_Function)(parent_t *Parent);
  559.  
  560. gui_timer_t* stdcall (*SetTimerCallbackForFunction)(parent_t *parent_window,
  561.                                         int time_tick,void *func,void *func_data);
  562. void stdcall (*DestroyTimerCallbackForFunction)(gui_timer_t *timer);
  563.  
  564. gui_callbackevent_t* stdcall (*SetCallbackFunctionForEvent)(parent_t *parent_window,
  565.                                         int event_type,void *func,void *func_data);
  566. void stdcall (*DestroyCallbackFunctionForEvent)(gui_callbackevent_t *callback_event);
  567.  
  568. gui_button_t* stdcall (*CreateButton)(gui_button_data_t *info_for_control);
  569. gui_button_t*   stdcall (*CreateButtonWithText)(gui_button_data_t *info,char *txt);
  570.  
  571. gui_progress_bar_t* stdcall (*CreateProgressBar)(gui_progress_bar_data_t *info_for_control);
  572. void stdcall (*SetProgressBarPulse)(gui_progress_bar_t *ProgressBar,int time_update);
  573. void stdcall (*ProgressBarSetText)(gui_progress_bar_t *pbar,char *txt);
  574. char* stdcall (*ProgressBarGetText)(gui_progress_bar_t *pbar);
  575.  
  576. gui_scroll_bar_t* stdcall (*CreateHorizontalScrollBar)(gui_scroll_bar_data_t *info_for_control);
  577. gui_scroll_bar_t* stdcall (*CreateVerticalScrollBar)(gui_scroll_bar_data_t *info_for_control);
  578.  
  579. gui_scrolled_window_t* stdcall (*CreateScrolledWindow)(gui_scrolled_window_data_t *info_for_control);
  580. void stdcall (*ScrolledWindowPackControls)(gui_scrolled_window_t *parent,void *Control);
  581.  
  582. gui_image_t* stdcall (*CreateImage)(gui_image_data_t *info_for_control);
  583.  
  584. gui_text_t* stdcall (*CreateText)(gui_text_data_t *info_for_control);
  585. void stdcall (*TextBackgroundOn)(gui_text_t *Text);
  586. void stdcall (*TextBackgroundOff)(gui_text_t *Text);
  587.  
  588. font_t* stdcall (*LoadFont)(char *fullfontname);
  589. void stdcall (*FreeFont)(font_t *font);
  590.  
  591.