gx_button.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /**************************************************************************/
  2. /* */
  3. /* Copyright (c) Microsoft Corporation. All rights reserved. */
  4. /* */
  5. /* This software is licensed under the Microsoft Software License */
  6. /* Terms for Microsoft Azure RTOS. Full text of the license can be */
  7. /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
  8. /* and in the root directory of this software. */
  9. /* */
  10. /**************************************************************************/
  11. /**************************************************************************/
  12. /**************************************************************************/
  13. /** */
  14. /** GUIX Component */
  15. /** */
  16. /** Button Management (Button) */
  17. /** */
  18. /**************************************************************************/
  19. /**************************************************************************/
  20. /**************************************************************************/
  21. /* */
  22. /* COMPONENT DEFINITION RELEASE */
  23. /* */
  24. /* gx_button.h PORTABLE C */
  25. /* 6.0 */
  26. /* AUTHOR */
  27. /* */
  28. /* Kenneth Maxwell, Microsoft Corporation */
  29. /* */
  30. /* DESCRIPTION */
  31. /* */
  32. /* This file defines the GUIX button management component, */
  33. /* including all data types and external references. It is assumed */
  34. /* that gx_api.h and gx_port.h have already been included. */
  35. /* */
  36. /* RELEASE HISTORY */
  37. /* */
  38. /* DATE NAME DESCRIPTION */
  39. /* */
  40. /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
  41. /* */
  42. /**************************************************************************/
  43. #ifndef GX_BUTTON_H
  44. #define GX_BUTTON_H
  45. /* Define button management function prototypes. */
  46. UINT _gx_button_create(GX_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
  47. ULONG style, USHORT Id, GX_CONST GX_RECTANGLE *size);
  48. VOID _gx_button_background_draw(GX_BUTTON *button);
  49. UINT _gx_button_deselect(GX_BUTTON *button, GX_BOOL generate_event);
  50. VOID _gx_button_draw(GX_BUTTON *button);
  51. UINT _gx_button_event_process(GX_BUTTON *button, GX_EVENT *event_ptr);
  52. VOID _gx_button_siblings_deselect(GX_BUTTON *button);
  53. UINT _gx_button_select(GX_BUTTON *button);
  54. UINT _gx_checkbox_create(GX_CHECKBOX *checkbox, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
  55. GX_RESOURCE_ID text_id, ULONG style, USHORT checkbox_id,
  56. GX_CONST GX_RECTANGLE *size);
  57. VOID _gx_checkbox_draw(GX_CHECKBOX *checkbox);
  58. UINT _gx_checkbox_event_process(GX_CHECKBOX *checkbox, GX_EVENT *event_ptr);
  59. UINT _gx_checkbox_pixelmap_set(GX_CHECKBOX *button, GX_RESOURCE_ID unchecked_id, GX_RESOURCE_ID checked_id,
  60. GX_RESOURCE_ID unchecked_disabled_id, GX_RESOURCE_ID checked_disabled_id);
  61. UINT _gx_checkbox_select(GX_CHECKBOX *checkbox);
  62. UINT _gx_icon_button_create(GX_ICON_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
  63. GX_RESOURCE_ID icon_id,
  64. ULONG style, USHORT icon_button_id, GX_CONST GX_RECTANGLE *size);
  65. VOID _gx_icon_button_draw(GX_ICON_BUTTON *button);
  66. UINT _gx_icon_button_pixelmap_set(GX_ICON_BUTTON *button, GX_RESOURCE_ID icon_id);
  67. UINT _gx_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *name,
  68. GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
  69. GX_CONST GX_RECTANGLE *size);
  70. VOID _gx_multi_line_text_button_draw(GX_MULTI_LINE_TEXT_BUTTON *button);
  71. UINT _gx_multi_line_text_button_event_process(GX_MULTI_LINE_TEXT_BUTTON *button, GX_EVENT *event_ptr);
  72. VOID _gx_multi_line_text_button_line_pointers_set(GX_MULTI_LINE_TEXT_BUTTON *button);
  73. VOID _gx_multi_line_text_button_text_draw(GX_MULTI_LINE_TEXT_BUTTON *button);
  74. #if defined(GX_ENABLE_DEPRECATED_STRING_API)
  75. UINT _gx_multi_line_text_button_text_set(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *text);
  76. #endif
  77. UINT _gx_multi_line_text_button_text_set_ext(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_STRING *text);
  78. UINT _gx_multi_line_text_button_text_id_set(GX_MULTI_LINE_TEXT_BUTTON *button, GX_RESOURCE_ID string_id);
  79. UINT _gx_pixelmap_button_create(GX_PIXELMAP_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
  80. GX_RESOURCE_ID normal_id, GX_RESOURCE_ID selected_id, GX_RESOURCE_ID disabled_id,
  81. ULONG style, USHORT pixelmap_button_id,
  82. GX_CONST GX_RECTANGLE *size);
  83. VOID _gx_pixelmap_button_draw(GX_PIXELMAP_BUTTON *button);
  84. UINT _gx_pixelmap_button_event_process(GX_PIXELMAP_BUTTON *button, GX_EVENT *event_ptr);
  85. UINT _gx_pixelmap_button_pixelmap_set(GX_PIXELMAP_BUTTON *button, GX_RESOURCE_ID normal_id, GX_RESOURCE_ID selected_id,
  86. GX_RESOURCE_ID disabled_id);
  87. VOID _gx_pixelmap_button_transparent_detect(GX_PIXELMAP_BUTTON *button);
  88. UINT _gx_radio_button_create(GX_RADIO_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
  89. GX_RESOURCE_ID text_id, ULONG style, USHORT radio_button_id,
  90. GX_CONST GX_RECTANGLE *size);
  91. VOID _gx_radio_button_draw(GX_RADIO_BUTTON *button);
  92. UINT _gx_radio_button_pixelmap_set(GX_RADIO_BUTTON *button, GX_RESOURCE_ID off_id, GX_RESOURCE_ID on_id,
  93. GX_RESOURCE_ID off_disabled_id, GX_RESOURCE_ID on_disabled_id);
  94. UINT _gx_text_button_create(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
  95. GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
  96. GX_CONST GX_RECTANGLE *size);
  97. VOID _gx_text_button_draw(GX_TEXT_BUTTON *button);
  98. VOID _gx_text_button_text_draw(GX_TEXT_BUTTON *button);
  99. UINT _gx_text_button_text_color_set(GX_TEXT_BUTTON *text_button,
  100. GX_RESOURCE_ID normal_text_color_id,
  101. GX_RESOURCE_ID selected_text_color_id,
  102. GX_RESOURCE_ID disabled_text_color_id);
  103. UINT _gx_text_button_font_set(GX_TEXT_BUTTON *button, GX_RESOURCE_ID font_id);
  104. #if defined(GX_ENABLE_DEPRECATED_STRING_API)
  105. UINT _gx_text_button_text_get(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR **return_text);
  106. UINT _gx_text_button_text_set(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *text);
  107. #endif
  108. UINT _gx_text_button_text_get_ext(GX_TEXT_BUTTON *button, GX_STRING *return_text);
  109. UINT _gx_text_button_text_set_ext(GX_TEXT_BUTTON *button, GX_CONST GX_STRING *text);
  110. UINT _gx_text_button_text_id_set(GX_TEXT_BUTTON *button, GX_RESOURCE_ID string_id);
  111. VOID _gx_monochrome_driver_disabled_button_line_draw(GX_BUTTON *button);
  112. /* Define error checking shells for API services. These are only referenced by the
  113. application. */
  114. UINT _gxe_button_create(GX_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, ULONG style,
  115. USHORT Id, GX_CONST GX_RECTANGLE *size, UINT button_control_block_size);
  116. UINT _gxe_button_deselect(GX_BUTTON *button, GX_BOOL gen_event);
  117. UINT _gxe_button_event_process(GX_BUTTON *button, GX_EVENT *event_ptr);
  118. UINT _gxe_button_select(GX_BUTTON *button);
  119. UINT _gxe_checkbox_create(GX_CHECKBOX *checkbox, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
  120. GX_RESOURCE_ID text_id, ULONG style,
  121. USHORT checkbox_id, GX_CONST GX_RECTANGLE *size, UINT checkbox_control_block_size);
  122. UINT _gxe_checkbox_event_process(GX_CHECKBOX *checkbox, GX_EVENT *event_ptr);
  123. UINT _gxe_checkbox_pixelmap_set(GX_CHECKBOX *checkbox,
  124. GX_RESOURCE_ID unchecked_id,
  125. GX_RESOURCE_ID checked_id,
  126. GX_RESOURCE_ID unchecked_disabled_id,
  127. GX_RESOURCE_ID checked_disabled_id);
  128. UINT _gxe_checkbox_select(GX_CHECKBOX *checkbox);
  129. UINT _gxe_icon_button_create(GX_ICON_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, GX_RESOURCE_ID icon_id,
  130. ULONG style, USHORT icon_button_id, GX_CONST GX_RECTANGLE *size, UINT button_control_block_size);
  131. UINT _gxe_icon_button_pixelmap_set(GX_ICON_BUTTON *button, GX_RESOURCE_ID pixelmap_id);
  132. UINT _gxe_multi_line_text_button_create(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *name,
  133. GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
  134. GX_CONST GX_RECTANGLE *size, UINT text_button_control_block);
  135. UINT _gxe_multi_line_text_button_event_process(GX_MULTI_LINE_TEXT_BUTTON *button, GX_EVENT *event_ptr);
  136. #if defined(GX_ENABLE_DEPRECATED_STRING_API)
  137. UINT _gxe_multi_line_text_button_text_set(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_CHAR *text);
  138. #endif
  139. UINT _gxe_multi_line_text_button_text_set_ext(GX_MULTI_LINE_TEXT_BUTTON *button, GX_CONST GX_STRING *text);
  140. UINT _gxe_multi_line_text_button_text_id_set(GX_MULTI_LINE_TEXT_BUTTON *button, GX_RESOURCE_ID string_id);
  141. UINT _gxe_pixelmap_button_event_process(GX_PIXELMAP_BUTTON *button, GX_EVENT *event_ptr);
  142. UINT _gxe_pixelmap_button_create(GX_PIXELMAP_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, GX_RESOURCE_ID normal_id,
  143. GX_RESOURCE_ID selected_id, GX_RESOURCE_ID disabled_id, ULONG style, USHORT pixelmap_button_id,
  144. GX_CONST GX_RECTANGLE *size, UINT button_control_block_size);
  145. UINT _gxe_pixelmap_button_pixelmap_set(GX_PIXELMAP_BUTTON *button, GX_RESOURCE_ID normal_id, GX_RESOURCE_ID selected_id,
  146. GX_RESOURCE_ID disabled_id);
  147. UINT _gxe_radio_button_create(GX_RADIO_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style,
  148. USHORT radio_button_id, GX_CONST GX_RECTANGLE *size, UINT radio_button_control_block_size);
  149. UINT _gxe_radio_button_pixelmap_set(GX_RADIO_BUTTON *button, GX_RESOURCE_ID off_id, GX_RESOURCE_ID on_id, GX_RESOURCE_ID off_disabled_id,
  150. GX_RESOURCE_ID on_disabled_id);
  151. UINT _gxe_text_button_create(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
  152. GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
  153. GX_CONST GX_RECTANGLE *size, UINT text_button_control_block);
  154. UINT _gxe_text_button_font_set(GX_TEXT_BUTTON *button, GX_RESOURCE_ID font_id);
  155. UINT _gxe_text_button_text_color_set(GX_TEXT_BUTTON *text_button,
  156. GX_RESOURCE_ID normal_text_color_id,
  157. GX_RESOURCE_ID selected_text_color_id,
  158. GX_RESOURCE_ID disabled_text_color_id);
  159. #if defined(GX_ENABLE_DEPRECATED_STRING_API)
  160. UINT _gxe_text_button_text_get(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR **return_text);
  161. UINT _gxe_text_button_text_set(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *text);
  162. #endif
  163. UINT _gxe_text_button_text_get_ext(GX_TEXT_BUTTON *button, GX_STRING *return_text);
  164. UINT _gxe_text_button_text_set_ext(GX_TEXT_BUTTON *button, GX_CONST GX_STRING *text);
  165. UINT _gxe_text_button_text_id_set(GX_TEXT_BUTTON *button, GX_RESOURCE_ID string_id);
  166. #endif