Subversion Repositories Kolibri OS

Rev

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

  1. /*
  2.         structures for work with libGUI
  3. */
  4.  
  5. /////////////////////////////////////////////////////////////////
  6.  
  7. #define CANNOT_LOAD_LIBGUI                      100
  8. #define PAREND_SIZE                             44
  9. #define MESSAGE_SIZE                            16
  10.  
  11. #define MESSAGE_FULL_REDRAW_ALL                 1
  12. #define MESSAGE_KEYS_EVENTS                     2
  13. #define MESSAGE_SPECIALIZED                     3
  14. #define MESSAGE_MOUSE_EVENTS                    6
  15.  
  16. #define BUTTON_TYPE_2D_WITH_TEXT                (1+128)
  17. #define BUTTON_TYPE_2D_WITH_PICTURE             (2+128)
  18. #define BUTTON_TYPE_2D_WITH_TEXT_PICTURE        (4+128)
  19. #define BUTTON_TYPE_NO_DRAW                     (8+128)
  20. #define BUTTON_TYPE_3D_WITH_TEXT                (1+16+128)
  21. #define BUTTON_TYPE_3D_WITH_PICTURE             (2+16+128)
  22. #define BUTTON_TYPE_3D_WITH_TEXT_PICTURE        (4+16+128)
  23.  
  24. #define TEXT_TYPE_NO_DRAW                       (1)
  25. #define TEXT_TYPE_WITH_BACKGROUND               (128+2)
  26. #define TEXT_TYPE_SYSTEM_6X9                    (128)
  27.  
  28. #define NUMBER_NO_DRAW                          (1)
  29. #define NUMBER_INTEGER                          (128)
  30. #define NUMBER_FLOAT                            (128+2)
  31.  
  32. #define IMAGE_TYPE_1                            (128)
  33.  
  34. #define PROGRESS_BAR_TYPE_1                     (128)
  35.  
  36. #define BOOKMARK_TYPE_1                         (128)
  37.  
  38. ///////////////////////////////////////////////////////////////////
  39. #define BUTTON_STATE_CROSS                      (1)
  40. #define BUTTON_STATE_CROSS_PRESS                (3)
  41.  
  42.  
  43. ////////////////////////////////////////////////////////////////
  44. //      header of control
  45. ////////////////////////////////////////////////////////////////
  46.  
  47. struct HEADER
  48. {
  49.  dword ctrl_proc;
  50.  dword *ctrl_fd;
  51.  dword *ctrl_bk;
  52.  dword *child_fd;
  53.  dword *child_bk;
  54.  dword *parend;
  55.  dword ctrl_x;
  56.  dword ctrl_y;
  57.  dword ctrl_sizex;
  58.  dword ctrl_sizey;
  59.  dword ctrl_ID;
  60.  
  61. }__attribute__((packed));
  62.  
  63. ////////////////////////////////////////////////////////////////
  64. //      message
  65. ////////////////////////////////////////////////////////////////
  66.  
  67. struct MESSAGE
  68. {
  69.  dword type;
  70.  dword arg1;
  71.  dword arg2;
  72.  dword arg3;
  73. }__attribute__((packed));
  74.  
  75. ////////////////////////////////////////////////////////////////
  76. //      button
  77. ////////////////////////////////////////////////////////////////
  78.  
  79. struct ControlButton
  80. {
  81.  dword ctrl_proc;
  82.  dword *ctrl_fd;
  83.  dword *ctrl_bk;
  84.  dword *child_fd;
  85.  dword *child_bk;
  86.  dword *parend;
  87.  dword ctrl_x;
  88.  dword ctrl_y;
  89.  dword ctrl_sizex;
  90.  dword ctrl_sizey;
  91.  dword ctrl_ID;
  92.  
  93.  byte  type;
  94.  byte  flag;
  95.  word  x;
  96.  word  y;
  97.  word  width;
  98.  word  height;
  99.  dword image;
  100.  word  imageX;
  101.  word  imageY;
  102.  word  imageSizeX;
  103.  word  imageSizeY;
  104.  dword transparentColor;
  105.  dword text;
  106.  word  textX;
  107.  word  textY;
  108.  dword textcolor;
  109.  dword color1;
  110.  dword color2;
  111.  word  mouseX;
  112.  word  mouseY;
  113. }__attribute__((packed));
  114.  
  115. typedef struct InfoForButton
  116. {
  117.  byte  type;            //0
  118.  byte  flag;            //1
  119.  word  x;               //2
  120.  word  y;               //4
  121.  word  width;           //6
  122.  word  height;          //8
  123.  dword image;           //10
  124.  word  imageX;          //14
  125.  word  imageY;          //16
  126.  word  imageSizeX;      //18
  127.  word  imageSizeY;      //20
  128.  dword transparentColor;//24
  129.  dword text;            //28
  130.  word  textX;           //32
  131.  word  textY;           //34
  132.  dword textcolor;       //36
  133.  dword color1;          //40
  134.  dword color2;
  135.  word  mouseX;
  136.  word  mouseY;
  137. }__attribute__((packed));
  138.  
  139. ////////////////////////////////////////////////////////////////
  140. //      scroller
  141. ////////////////////////////////////////////////////////////////
  142.  
  143. struct ControlScroller
  144. {
  145.  dword ctrl_proc;
  146.  dword *ctrl_fd;
  147.  dword *ctrl_bk;
  148.  dword *child_fd;
  149.  dword *child_bk;
  150.  dword *parend;
  151.  dword ctrl_x;
  152.  dword ctrl_y;
  153.  dword ctrl_sizex;
  154.  dword ctrl_sizey;
  155.  dword ctrl_ID;
  156.  
  157.  byte  type;
  158.  word  x;
  159.  word  y;
  160.  word  length;
  161.  dword color1;
  162.  float size;
  163.  float pos;
  164.  word  buttons_flags;
  165.  dword ChildButton1;
  166.  dword ChildButton2;
  167.  word  MouseX;
  168.  word  MouseY;
  169. }__attribute__((packed));
  170.  
  171. struct InfoForScroller
  172. {
  173.  byte  type;
  174.  word  x;
  175.  word  y;
  176.  word  length;
  177.  dword color1;
  178.  float size;
  179.  float pos;
  180.  word  buttons_flags;
  181.  dword ChildButton1;
  182.  dword ChildButton2;
  183.  word  MouseX;
  184.  word  MouseY;
  185. }__attribute__((packed));
  186.  
  187. ////////////////////////////////////////////////////////////////
  188. //      progressbar
  189. ////////////////////////////////////////////////////////////////
  190.  
  191. struct ControlProgressbar
  192. {
  193.  dword ctrl_proc;
  194.  dword *ctrl_fd;
  195.  dword *ctrl_bk;
  196.  dword *child_fd;
  197.  dword *child_bk;
  198.  dword *parend;
  199.  dword ctrl_x;
  200.  dword ctrl_y;
  201.  dword ctrl_sizex;
  202.  dword ctrl_sizey;
  203.  dword ctrl_ID;
  204.  
  205.  byte  type;
  206.  byte  flag;
  207.  dword color1;
  208.  dword color2;
  209.  dword x;
  210.  dword y;
  211.  dword sizex;
  212.  dword sizey;
  213.  float progress;
  214.  dword color3;
  215. }__attribute__((packed));
  216.  
  217. struct InfoForProgressbar
  218. {
  219.  byte  type;
  220.  byte  flag;
  221.  dword color1;
  222.  dword color2;
  223.  dword x;
  224.  dword y;
  225.  dword sizex;
  226.  dword sizey;
  227.  float progress;
  228.  dword color3;
  229. }__attribute__((packed));
  230.  
  231. ////////////////////////////////////////////////////////////////
  232. //      image
  233. ////////////////////////////////////////////////////////////////
  234.  
  235. struct ControlImage
  236. {
  237.  dword ctrl_proc;
  238.  dword *ctrl_fd;
  239.  dword *ctrl_bk;
  240.  dword *child_fd;
  241.  dword *child_bk;
  242.  dword *parend;
  243.  dword ctrl_x;
  244.  dword ctrl_y;
  245.  dword ctrl_sizex;
  246.  dword ctrl_sizey;
  247.  dword ctrl_ID;
  248.  
  249.  byte  type;
  250.  byte  flag;
  251.  dword color1;
  252.  dword x;
  253.  dword y;
  254.  dword sizex;
  255.  dword sizey;
  256.  dword pointer;
  257. }__attribute__((packed));
  258.  
  259. struct InfoForImage
  260. {
  261.  byte  type;
  262.  byte  flag;
  263.  dword color1;
  264.  dword x;
  265.  dword y;
  266.  dword sizex;
  267.  dword sizey;
  268.  dword pointer;
  269. }__attribute__((packed));
  270.  
  271. ////////////////////////////////////////////////////////////////
  272. //      text
  273. ////////////////////////////////////////////////////////////////
  274.  
  275. struct ControlText
  276. {
  277.  dword ctrl_proc;
  278.  dword *ctrl_fd;
  279.  dword *ctrl_bk;
  280.  dword *child_fd;
  281.  dword *child_bk;
  282.  dword *parend;
  283.  dword ctrl_x;
  284.  dword ctrl_y;
  285.  dword ctrl_sizex;
  286.  dword ctrl_sizey;
  287.  dword ctrl_ID;
  288.  
  289.  byte  type;
  290.  byte  flag;
  291.  dword color1;
  292.  dword x;
  293.  dword y;
  294.  dword length;
  295.  dword text;
  296.  dword background_color;
  297. }__attribute__((packed));
  298.  
  299. struct InfoForText
  300. {
  301.  byte  type;
  302.  byte  flag;
  303.  dword color1;
  304.  dword x;
  305.  dword y;
  306.  dword length;
  307.  dword text;
  308.  dword background_color;
  309. }__attribute__((packed));
  310.  
  311. ////////////////////////////////////////////////////////////////
  312. //      number
  313. ////////////////////////////////////////////////////////////////
  314.  
  315. struct ControlNumber
  316. {
  317.  dword ctrl_proc;
  318.  dword *ctrl_fd;
  319.  dword *ctrl_bk;
  320.  dword *child_fd;
  321.  dword *child_bk;
  322.  dword *parend;
  323.  dword ctrl_x;
  324.  dword ctrl_y;
  325.  dword ctrl_sizex;
  326.  dword ctrl_sizey;
  327.  dword ctrl_ID;
  328.  
  329.  byte  type;
  330.  byte  flag;
  331.  dword color1;
  332.  dword x;
  333.  dword y;
  334.  float number;
  335.  dword format;
  336. }__attribute__((packed));
  337.  
  338. struct InfoForNumber
  339. {
  340.  byte  type;
  341.  byte  flag;
  342.  dword color1;
  343.  dword x;
  344.  dword y;
  345.  float number;
  346.  dword format;
  347. }__attribute__((packed));
  348.  
  349.  
  350. /////////////////////////////////////////////////////////////////
  351. //           libGUI functions
  352. /////////////////////////////////////////////////////////////////
  353.  
  354. void   stdcall (*DestroyControl)(void *control);
  355. void   stdcall (*SendMessage)(struct HEADER *Parend,struct MESSAGE *Message);
  356. int    stdcall (*Version)(void);
  357. void   stdcall (*ResizeComponent)(void *Control,int new_sizex,int new_sizey);
  358. void   stdcall (*MoveComponent)(void *Control,int new_x,int new_y);
  359. void   stdcall (*ActivateTrapForSpecializedMessage)(void *Control);
  360. void*  stdcall (*CraeteButton)(struct HEADER *Parend,void *Control);
  361. void*  stdcall (*CraeteScroller)(struct HEADER *Parend,void *Control);
  362. void*  stdcall (*CraeteBookmark)(struct HEADER *Parend,void *Control);
  363. void*  stdcall (*CraeteImage)(struct HEADER *Parend,void *Control);
  364. void*  stdcall (*CraeteText)(struct HEADER *Parend,void *Control);
  365. void*  stdcall (*CraeteNumber)(struct HEADER *Parend,void *Control);
  366. void*  stdcall (*CraeteCheckbox)(struct HEADER *Parend,void *Control);
  367. void*  stdcall (*CraeteEditbox)(struct HEADER *Parend,void *Control);
  368. void*  stdcall (*CraeteProgressbar)(struct HEADER *Parend,void *Control);
  369.  
  370.