Nuvoton
/
NuMaker-mbed-emWin-example
NuMaker emWin HMI
Embed:
(wiki syntax)
Show/hide line numbers
MENU.h
00001 /********************************************************************* 00002 * SEGGER Software GmbH * 00003 * Solutions for real time microcontroller applications * 00004 ********************************************************************** 00005 * * 00006 * (c) 1996 - 2018 SEGGER Microcontroller GmbH * 00007 * * 00008 * Internet: www.segger.com Support: support@segger.com * 00009 * * 00010 ********************************************************************** 00011 00012 ** emWin V5.48 - Graphical user interface for embedded applications ** 00013 All Intellectual Property rights in the Software belongs to SEGGER. 00014 emWin is protected by international copyright laws. Knowledge of the 00015 source code may not be used to write a similar product. This file may 00016 only be used in accordance with the following terms: 00017 00018 The software has been licensed by SEGGER Software GmbH to Nuvoton Technology Corporationat the address: No. 4, Creation Rd. III, Hsinchu Science Park, Taiwan 00019 for the purposes of creating libraries for its 00020 Arm Cortex-M and Arm9 32-bit microcontrollers, commercialized and distributed by Nuvoton Technology Corporation 00021 under the terms and conditions of an End User 00022 License Agreement supplied with the libraries. 00023 Full source code is available at: www.segger.com 00024 00025 We appreciate your understanding and fairness. 00026 ---------------------------------------------------------------------- 00027 Licensing information 00028 Licensor: SEGGER Software GmbH 00029 Licensed to: Nuvoton Technology Corporation, No. 4, Creation Rd. III, Hsinchu Science Park, 30077 Hsinchu City, Taiwan 00030 Licensed SEGGER software: emWin 00031 License number: GUI-00735 00032 License model: emWin License Agreement, signed February 27, 2018 00033 Licensed platform: Cortex-M and ARM9 32-bit series microcontroller designed and manufactured by or for Nuvoton Technology Corporation 00034 ---------------------------------------------------------------------- 00035 Support and Update Agreement (SUA) 00036 SUA period: 2018-03-26 - 2019-03-27 00037 Contact to extend SUA: sales@segger.com 00038 ---------------------------------------------------------------------- 00039 File : MENU.h 00040 Purpose : MENU include 00041 --------------------END-OF-HEADER------------------------------------- 00042 */ 00043 00044 #ifndef MENU_H 00045 #define MENU_H 00046 00047 #include "WM.h" 00048 #include "WIDGET.h" 00049 #include "DIALOG_Intern.h" // Required for Create indirect data structure 00050 00051 #if GUI_WINSUPPORT 00052 00053 #if defined(__cplusplus) 00054 extern "C" { // Make sure we have C-declarations in C++ programs 00055 #endif 00056 00057 /********************************************************************* 00058 * 00059 * Defines 00060 * 00061 ********************************************************************** 00062 */ 00063 #define MENU_SKIN_FLEX MENU_DrawSkinFlex 00064 00065 /********************************************************************* 00066 * 00067 * Create flags 00068 */ 00069 #define MENU_CF_HORIZONTAL (0<<0) 00070 #define MENU_CF_VERTICAL (1<<0) 00071 #define MENU_CF_OPEN_ON_POINTEROVER (1<<1) // Normally a menu opens first when clicked on it 00072 #define MENU_CF_CLOSE_ON_SECOND_CLICK (1<<2) // Normally a menu closes only when clicked outside it 00073 #define MENU_CF_HIDE_DISABLED_SEL (1<<3) // Hides the selection when a disabled item is selected 00074 00075 /********************************************************************* 00076 * 00077 * Menu item flags 00078 */ 00079 #define MENU_IF_DISABLED (1<<0) // Indicates that item is disabled 00080 #define MENU_IF_SEPARATOR (1<<1) // Indicates that item is a separator 00081 00082 /********************************************************************* 00083 * 00084 * Color indices 00085 */ 00086 #define MENU_CI_ENABLED 0 00087 #define MENU_CI_SELECTED 1 00088 #define MENU_CI_DISABLED 2 00089 #define MENU_CI_DISABLED_SEL 3 00090 #define MENU_CI_ACTIVE_SUBMENU 4 00091 00092 /********************************************************************* 00093 * 00094 * Border indices 00095 */ 00096 #define MENU_BI_LEFT 0 00097 #define MENU_BI_RIGHT 1 00098 #define MENU_BI_TOP 2 00099 #define MENU_BI_BOTTOM 3 00100 00101 /********************************************************************* 00102 * 00103 * Message types 00104 */ 00105 #define MENU_ON_ITEMSELECT 0 // Send to owner when selecting a menu item 00106 #define MENU_ON_INITMENU 1 // Send to owner when for the first time selecting a submenu 00107 #define MENU_ON_INITSUBMENU 2 // Send to owner when selecting a submenu 00108 #define MENU_ON_OPEN 3 // Internal message of menu widget (only send to submenus) 00109 #define MENU_ON_CLOSE 4 // Internal message of menu widget (only send to submenus) 00110 #define MENU_IS_MENU 5 // Internal message of menu widget. Owner must call 00111 // WM_DefaultProc() when not handle the message 00112 #define MENU_ON_ITEMACTIVATE 6 // Send to owner when highlighting a menu item 00113 #define MENU_ON_ITEMPRESSED 7 // Send to owner when a menu item has been pressed 00114 00115 /********************************************************************* 00116 * 00117 * Skinning property indices 00118 */ 00119 #define MENU_SKINFLEX_PI_ENABLED 0 00120 #define MENU_SKINFLEX_PI_SELECTED 1 00121 #define MENU_SKINFLEX_PI_DISABLED 2 00122 #define MENU_SKINFLEX_PI_DISABLED_SEL 3 00123 #define MENU_SKINFLEX_PI_ACTIVE_SUBMENU 4 00124 00125 /********************************************************************* 00126 * 00127 * Types 00128 * 00129 ********************************************************************** 00130 */ 00131 00132 typedef WM_HMEM MENU_Handle; 00133 00134 typedef struct { 00135 // 00136 // Background 00137 // 00138 GUI_COLOR aBkColorH[2]; 00139 GUI_COLOR BkColorV; 00140 GUI_COLOR FrameColorH; 00141 GUI_COLOR FrameColorV; 00142 // 00143 // Selection 00144 // 00145 GUI_COLOR aSelColorH[2]; 00146 GUI_COLOR aSelColorV[2]; 00147 GUI_COLOR FrameColorSelH; 00148 GUI_COLOR FrameColorSelV; 00149 // 00150 // Separator 00151 // 00152 GUI_COLOR aSepColorH[2]; 00153 GUI_COLOR aSepColorV[2]; 00154 // 00155 // Arrow 00156 // 00157 GUI_COLOR ArrowColor; 00158 // 00159 // Text 00160 // 00161 GUI_COLOR TextColor; 00162 } MENU_SKINFLEX_PROPS; 00163 00164 /********************************************************************* 00165 * 00166 * Menu message data 00167 */ 00168 typedef struct { 00169 U16 MsgType; 00170 U16 ItemId; 00171 } MENU_MSG_DATA; 00172 00173 /********************************************************************* 00174 * 00175 * Menu item data 00176 */ 00177 typedef struct { 00178 const char * pText; 00179 U16 Id; 00180 U16 Flags; 00181 MENU_Handle hSubmenu; 00182 } MENU_ITEM_DATA; 00183 00184 /********************************************************************* 00185 * 00186 * Create functions 00187 * 00188 ********************************************************************** 00189 */ 00190 MENU_Handle MENU_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb); 00191 MENU_Handle MENU_CreateEx (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id); 00192 MENU_Handle MENU_CreateUser (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int NumExtraBytes); 00193 00194 /********************************************************************* 00195 * 00196 * The callback ... 00197 * 00198 * Do not call it directly ! It is only to be used from within an 00199 * overwritten callback. 00200 */ 00201 void MENU_Callback(WM_MESSAGE * pMsg); 00202 00203 /********************************************************************* 00204 * 00205 * Individual member functions 00206 * 00207 ********************************************************************** 00208 */ 00209 void MENU_AddItem (MENU_Handle hObj, const MENU_ITEM_DATA * pItemData); 00210 void MENU_Attach (MENU_Handle hObj, WM_HWIN hDestWin, int x, int y, int xSize, int ySize, int Flags); 00211 void MENU_DeleteItem (MENU_Handle hObj, U16 ItemId); 00212 void MENU_DisableItem (MENU_Handle hObj, U16 ItemId); 00213 void MENU_EnableItem (MENU_Handle hObj, U16 ItemId); 00214 GUI_COLOR MENU_GetBkColor (MENU_Handle hObj, unsigned ColorIndex); 00215 const GUI_FONT * MENU_GetFont (MENU_Handle hObj); 00216 void MENU_GetItem (MENU_Handle hObj, U16 ItemId, MENU_ITEM_DATA * pItemData); 00217 void MENU_GetItemText (MENU_Handle hObj, U16 ItemId, char * pBuffer, unsigned BufferSize); 00218 unsigned MENU_GetNumItems (MENU_Handle hObj); 00219 WM_HWIN MENU_GetOwner (MENU_Handle hObj); 00220 GUI_COLOR MENU_GetTextColor (MENU_Handle hObj, unsigned ColorIndex); 00221 int MENU_GetUserData (MENU_Handle hObj, void * pDest, int NumBytes); 00222 void MENU_InsertItem (MENU_Handle hObj, U16 ItemId, const MENU_ITEM_DATA * pItemData); 00223 void MENU_Popup (MENU_Handle hObj, WM_HWIN hDestWin, int x, int y, int xSize, int ySize, int Flags); 00224 void MENU_SetBkColor (MENU_Handle hObj, unsigned ColorIndex, GUI_COLOR Color); 00225 void MENU_SetBorderSize (MENU_Handle hObj, unsigned BorderIndex, U8 BorderSize); 00226 void MENU_SetFont (MENU_Handle hObj, const GUI_FONT * pFont); 00227 void MENU_SetItem (MENU_Handle hObj, U16 ItemId, const MENU_ITEM_DATA * pItemData); 00228 void MENU_SetOwner (MENU_Handle hObj, WM_HWIN hOwner); 00229 int MENU_SetSel (MENU_Handle hObj, int Sel); 00230 void MENU_SetTextColor (MENU_Handle hObj, unsigned ColorIndex, GUI_COLOR Color); 00231 int MENU_SetUserData (MENU_Handle hObj, const void * pSrc, int NumBytes); 00232 00233 /********************************************************************* 00234 * 00235 * Managing default values 00236 * 00237 ********************************************************************** 00238 */ 00239 GUI_COLOR MENU_GetDefaultTextColor (unsigned ColorIndex); 00240 GUI_COLOR MENU_GetDefaultBkColor (unsigned ColorIndex); 00241 U8 MENU_GetDefaultBorderSize (unsigned BorderIndex); 00242 const WIDGET_EFFECT * MENU_GetDefaultEffect (void); 00243 const GUI_FONT * MENU_GetDefaultFont (void); 00244 void MENU_SetDefaultTextColor (unsigned ColorIndex, GUI_COLOR Color); 00245 void MENU_SetDefaultBkColor (unsigned ColorIndex, GUI_COLOR Color); 00246 void MENU_SetDefaultBorderSize (unsigned BorderIndex, U8 BorderSize); 00247 void MENU_SetDefaultEffect (const WIDGET_EFFECT * pEffect); 00248 void MENU_SetDefaultFont (const GUI_FONT * pFont); 00249 00250 /********************************************************************* 00251 * 00252 * Member functions: Skinning 00253 * 00254 ********************************************************************** 00255 */ 00256 int MENU_DrawSkinFlex (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo); 00257 void MENU_GetSkinFlexProps (MENU_SKINFLEX_PROPS * pProps, int Index); 00258 WIDGET_DRAW_ITEM_FUNC * MENU_SetDefaultSkin (WIDGET_DRAW_ITEM_FUNC * pfDrawSkin); 00259 void MENU_SetDefaultSkinClassic(void); 00260 void MENU_SetSkinClassic (MENU_Handle hObj); 00261 void MENU_SetSkin (MENU_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin); 00262 void MENU_SetSkinFlexProps (const MENU_SKINFLEX_PROPS * pProps, int Index); 00263 void MENU_SkinEnableArrow (MENU_Handle hObj, int OnOff); 00264 00265 #if defined(__cplusplus) 00266 } 00267 #endif 00268 00269 #endif // GUI_WINSUPPORT 00270 #endif // MENU_H 00271 00272 /*************************** End of file ****************************/
Generated on Mon Mar 4 2024 07:48:13 by 1.7.2