STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
BUTTON.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 : BUTTON.h
30 Purpose : BUTTON public header file (API)
31 --------------------END-OF-HEADER-------------------------------------
32 */
33 
34 #ifndef BUTTON_H
35 #define BUTTON_H
36 
37 #include "WM.h"
38 #include "DIALOG_Intern.h" /* Req. for Create indirect data structure */
39 #include "WIDGET.h"
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 * Create flags
50 */
51 /* For compatibility only ! */
52 #define BUTTON_CF_HIDE WM_CF_HIDE
53 #define BUTTON_CF_SHOW WM_CF_SHOW
54 #define BUTTON_CF_MEMDEV WM_CF_MEMDEV
55 
56 /*********************************************************************
57 *
58 * Color indices
59 */
60 #define BUTTON_CI_UNPRESSED 0
61 #define BUTTON_CI_PRESSED 1
62 #define BUTTON_CI_DISABLED 2
63 
64 /*********************************************************************
65 *
66 * Bitmap indices
67 */
68 #define BUTTON_BI_UNPRESSED 0
69 #define BUTTON_BI_PRESSED 1
70 #define BUTTON_BI_DISABLED 2
71 
72 /*********************************************************************
73 *
74 * States
75 */
76 #define BUTTON_STATE_FOCUS WIDGET_STATE_FOCUS
77 #define BUTTON_STATE_PRESSED WIDGET_STATE_USER0
78 
79 /*********************************************************************
80 *
81 * Skinning property indices
82 */
83 #define BUTTON_SKINFLEX_PI_PRESSED 0
84 #define BUTTON_SKINFLEX_PI_FOCUSSED 1
85 #define BUTTON_SKINFLEX_PI_ENABLED 2
86 #define BUTTON_SKINFLEX_PI_DISABLED 3
87 
88 /*********************************************************************
89 *
90 * Types
91 *
92 **********************************************************************
93 */
94 typedef WM_HMEM BUTTON_Handle;
95 
96 typedef struct {
97  GUI_COLOR aColorFrame[3];
98  GUI_COLOR aColorUpper[2];
99  GUI_COLOR aColorLower[2];
100  int Radius;
101 } BUTTON_SKINFLEX_PROPS;
102 
103 /*********************************************************************
104 *
105 * Create function(s)
106 
107  Note: the parameters to a create function may vary.
108  Some widgets may have multiple create functions
109 */
110 
111 BUTTON_Handle BUTTON_Create (int x0, int y0, int xSize, int ySize, int ID, int Flags);
112 BUTTON_Handle BUTTON_CreateAsChild (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int Id, int Flags);
113 BUTTON_Handle BUTTON_CreateEx (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id);
114 BUTTON_Handle BUTTON_CreateUser (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int ExFlags, int Id, int NumExtraBytes);
115 BUTTON_Handle BUTTON_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb);
116 
117 /*********************************************************************
118 *
119 * Standard member functions
120 *
121 **********************************************************************
122 */
123 GUI_COLOR BUTTON_GetDefaultBkColor (unsigned Index);
124 const GUI_FONT * BUTTON_GetDefaultFont (void);
125 int BUTTON_GetDefaultTextAlign (void);
126 GUI_COLOR BUTTON_GetDefaultTextColor (unsigned Index);
127 void BUTTON_SetDefaultBkColor (GUI_COLOR Color, unsigned Index);
128 GUI_COLOR BUTTON_SetDefaultFocusColor(GUI_COLOR Color);
129 void BUTTON_SetDefaultFont (const GUI_FONT * pFont);
130 void BUTTON_SetDefaultTextAlign (int Align);
131 void BUTTON_SetDefaultTextColor (GUI_COLOR Color, unsigned Index);
132 
133 #define BUTTON_EnableMemdev(hObj) WM_EnableMemdev (hObj)
134 #define BUTTON_DisableMemdev(hObj) WM_DisableMemdev (hObj)
135 #define BUTTON_Delete(hObj) WM_DeleteWindow (hObj)
136 #define BUTTON_Paint(hObj) WM_Paint (hObj)
137 #define BUTTON_Invalidate(hObj) WM_InvalidateWindow(hObj)
138 
139 /*********************************************************************
140 *
141 * The callback ...
142 *
143 * Do not call it directly ! It is only to be used from within an
144 * overwritten callback.
145 */
146 void BUTTON_Callback(WM_MESSAGE *pMsg);
147 
148 /*********************************************************************
149 *
150 * Member functions
151 *
152 **********************************************************************
153 */
154 GUI_COLOR BUTTON_GetBkColor (BUTTON_Handle hObj, unsigned int Index);
155 const GUI_BITMAP * BUTTON_GetBitmap(BUTTON_Handle hObj,unsigned int Index);
156 const GUI_FONT * BUTTON_GetFont (BUTTON_Handle hObj);
157 GUI_COLOR BUTTON_GetFrameColor (BUTTON_Handle hObj);
158 WIDGET * BUTTON_GetpWidget (BUTTON_Handle hObj);
159 void BUTTON_GetText (BUTTON_Handle hObj, char * pBuffer, int MaxLen);
160 GUI_COLOR BUTTON_GetTextColor (BUTTON_Handle hObj, unsigned int Index);
161 int BUTTON_GetTextAlign (BUTTON_Handle hObj);
162 int BUTTON_GetUserData (BUTTON_Handle hObj, void * pDest, int NumBytes);
163 unsigned BUTTON_IsPressed (BUTTON_Handle hObj);
164 void BUTTON_SetBitmap (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap);
165 void BUTTON_SetBitmapEx (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap, int x, int y);
166 void BUTTON_SetBkColor (BUTTON_Handle hObj, unsigned int Index, GUI_COLOR Color);
167 void BUTTON_SetBMP (BUTTON_Handle hObj, unsigned int Index, const void * pBitmap);
168 void BUTTON_SetBMPEx (BUTTON_Handle hObj, unsigned int Index, const void * pBitmap, int x, int y);
169 void BUTTON_SetFont (BUTTON_Handle hObj, const GUI_FONT * pfont);
170 void BUTTON_SetFrameColor (BUTTON_Handle hObj, GUI_COLOR Color);
171 void BUTTON_SetState (BUTTON_Handle hObj, int State); /* Not to be doc. */
172 void BUTTON_SetPressed (BUTTON_Handle hObj, int State);
173 GUI_COLOR BUTTON_SetFocusColor (BUTTON_Handle hObj, GUI_COLOR Color);
174 void BUTTON_SetFocussable (BUTTON_Handle hObj, int State);
175 void BUTTON_SetStreamedBitmap (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP_STREAM * pBitmap);
176 void BUTTON_SetStreamedBitmapEx(BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP_STREAM * pBitmap, int x, int y);
177 int BUTTON_SetText (BUTTON_Handle hObj, const char* s);
178 void BUTTON_SetTextAlign (BUTTON_Handle hObj, int Align);
179 void BUTTON_SetTextColor (BUTTON_Handle hObj, unsigned int Index, GUI_COLOR Color);
180 void BUTTON_SetTextOffset (BUTTON_Handle hObj, int xPos, int yPos);
181 void BUTTON_SetSelfDrawEx (BUTTON_Handle hObj, unsigned int Index, GUI_DRAW_SELF_CB * pDraw, int x, int y); /* Not to be doc. */
182 void BUTTON_SetSelfDraw (BUTTON_Handle hObj, unsigned int Index, GUI_DRAW_SELF_CB * pDraw); /* Not to be doc. */
183 void BUTTON_SetReactOnLevel (void);
184 void BUTTON_SetReactOnTouch (void);
185 int BUTTON_SetUserData (BUTTON_Handle hObj, const void * pSrc, int NumBytes);
186 
187 /*********************************************************************
188 *
189 * Member functions: Skinning
190 *
191 **********************************************************************
192 */
193 void BUTTON_GetSkinFlexProps (BUTTON_SKINFLEX_PROPS * pProps, int Index);
194 void BUTTON_SetSkinClassic (BUTTON_Handle hObj);
195 void BUTTON_SetSkin (BUTTON_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
196 int BUTTON_DrawSkinFlex (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
197 void BUTTON_SetSkinFlexProps (const BUTTON_SKINFLEX_PROPS * pProps, int Index);
198 void BUTTON_SetDefaultSkinClassic(void);
199 WIDGET_DRAW_ITEM_FUNC * BUTTON_SetDefaultSkin(WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
200 
201 #define BUTTON_SKIN_FLEX BUTTON_DrawSkinFlex
202 
203 #if defined(__cplusplus)
204  }
205 #endif
206 
207 #endif // GUI_WINSUPPORT
208 #endif // BUTTON_H
209 
210 /*************************** End of file ****************************/
LCD_COLOR GUI_COLOR
Definition: GUI_Type.h:50