STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
MENU.h
Go to the documentation of this file.
1 /*********************************************************************
2 * SEGGER Microcontroller GmbH & Co. KG *
3 * Solutions for real time microcontroller applications *
4 **********************************************************************
5 * *
6 * (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
7 * *
8 * Internet: www.segger.com Support: support@segger.com *
9 * *
10 **********************************************************************
11 
12 ** emWin V5.28 - Graphical user interface for embedded applications **
13 All Intellectual Property rights in the Software belongs to SEGGER.
14 emWin is protected by international copyright laws. Knowledge of the
15 source code may not be used to write a similar product. This file may
16 only be used in accordance with the following terms:
17 
18 The software has been licensed to STMicroelectronics International
19 N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
20 les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
21 purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
22 troller products commercialized by Licensee only, sublicensed and dis_
23 tributed under the terms and conditions of the End User License Agree_
24 ment supplied by STMicroelectronics International N.V.
25 Full source code is available at: www.segger.com
26 
27 We appreciate your understanding and fairness.
28 ----------------------------------------------------------------------
29 File : MENU.h
30 Purpose : MENU include
31 --------------------END-OF-HEADER-------------------------------------
32 */
33 
34 #ifndef MENU_H
35 #define MENU_H
36 
37 #include "WM.h"
38 #include "WIDGET.h"
39 #include "DIALOG_Intern.h" // Required for Create indirect data structure
40 
41 #if GUI_WINSUPPORT
42 
43 #if defined(__cplusplus)
44  extern "C" { // Make sure we have C-declarations in C++ programs
45 #endif
46 
47 /*********************************************************************
48 *
49 * Defines
50 *
51 **********************************************************************
52 */
53 #define MENU_SKIN_FLEX MENU_DrawSkinFlex
54 
55 /*********************************************************************
56 *
57 * Create flags
58 */
59 #define MENU_CF_HORIZONTAL (0<<0)
60 #define MENU_CF_VERTICAL (1<<0)
61 #define MENU_CF_OPEN_ON_POINTEROVER (1<<1) // Normally a menu opens first when clicked on it
62 #define MENU_CF_CLOSE_ON_SECOND_CLICK (1<<2) // Normally a menu closes only when clicked outside it
63 #define MENU_CF_HIDE_DISABLED_SEL (1<<3) // Hides the selection when a disabled item is selected
64 
65 /*********************************************************************
66 *
67 * Menu item flags
68 */
69 #define MENU_IF_DISABLED (1<<0) // Indicates that item is disabled
70 #define MENU_IF_SEPARATOR (1<<1) // Indicates that item is a separator
71 
72 /*********************************************************************
73 *
74 * Color indices
75 */
76 #define MENU_CI_ENABLED 0
77 #define MENU_CI_SELECTED 1
78 #define MENU_CI_DISABLED 2
79 #define MENU_CI_DISABLED_SEL 3
80 #define MENU_CI_ACTIVE_SUBMENU 4
81 
82 /*********************************************************************
83 *
84 * Border indices
85 */
86 #define MENU_BI_LEFT 0
87 #define MENU_BI_RIGHT 1
88 #define MENU_BI_TOP 2
89 #define MENU_BI_BOTTOM 3
90 
91 /*********************************************************************
92 *
93 * Message types
94 */
95 #define MENU_ON_ITEMSELECT 0 // Send to owner when selecting a menu item
96 #define MENU_ON_INITMENU 1 // Send to owner when for the first time selecting a submenu
97 #define MENU_ON_INITSUBMENU 2 // Send to owner when selecting a submenu
98 #define MENU_ON_OPEN 3 // Internal message of menu widget (only send to submenus)
99 #define MENU_ON_CLOSE 4 // Internal message of menu widget (only send to submenus)
100 #define MENU_IS_MENU 5 // Internal message of menu widget. Owner must call
101  // WM_DefaultProc() when not handle the message
102 #define MENU_ON_ITEMACTIVATE 6 // Send to owner when highlighting a menu item
103 #define MENU_ON_ITEMPRESSED 7 // Send to owner when a menu item has been pressed
104 
105 /*********************************************************************
106 *
107 * Skinning property indices
108 */
109 #define MENU_SKINFLEX_PI_ENABLED 0
110 #define MENU_SKINFLEX_PI_SELECTED 1
111 #define MENU_SKINFLEX_PI_DISABLED 2
112 #define MENU_SKINFLEX_PI_DISABLED_SEL 3
113 #define MENU_SKINFLEX_PI_ACTIVE_SUBMENU 4
114 
115 /*********************************************************************
116 *
117 * Types
118 *
119 **********************************************************************
120 */
121 
122 typedef WM_HMEM MENU_Handle;
123 
124 typedef struct {
125  //
126  // Background
127  //
128  GUI_COLOR aBkColorH[2];
129  GUI_COLOR BkColorV;
130  GUI_COLOR FrameColorH;
131  GUI_COLOR FrameColorV;
132  //
133  // Selection
134  //
135  GUI_COLOR aSelColorH[2];
136  GUI_COLOR aSelColorV[2];
137  GUI_COLOR FrameColorSelH;
138  GUI_COLOR FrameColorSelV;
139  //
140  // Separator
141  //
142  GUI_COLOR aSepColorH[2];
143  GUI_COLOR aSepColorV[2];
144  //
145  // Arrow
146  //
147  GUI_COLOR ArrowColor;
148  //
149  // Text
150  //
151  GUI_COLOR TextColor;
152 } MENU_SKINFLEX_PROPS;
153 
154 /*********************************************************************
155 *
156 * Menu message data
157 */
158 typedef struct {
159  U16 MsgType;
160  U16 ItemId;
161 } MENU_MSG_DATA;
162 
163 /*********************************************************************
164 *
165 * Menu item data
166 */
167 typedef struct {
168  const char * pText;
169  U16 Id;
170  U16 Flags;
171  MENU_Handle hSubmenu;
172 } MENU_ITEM_DATA;
173 
174 /*********************************************************************
175 *
176 * Create functions
177 *
178 **********************************************************************
179 */
180 MENU_Handle MENU_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb);
181 MENU_Handle MENU_CreateEx (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id);
182 MENU_Handle MENU_CreateUser (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int NumExtraBytes);
183 
184 /*********************************************************************
185 *
186 * The callback ...
187 *
188 * Do not call it directly ! It is only to be used from within an
189 * overwritten callback.
190 */
191 void MENU_Callback(WM_MESSAGE * pMsg);
192 
193 /*********************************************************************
194 *
195 * Standard member functions
196 *
197 **********************************************************************
198 */
199 #define MENU_EnableMemdev(hObj) WM_EnableMemdev(hObj)
200 #define MENU_DisableMemdev(hObj) WM_DisableMemdev(hObj)
201 #define MENU_Delete(hObj) WM_DeleteWindow(hObj)
202 #define MENU_Paint(hObj) WM_Paint(hObj)
203 #define MENU_Invalidate(hObj) WM_InvalidateWindow(hObj)
204 
205 /*********************************************************************
206 *
207 * Individual member functions
208 *
209 **********************************************************************
210 */
211 void MENU_AddItem (MENU_Handle hObj, const MENU_ITEM_DATA * pItemData);
212 void MENU_Attach (MENU_Handle hObj, WM_HWIN hDestWin, int x, int y, int xSize, int ySize, int Flags);
213 void MENU_DeleteItem (MENU_Handle hObj, U16 ItemId);
214 void MENU_DisableItem (MENU_Handle hObj, U16 ItemId);
215 void MENU_EnableItem (MENU_Handle hObj, U16 ItemId);
216 void MENU_GetItem (MENU_Handle hObj, U16 ItemId, MENU_ITEM_DATA * pItemData);
217 void MENU_GetItemText (MENU_Handle hObj, U16 ItemId, char * pBuffer, unsigned BufferSize);
218 unsigned MENU_GetNumItems (MENU_Handle hObj);
219 WM_HWIN MENU_GetOwner (MENU_Handle hObj);
220 int MENU_GetUserData (MENU_Handle hObj, void * pDest, int NumBytes);
221 void MENU_InsertItem (MENU_Handle hObj, U16 ItemId, const MENU_ITEM_DATA * pItemData);
222 void MENU_Popup (MENU_Handle hObj, WM_HWIN hDestWin, int x, int y, int xSize, int ySize, int Flags);
223 void MENU_SetBkColor (MENU_Handle hObj, unsigned ColorIndex, GUI_COLOR Color);
224 void MENU_SetBorderSize(MENU_Handle hObj, unsigned BorderIndex, U8 BorderSize);
225 void MENU_SetFont (MENU_Handle hObj, const GUI_FONT * pFont);
226 void MENU_SetItem (MENU_Handle hObj, U16 ItemId, const MENU_ITEM_DATA * pItemData);
227 void MENU_SetOwner (MENU_Handle hObj, WM_HWIN hOwner);
228 int MENU_SetSel (MENU_Handle hObj, int Sel);
229 void MENU_SetTextColor (MENU_Handle hObj, unsigned ColorIndex, GUI_COLOR Color);
230 int MENU_SetUserData (MENU_Handle hObj, const void * pSrc, int NumBytes);
231 
232 /*********************************************************************
233 *
234 * Member functions, get / set defaults
235 *
236 **********************************************************************
237 */
238 GUI_COLOR MENU_GetDefaultTextColor (unsigned ColorIndex);
239 GUI_COLOR MENU_GetDefaultBkColor (unsigned ColorIndex);
240 U8 MENU_GetDefaultBorderSize (unsigned BorderIndex);
241 const WIDGET_EFFECT * MENU_GetDefaultEffect (void);
242 const GUI_FONT * MENU_GetDefaultFont (void);
243 void MENU_SetDefaultTextColor (unsigned ColorIndex, GUI_COLOR Color);
244 void MENU_SetDefaultBkColor (unsigned ColorIndex, GUI_COLOR Color);
245 void MENU_SetDefaultBorderSize (unsigned BorderIndex, U8 BorderSize);
246 void MENU_SetDefaultEffect (const WIDGET_EFFECT * pEffect);
247 void MENU_SetDefaultFont (const GUI_FONT * pFont);
248 
249 /*********************************************************************
250 *
251 * Member functions: Skinning
252 *
253 **********************************************************************
254 */
255 int MENU_DrawSkinFlex (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
256 void MENU_GetSkinFlexProps (MENU_SKINFLEX_PROPS * pProps, int Index);
257 WIDGET_DRAW_ITEM_FUNC * MENU_SetDefaultSkin (WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
258 void MENU_SetDefaultSkinClassic(void);
259 void MENU_SetSkinClassic (MENU_Handle hObj);
260 void MENU_SetSkin (MENU_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
261 void MENU_SetSkinFlexProps (const MENU_SKINFLEX_PROPS * pProps, int Index);
262 void MENU_SkinEnableArrow (MENU_Handle hObj, int OnOff);
263 
264 #if defined(__cplusplus)
265  }
266 #endif
267 
268 #endif // GUI_WINSUPPORT
269 #endif // MENU_H
270 
271 /*************************** End of file ****************************/
LCD_COLOR GUI_COLOR
Definition: GUI_Type.h:50
#define U16
Definition: Global.h:47
#define U8
Definition: Global.h:44