gel_control.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /** @file
  2. * Header file for GEL control handling API.
  3. *
  4. * @author mandy.wu 2009/11/30 (Add anim enable/disable control)
  5. * @author tzungming.lin 2009/07/31 (last updated)
  6. * @version 0.1
  7. */
  8. #ifndef __GEL_CONTROL__
  9. #define __GEL_CONTROL__
  10. /**
  11. * Creates handles for all the controls in a menu/popup menu.
  12. *
  13. * @param pWinCtrl A WinControl_t pointer to a menu/popup menu.
  14. * @param sdRegionHandle The created region handle for the WINDOW/POPUP.
  15. * @return GUI_SUCCESS if succeed, error code otherwise.
  16. */
  17. GUIResult_e GEL_CreateMenu(WinControl_t *pWinCtrl, RegionHandle_t sdRegionHandle)__attribute__ ((warn_unused_result));
  18. /**
  19. * Destroy handles of all the controls in a menu/popup menu.
  20. *
  21. * @param pWinCtrl A WinControl_t pointer to a menu/popup menu.
  22. * @param bClear A boolean value that decide whether clear the menu area after destroy it or not.
  23. * @return GUI_SUCCESS if succeed, error code otherwise.
  24. */
  25. GUIResult_e GEL_DestroyMenu(WinControl_t *pWinCtrl, BOOLEAN bClear)__attribute__ ((warn_unused_result));
  26. /**
  27. * Show all the controls in a menu/popup menu.
  28. *
  29. * @param pWinCtrl A WinControl_t pointer to a WINDOW/POPUP.
  30. * @return GUI_SUCCESS if succeed, error code otherwise.
  31. */
  32. GUIResult_e GEL_ShowMenu(WinControl_t *pWinCtrl)__attribute__ ((warn_unused_result));
  33. /**
  34. * Change the coordinate of a specific menu and all controls of it.
  35. * Notes that GEL_CreateMenu should be called before GEL_SetMenuXY,
  36. * and GEL_ShowMenu should be called after GEL_SetMenuXY to refresh the whole menu!
  37. *
  38. * @param pWinCtrl A WinControl_t pointer to a WINDOW or a POPUP.
  39. * @param wMenuX X coordinate of the menu to be set.
  40. * @param wMenuY Y coordinate of the menu to be set.
  41. * @return GUI_SUCCESS if succeed, error code otherwise.
  42. */
  43. GUIResult_e GEL_SetMenuXY(WinControl_t *pWinCtrl, INT16 wMenuX, INT16 wMenuY)__attribute__ ((warn_unused_result));
  44. /**
  45. * Get the cuurent coordinate of the menu.
  46. *
  47. * @param pWinCtrl A WinControl_t pointer to a menu/popup menu.
  48. * @param pwMenuX Return the coordinate x coordinate of the menu.
  49. * @param pwMenuY Return the coordinate y coordinate of the menu.
  50. * @return GUI_SUCCESS if succeed, error code otherwise.
  51. */
  52. GUIResult_e GEL_GetMenuXY(WinControl_t *pWinCtrl, INT16 *pwMenuX, INT16 *pwMenuY)__attribute__ ((warn_unused_result));
  53. /**
  54. * Get the handle of a specific control.
  55. *
  56. * @param pWinCtrl A WinControl_t pointer to a control.
  57. * @param pHandle Return the HWND pointer of a control.
  58. * @return GUI_SUCCESS if succeed, error code otherwise.
  59. */
  60. GUIResult_e GEL_GetHandle(void *pWinCtrl, INT32 sdIdx, HWND *pHandle)__attribute__ ((warn_unused_result));
  61. /**
  62. * Set active window to the specific menu/popup menu.
  63. *
  64. * @param pWinCtrl A WinControl_t pointer to a menu/popup menu.
  65. * @return GUI_SUCCESS if succeed, error code otherwise.
  66. * @see GEL_GetActiveMenu()
  67. */
  68. GUIResult_e GEL_SetActiveMenu(WinControl_t *pWinCtrl)__attribute__ ((warn_unused_result));
  69. /**
  70. * Get current active menu/popup menu.
  71. *
  72. * @param ppWinCtrl Returned reference of a WinControl_t pointer to a menu/popup menu.
  73. * @return GUI_SUCCESS if succeed, error code otherwise.
  74. * @see GEL_SetActiveMenu()
  75. */
  76. GUIResult_e GEL_GetActiveMenu(WinControl_t **ppWinCtrl)__attribute__ ((warn_unused_result));
  77. /**
  78. * Set current focused id to the current active menu/popup menu.
  79. *
  80. * @param wCtrlId The control ID in the active menu/popup menu.
  81. * @return GUI_SUCCESS if succeed, error code otherwise.
  82. */
  83. GUIResult_e GEL_SetActiveHandle(UINT16 wCtrlId)__attribute__ ((warn_unused_result));
  84. /**
  85. * Get current focused handle in the active menu/popup menu.
  86. *
  87. * @param pHandle Handle to the current focused control object.
  88. * @return GUI_SUCCESS if succeed, error code otherwise.
  89. */
  90. GUIResult_e GEL_GetActiveHandle(HWND* pHandle)__attribute__ ((warn_unused_result));
  91. /**
  92. * Move a control to the given coordinate.
  93. *
  94. * @param pHandle Handle to a control to be moved.
  95. * @param swXPos x coordinate to be moved to.
  96. * @param swYPos y coordinate to be moved to.
  97. * @param wWidth Width to be resized to.
  98. * @param wHeight Height to be resized to.
  99. * @return GUI_SUCCESS if succeed, error code otherwise.
  100. */
  101. GUIResult_e GEL_MoveControl(HWND pHandle, INT16 swXPos, INT16 swYPos, UINT16 wWidth, UINT16 wHeight)__attribute__ ((warn_unused_result));
  102. /**
  103. * Set parameters to a specific control.
  104. *
  105. * @param pHandle Handle to a control object.
  106. * @param eParamType Type of the parameter to be set.
  107. * @param pParam Pointer to the value to be set.
  108. * @return GUI_SUCCESS if succeed, error code otherwise.
  109. */
  110. GUIResult_e GEL_SetParam(HWND pHandle, ParamType_e eParamType, void *pParam)__attribute__ ((warn_unused_result));
  111. /**
  112. * Get parameters from a specific control.
  113. *
  114. * @param pHandle Handle to a control object.
  115. * @param eParamType Type of the parameter to be got.
  116. * @param pParam Pointer to the specific type of structure for returned value.
  117. * @return GUI_SUCCESS if succeed, error code otherwise.
  118. */
  119. GUIResult_e GEL_GetParam(HWND pHandle, ParamType_e eParamType, void *pParam)__attribute__ ((warn_unused_result));
  120. /**
  121. * Send the message to the callback function for each type of widgets.
  122. *
  123. * @param pHandle Handle to the window.
  124. * @param dMsg Type of window message.
  125. * @param eInputKey Input key for CLASS_EDIT to use.
  126. * @return GUI_SUCCESS if succeed, error code otherwise.
  127. */
  128. GUIResult_e GEL_SendMsg (HWND pHandle, UINT32 dMsg, input_key_t eInputKey)__attribute__ ((warn_unused_result));
  129. /**
  130. * Set a palette to the handle. If it's NULL, the handle will refer to the default palette.
  131. * The palette is only valid when the drawn region is 16bit or 32bit.
  132. *
  133. * @param pHandle Handle to a control object.
  134. * @param pPal Pointer of a palette entry to be set.
  135. * @return GUI_SUCCESS if succeed, error code otherwise.
  136. */
  137. GUIResult_e GEL_SetPal(HWND pHandle, const PALENTRY *pPal)__attribute__ ((warn_unused_result));
  138. /**
  139. * Get the attached palette to the handle. If it's NULL, the handle will refer to the default palette.
  140. * The palette is only valid when the drawn region is 16bit or 32bit.
  141. *
  142. * @param pHandle Handle to a control object.
  143. * @param ppPal Return the pointer of the current assigned palette entry.
  144. * @return GUI_SUCCESS if succeed, error code otherwise.
  145. */
  146. GUIResult_e GEL_GetPal(HWND pHandle, PALENTRY **ppPal)__attribute__ ((warn_unused_result));
  147. /**
  148. * Set an animation to be active or not.
  149. *
  150. * @param pHandle Handle to a control object.
  151. * @param bEnable Set the animation to be enable or not.
  152. * @return GUI_SUCCESS if succeed, error code otherwise.
  153. */
  154. GUIResult_e GEL_SetAnimEnable(HWND pHandle, BOOLEAN bEnable)__attribute__ ((warn_unused_result));
  155. /**
  156. * Set sleep control to be enable or not when rendering.
  157. * @param bEnable Set the sleep to be enable or not when rendering.
  158. * @return GUI_SUCCESS if succeed, error code otherwise.
  159. */
  160. GUIResult_e GEL_SetSleepEnable(BOOLEAN bEnable)__attribute__ ((warn_unused_result));
  161. /**
  162. * Set rotation type to icon control.
  163. *
  164. * @param pHandle Handle to a control.
  165. * @param eRotate Rotation type.
  166. * @return GUI_SUCCESS if succeed, error code otherwise.
  167. */
  168. GUIResult_e GEL_SetIconRotate(HWND pHandle, GEL_IconRotate_e eRotate)__attribute__ ((warn_unused_result));
  169. /**
  170. * Get GUI engine version. Four leveled version number: 4 8 8 12 bits individually.
  171. *
  172. * @param pdVersion Returned version number.
  173. */
  174. void GEL_GetVersion(UINT32 *pdVersion);
  175. /**
  176. * Set editbox twinkling period.
  177. *
  178. * @param btwinkleperiod Set the twinkling period (100ms)
  179. * @return GUI_SUCCESS if succeed, error code otherwise.
  180. */
  181. GUIResult_e GEL_SetTwinklePeriod(UINT8 btwinkleperiod)__attribute__ ((warn_unused_result));
  182. /**
  183. * Update all OSD changes to Panel .
  184. * @param None
  185. * @return GUI_SUCCESS if succeed, error code otherwise.
  186. */
  187. GUIResult_e GEL_UpdateOSD(void)__attribute__ ((warn_unused_result));
  188. /**
  189. * Enable or Disable OSD.
  190. *
  191. * @param stRgnHandle The target region handle.
  192. * @param ShowOSD
  193. * @return GUI_SUCCESS if succeed, error codes otherwise.
  194. */
  195. GUIResult_e GEL_SetDisplay(GEL_RgnHandle_t stRgnHandle, BOOL ShowOSD)__attribute__ ((warn_unused_result));
  196. /**
  197. * Render a control to a region buffer.
  198. *
  199. * @param pstDstBuf The handle of the destination buffer.
  200. * @param pSrcHandle The handle of the source control.
  201. * @param pstDstRect Desire area of the destination buffer to be drawn.
  202. * @return GUI_SUCCESS if succeed, error codes otherwise.
  203. */
  204. GUIResult_e GEL_RGNBUF_RenderControl(HWND pSrcHandle)__attribute__ ((warn_unused_result));
  205. /* Internal functions declaration */
  206. GUIResult_e GEL_RGNBUF_DrawString(RegionHandle_t *sdRegionHandle, UINT8 *pStr, GEL_DynStrType_e eStrType,
  207. GEL_TextInfo_t *pstTextInfo, GEL_VFInfo_t *pstVFInfo, PRECT pstDstRect, BOOLEAN bSubDraw, INT32* pBlockId);
  208. UINT8 GEL_GetgTwinklePeriod(void);
  209. GUIResult_e GEL_SetOSDLayer(UINT32 dRegionHandle, OSD_Layer_t layer);
  210. GUIResult_e GEL_GetOSDLayer(UINT32 dRegionHandle);
  211. GUIResult_e GEL_SetOSDTransparency(INT8 i8OSDTransparency);
  212. void GEL_SetFocusedStrBorderParam(UINT32 state, Color_t color, UINT32 icon_id);
  213. void GEL_SetFocusedBorderParam(UINT32 state, Color_t color, UINT32 icon_id);
  214. GUIResult_e GEL_WaitRollDone(HWND pHandle);
  215. #ifdef CONFIG_SUPPORT_FLIP_HORIZ
  216. typedef UINT8 (*IsFlipHorizFun)(void);
  217. GUIResult_e GEL_RegisterFlipHorizCallback(IsFlipHorizFun callback);
  218. RECT GEL_GetRegionAreaByHandle(HWND handle);
  219. #endif
  220. #endif /* __GEL_CONTROL__ */