home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / oslib / oslib_1 / OSLib / Toolbox / h / gadget < prev    next >
Encoding:
Text File  |  1995-09-05  |  10.6 KB  |  355 lines

  1. #ifndef gadget_H
  2. #define gadget_H
  3.  
  4. /* C header file for Gadget
  5.  * written by DefMod (Aug 30 1995) on Tue Sep  5 16:29:18 1995
  6.  * Jonathan Coxhead, Acorn Computers Ltd
  7.  */
  8.  
  9. #ifndef types_H
  10. #include "types.h"
  11. #endif
  12.  
  13. #ifndef toolbox_H
  14. #include "toolbox.h"
  15. #endif
  16.  
  17. /**********************************
  18.  * SWI names and SWI reason codes *
  19.  **********************************/
  20. #undef  Gadget_GetFlags
  21. #define Gadget_GetFlags                         0x40
  22. #undef  Gadget_SetFlags
  23. #define Gadget_SetFlags                         0x41
  24. #undef  Gadget_SetHelpMessage
  25. #define Gadget_SetHelpMessage                   0x42
  26. #undef  Gadget_GetHelpMessage
  27. #define Gadget_GetHelpMessage                   0x43
  28. #undef  Gadget_GetIconList
  29. #define Gadget_GetIconList                      0x44
  30. #undef  Gadget_SetFocus
  31. #define Gadget_SetFocus                         0x45
  32. #undef  Gadget_GetType
  33. #define Gadget_GetType                          0x46
  34. #undef  Gadget_MoveGadget
  35. #define Gadget_MoveGadget                       0x47
  36. #undef  Gadget_GetBBox
  37. #define Gadget_GetBBox                          0x48
  38.  
  39. /************************************
  40.  * Structure and union declarations *
  41.  ************************************/
  42. typedef struct gadget_object                    gadget_object;
  43. typedef struct gadget_extension                 gadget_extension;
  44. typedef struct gadget_extension_list            gadget_extension_list;
  45.  
  46. /********************
  47.  * Type definitions *
  48.  ********************/
  49. typedef bits gadget_flags;
  50.  
  51. struct gadget_object
  52.    {  gadget_flags flags;
  53.       toolbox_class class_no;
  54.       short size;
  55.       os_box bbox;
  56.       toolbox_c cmp;
  57.       toolbox_msg_reference help_message;
  58.       int help_limit;
  59.       int gadget [UNKNOWN];
  60.    };
  61.  
  62. #define gadget_OBJECT(N) \
  63.    struct \
  64.       {  gadget_flags flags; \
  65.          toolbox_class class_no; \
  66.          short size; \
  67.          os_box bbox; \
  68.          toolbox_c cmp; \
  69.          toolbox_msg_reference help_message; \
  70.          int help_limit; \
  71.          int gadget [N]; \
  72.       }
  73.  
  74. #define gadget_SIZEOF_OBJECT(N) \
  75.    (offsetof (gadget_object, gadget) + \
  76.          (N)*sizeof ((gadget_object *) NULL)->gadget)
  77.  
  78. typedef bits gadget_feature;
  79.  
  80. struct gadget_extension
  81.    {  int type;
  82.       gadget_flags valid_flags;
  83.       gadget_feature features;
  84.    };
  85.  
  86. struct gadget_extension_list
  87.    {  gadget_extension gadget [UNKNOWN];
  88.    };
  89.  
  90. #define gadget_EXTENSION_LIST(N) \
  91.    struct \
  92.       {  gadget_extension gadget [N]; \
  93.       }
  94.  
  95. #define gadget_SIZEOF_EXTENSION_LIST(N) \
  96.    ((N)*sizeof ((gadget_extension_list *) NULL)->gadget)
  97.  
  98. /************************
  99.  * Constant definitions *
  100.  ************************/
  101. #define gadget_FADED                            ((gadget_flags) 0x80000000u)
  102. #define gadget_AT_BACK                          ((gadget_flags) 0x40000000u)
  103. #define gadget_NO_HANDLER                       0x0u
  104. #define gadget_DEFAULT_HANDLER                  0x1u
  105. #define gadget_PRIVATE_HANDLER                  0x2u
  106. #define gadget_FEATURE_ADD_SHIFT                0
  107. #define gadget_FEATURE_ADD                      ((gadget_feature) 0x3u)
  108. #define gadget_FEATURE_REMOVE_SHIFT             2
  109. #define gadget_FEATURE_REMOVE                   ((gadget_feature) 0xCu)
  110. #define gadget_FEATURE_POST_ADD_SHIFT           4
  111. #define gadget_FEATURE_POST_ADD                 ((gadget_feature) 0x30u)
  112. #define gadget_FEATURE_METHOD_SHIFT             6
  113. #define gadget_FEATURE_METHOD                   ((gadget_feature) 0xC0u)
  114. #define gadget_FEATURE_CLICK_SHIFT              10
  115. #define gadget_FEATURE_CLICK                    ((gadget_feature) 0xC00u)
  116. #define gadget_FEATURE_PLOT_SHIFT               16
  117. #define gadget_FEATURE_PLOT                     ((gadget_feature) 0x30000u)
  118. #define gadget_FEATURE_SET_FOCUS_SHIFT          18
  119. #define gadget_FEATURE_SET_FOCUS                ((gadget_feature) 0xC0000u)
  120. #define gadget_FEATURE_MOVE_SHIFT               20
  121. #define gadget_FEATURE_MOVE                     ((gadget_feature) 0x300000u)
  122. #define gadget_FEATURE_FADE_SHIFT               22
  123. #define gadget_FEATURE_FADE                     ((gadget_feature) 0xC00000u)
  124.  
  125. /*************************
  126.  * Function declarations *
  127.  *************************/
  128.  
  129. #ifdef __cplusplus
  130.    extern "C" {
  131. #endif
  132.  
  133. /* ------------------------------------------------------------------------
  134.  * Function:      gadget_get_flags()
  135.  *
  136.  * Description:   Gets the flags for a particular gadget
  137.  *
  138.  * Input:         flags - value of R0 on entry
  139.  *                window - value of R1 on entry
  140.  *                gadget - value of R3 on entry
  141.  *
  142.  * Output:        flags_out - value of R0 on exit (X version only)
  143.  *
  144.  * Returns:       R0 (non-X version only)
  145.  *
  146.  * Other notes:   Calls SWI 0x44EC6 with R2 = 0x40.
  147.  */
  148.  
  149. extern os_error *xgadget_get_flags (bits flags,
  150.       toolbox_o window,
  151.       toolbox_c gadget,
  152.       gadget_flags *flags_out);
  153. extern gadget_flags gadget_get_flags (bits flags,
  154.       toolbox_o window,
  155.       toolbox_c gadget);
  156.  
  157. /* ------------------------------------------------------------------------
  158.  * Function:      gadget_set_flags()
  159.  *
  160.  * Description:   Sets the flags for a particular gadget
  161.  *
  162.  * Input:         flags - value of R0 on entry
  163.  *                window - value of R1 on entry
  164.  *                gadget - value of R3 on entry
  165.  *                flags_in - value of R4 on entry
  166.  *
  167.  * Other notes:   Calls SWI 0x44EC6 with R2 = 0x41.
  168.  */
  169.  
  170. extern os_error *xgadget_set_flags (bits flags,
  171.       toolbox_o window,
  172.       toolbox_c gadget,
  173.       gadget_flags flags_in);
  174. extern void gadget_set_flags (bits flags,
  175.       toolbox_o window,
  176.       toolbox_c gadget,
  177.       gadget_flags flags_in);
  178.  
  179. /* ------------------------------------------------------------------------
  180.  * Function:      gadget_set_help_message()
  181.  *
  182.  * Description:   Sets the help message for a particular gadget
  183.  *
  184.  * Input:         flags - value of R0 on entry
  185.  *                window - value of R1 on entry
  186.  *                gadget - value of R3 on entry
  187.  *                help_message - value of R4 on entry
  188.  *
  189.  * Other notes:   Calls SWI 0x44EC6 with R2 = 0x42.
  190.  */
  191.  
  192. extern os_error *xgadget_set_help_message (bits flags,
  193.       toolbox_o window,
  194.       toolbox_c gadget,
  195.       char const *help_message);
  196. extern void gadget_set_help_message (bits flags,
  197.       toolbox_o window,
  198.       toolbox_c gadget,
  199.       char const *help_message);
  200.  
  201. /* ------------------------------------------------------------------------
  202.  * Function:      gadget_get_help_message()
  203.  *
  204.  * Description:   Gets the help message that is associated with a
  205.  *                particular gadget
  206.  *
  207.  * Input:         flags - value of R0 on entry
  208.  *                window - value of R1 on entry
  209.  *                gadget - value of R3 on entry
  210.  *                help_message - value of R4 on entry
  211.  *                size - value of R5 on entry
  212.  *
  213.  * Output:        used - value of R5 on exit (X version only)
  214.  *
  215.  * Returns:       R5 (non-X version only)
  216.  *
  217.  * Other notes:   Calls SWI 0x44EC6 with R2 = 0x43.
  218.  */
  219.  
  220. extern os_error *xgadget_get_help_message (bits flags,
  221.       toolbox_o window,
  222.       toolbox_c gadget,
  223.       char *help_message,
  224.       int size,
  225.       int *used);
  226. extern int gadget_get_help_message (bits flags,
  227.       toolbox_o window,
  228.       toolbox_c gadget,
  229.       char *help_message,
  230.       int size);
  231.  
  232. /* ------------------------------------------------------------------------
  233.  * Function:      gadget_get_icon_list()
  234.  *
  235.  * Description:   Gets the list of icon handles that are associated with a
  236.  *                gadget
  237.  *
  238.  * Input:         flags - value of R0 on entry
  239.  *                window - value of R1 on entry
  240.  *                gadget - value of R3 on entry
  241.  *                buffer - value of R4 on entry
  242.  *                size - value of R5 on entry
  243.  *
  244.  * Output:        used - value of R5 on exit (X version only)
  245.  *
  246.  * Returns:       R5 (non-X version only)
  247.  *
  248.  * Other notes:   Calls SWI 0x44EC6 with R2 = 0x44.
  249.  */
  250.  
  251. extern os_error *xgadget_get_icon_list (bits flags,
  252.       toolbox_o window,
  253.       toolbox_c gadget,
  254.       wimp_i *buffer,
  255.       int size,
  256.       int *used);
  257. extern int gadget_get_icon_list (bits flags,
  258.       toolbox_o window,
  259.       toolbox_c gadget,
  260.       wimp_i *buffer,
  261.       int size);
  262.  
  263. /* ------------------------------------------------------------------------
  264.  * Function:      gadget_set_focus()
  265.  *
  266.  * Description:   Sets the type for the specified gadget
  267.  *
  268.  * Input:         flags - value of R0 on entry
  269.  *                window - value of R1 on entry
  270.  *                gadget - value of R3 on entry
  271.  *
  272.  * Other notes:   Calls SWI 0x44EC6 with R2 = 0x45.
  273.  */
  274.  
  275. extern os_error *xgadget_set_focus (bits flags,
  276.       toolbox_o window,
  277.       toolbox_c gadget);
  278. extern void gadget_set_focus (bits flags,
  279.       toolbox_o window,
  280.       toolbox_c gadget);
  281.  
  282. /* ------------------------------------------------------------------------
  283.  * Function:      gadget_get_type()
  284.  *
  285.  * Description:   Gets the type for the specified gadget
  286.  *
  287.  * Input:         flags - value of R0 on entry
  288.  *                window - value of R1 on entry
  289.  *                gadget - value of R3 on entry
  290.  *
  291.  * Output:        type - value of R0 on exit (X version only)
  292.  *
  293.  * Returns:       R0 (non-X version only)
  294.  *
  295.  * Other notes:   Calls SWI 0x44EC6 with R2 = 0x46.
  296.  */
  297.  
  298. extern os_error *xgadget_get_type (bits flags,
  299.       toolbox_o window,
  300.       toolbox_c gadget,
  301.       int *type);
  302. extern int gadget_get_type (bits flags,
  303.       toolbox_o window,
  304.       toolbox_c gadget);
  305.  
  306. /* ------------------------------------------------------------------------
  307.  * Function:      gadget_move_gadget()
  308.  *
  309.  * Description:   Moves an already created gadget in the specified window
  310.  *
  311.  * Input:         flags - value of R0 on entry
  312.  *                window - value of R1 on entry
  313.  *                gadget - value of R3 on entry
  314.  *                bbox - value of R4 on entry
  315.  *
  316.  * Other notes:   Calls SWI 0x44EC6 with R2 = 0x47.
  317.  */
  318.  
  319. extern os_error *xgadget_move_gadget (bits flags,
  320.       toolbox_o window,
  321.       toolbox_c gadget,
  322.       os_box const *bbox);
  323. extern void gadget_move_gadget (bits flags,
  324.       toolbox_o window,
  325.       toolbox_c gadget,
  326.       os_box const *bbox);
  327.  
  328. /* ------------------------------------------------------------------------
  329.  * Function:      gadget_get_bbox()
  330.  *
  331.  * Description:   Gets the bounding box of a gadget
  332.  *
  333.  * Input:         flags - value of R0 on entry
  334.  *                window - value of R1 on entry
  335.  *                gadget - value of R3 on entry
  336.  *                bbox - value of R4 on entry
  337.  *
  338.  * Other notes:   Calls SWI 0x44EC6 with R2 = 0x48.
  339.  */
  340.  
  341. extern os_error *xgadget_get_bbox (bits flags,
  342.       toolbox_o window,
  343.       toolbox_c gadget,
  344.       os_box *bbox);
  345. extern void gadget_get_bbox (bits flags,
  346.       toolbox_o window,
  347.       toolbox_c gadget,
  348.       os_box *bbox);
  349.  
  350. #ifdef __cplusplus
  351.    }
  352. #endif
  353.  
  354. #endif
  355.