STM32F769IDiscovery  1.00
uDANTE Audio Networking with STM32F7 DISCO board
SPINBOX.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 : SPINBOX.h
30 Purpose : SPINBOX header file
31 --------------------END-OF-HEADER-------------------------------------
32 */
33 
34 #ifndef SPINBOX_H
35 #define SPINBOX_H
36 
37 #include "WM.h"
38 #include "DIALOG_Intern.h" // Required for Create indirect data structure
39 #include "WIDGET.h"
40 #include "GUI_Debug.h"
41 #include "EDIT.h"
42 
43 #if GUI_WINSUPPORT
44 
45 #if defined(__cplusplus)
46  extern "C" { // Make sure we have C-declarations in C++ programs
47 #endif
48 
49 /*********************************************************************
50 *
51 * Defines
52 *
53 **********************************************************************
54 */
55 /*********************************************************************
56 *
57 * States
58 */
59 #define SPINBOX_STATE_PRESSED(x) (U8)(1 << (U8)x) // These flags are stored in (SPINBOX_OBJ->State) | x must be 0 or 1
60 #define SPINBOX_STATE_FOCUS WIDGET_STATE_FOCUS // This is read from (SPINBOX_OBJ->Widget.State)
61 
62 #define SPINBOX_EDGE_RIGHT 0
63 #define SPINBOX_EDGE_LEFT 1
64 #define SPINBOX_EDGE_CENTER 2
65 
66 #define SPINBOX_EM_STEP 0
67 #define SPINBOX_EM_EDIT 1
68 
69 #ifndef SPINBOX_EM_DEFAULT
70  #define SPINBOX_EM_DEFAULT SPINBOX_EM_STEP
71 #endif
72 
73 /*********************************************************************
74 *
75 * Color indices
76 */
77 #define SPINBOX_CI_DISABLED EDIT_CI_DISABLED
78 #define SPINBOX_CI_ENABLED EDIT_CI_ENABLED
79 #define SPINBOX_CI_PRESSED 2
80 
81 /*********************************************************************
82 *
83 * Skinning property indices
84 */
85 #define SPINBOX_SKIN_FLEX SPINBOX_DrawSkinFlex
86 
87 #define SPINBOX_SKINFLEX_PI_PRESSED 0
88 #define SPINBOX_SKINFLEX_PI_FOCUSSED 1
89 #define SPINBOX_SKINFLEX_PI_ENABLED 2
90 #define SPINBOX_SKINFLEX_PI_DISABLED 3
91 #define SPINBOX_SKIN_FLEX_RADIUS 2
92 
93 /*********************************************************************
94 *
95 * Public Types
96 *
97 **********************************************************************
98 */
99 typedef WM_HMEM SPINBOX_Handle;
100 
101 typedef struct {
102  GUI_COLOR aColorFrame[2]; // [0] Outer color of surrounding frame. [1] Inner color of surrounding frame.
103  GUI_COLOR aColorUpper[2]; // [0] Upper color of gradient for upper button. [1] Lower color of gradient for upper button.
104  GUI_COLOR aColorLower[2]; // [0] Upper color of gradient for lower button. [1] Lower color of gradient for lower button.
105  GUI_COLOR ColorArrow; // Color of the button arrow.
106  GUI_COLOR ColorBk; // Color of the background. // See WIDGET_ITEM_CREATE in SPINBOX_DrawSkinFlex()
107  GUI_COLOR ColorText; // Color of the text. // See WIDGET_ITEM_CREATE in SPINBOX_DrawSkinFlex()
108  GUI_COLOR ColorButtonFrame; // Color of the button frame.
109 } SPINBOX_SKINFLEX_PROPS;
110 
111 /*********************************************************************
112 *
113 * Prototypes
114 *
115 **********************************************************************
116 */
117 /*********************************************************************
118 *
119 * Creation
120 */
121 SPINBOX_Handle SPINBOX_CreateEx (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int Id, int Min, int Max);
122 SPINBOX_Handle SPINBOX_CreateUser (int x0, int y0, int xSize, int ySize, WM_HWIN hParent, int WinFlags, int Id, int Min, int Max, int NumExtraBytes);
123 SPINBOX_Handle SPINBOX_CreateIndirect(const GUI_WIDGET_CREATE_INFO * pCreateInfo, WM_HWIN hWinParent, int x0, int y0, WM_CALLBACK * cb);
124 
125 /*********************************************************************
126 *
127 * Callback, should be called only from within a custom callback.
128 */
129 void SPINBOX_Callback(WM_MESSAGE * pMsg);
130 
131 /*********************************************************************
132 *
133 * Get / Set properties
134 */
135 void SPINBOX_EnableBlink (SPINBOX_Handle hObj, int Period, int OnOff);
136 GUI_COLOR SPINBOX_GetBkColor (SPINBOX_Handle hObj, unsigned int Index);
137 GUI_COLOR SPINBOX_GetButtonBkColor(SPINBOX_Handle hObj, unsigned int Index);
138 EDIT_Handle SPINBOX_GetEditHandle (SPINBOX_Handle hObj);
139 int SPINBOX_GetUserData (SPINBOX_Handle hObj, void * pDest, int NumBytes);
140 I32 SPINBOX_GetValue (SPINBOX_Handle hObj);
141 void SPINBOX_SetBkColor (SPINBOX_Handle hObj, unsigned int Index, GUI_COLOR Color);
142 void SPINBOX_SetButtonBkColor(SPINBOX_Handle hObj, unsigned int Index, GUI_COLOR Color);
143 void SPINBOX_SetButtonSize (SPINBOX_Handle hObj, unsigned ButtonSize);
144 void SPINBOX_SetEdge (SPINBOX_Handle hObj, U8 Edge);
145 void SPINBOX_SetEditMode (SPINBOX_Handle hObj, U8 EditMode);
146 void SPINBOX_SetFont (SPINBOX_Handle hObj, const GUI_FONT * pFont);
147 void SPINBOX_SetRange (SPINBOX_Handle hObj, I32 Min, I32 Max);
148 U16 SPINBOX_SetStep (SPINBOX_Handle hObj, U16 Step);
149 void SPINBOX_SetTextColor (SPINBOX_Handle hObj, unsigned int Index, GUI_COLOR Color);
150 int SPINBOX_SetUserData (SPINBOX_Handle hObj, const void * pSrc, int NumBytes);
151 void SPINBOX_SetValue (SPINBOX_Handle hObj, I32 Value);
152 
153 /*********************************************************************
154 *
155 * Default value management
156 */
157 U16 SPINBOX_GetDefaultButtonSize(void);
158 void SPINBOX_SetDefaultButtonSize(U16 ButtonSize);
159 
160 /*********************************************************************
161 *
162 * Skinning
163 */
164 void SPINBOX_GetSkinFlexProps (SPINBOX_SKINFLEX_PROPS * pProps, int Index);
165 void SPINBOX_SetSkinClassic (SPINBOX_Handle hObj);
166 void SPINBOX_SetSkin (SPINBOX_Handle hObj, WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
167 int SPINBOX_DrawSkinFlex (const WIDGET_ITEM_DRAW_INFO * pDrawItemInfo);
168 void SPINBOX_SetSkinFlexProps (const SPINBOX_SKINFLEX_PROPS * pProps, int Index);
169 void SPINBOX_SetDefaultSkinClassic(void);
170 WIDGET_DRAW_ITEM_FUNC * SPINBOX_SetDefaultSkin(WIDGET_DRAW_ITEM_FUNC * pfDrawSkin);
171 
172 #if defined(__cplusplus)
173  }
174 #endif
175 
176 #endif // GUI_WINSUPPORT
177 #endif // SPINBOX_H
178 
179 /*************************** End of file ****************************/
LCD_COLOR GUI_COLOR
Definition: GUI_Type.h:50
#define U16
Definition: Global.h:47
#define I32
Definition: Global.h:59
#define U8
Definition: Global.h:44