mGNCS API Reference  v1.5.0
A new control set and a new framework for MiniGUI apps
mspinbox.h
Go to the documentation of this file.
1 //
3 // IMPORTANT NOTICE
4 //
5 // The following open source license statement does not apply to any
6 // entity in the Exception List published by FMSoft.
7 //
8 // For more information, please visit:
9 //
10 // https://www.fmsoft.cn/exception-list
11 //
13 
54 #ifdef _MGNCSCTRL_SPINBOX
55 
56 #ifndef _MGUI_NCSCTRL_SPINBOX_H
57 #define _MGUI_NCSCTRL_SPINBOX_H
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif /* __cplusplus */
62 
68 /*
69  * \def NCSCTRL_SPINBOX
70  * \brief the name of spinbox control
71 */
72 #define NCSCTRL_SPINBOX NCSCLASSNAME("spinbox")
73 
74 #define NCS_LEN_SPINBOX 63
75 
76 typedef struct _mSpinBox mSpinBox;
77 typedef struct _mSpinBoxClass mSpinBoxClass;
78 typedef struct _mSpinBoxRenderer mSpinBoxRenderer;
79 
80 typedef struct _mSpinBoxItemInfo mSpinBoxItemInfo;
81 #define mSpinBoxHeader(clsName) \
82  mSpinnerHeader(clsName) \
83  union { \
84  char* num_format; \
85  mSpinBoxItemInfo *items; \
86  }info;
87 
94 struct _mSpinBox
95 {
96  mSpinBoxHeader(mSpinBox)
97 };
98 
99 #define mSpinBoxClassHeader(clsName, parentClass) \
100  mSpinnerClassHeader(clsName, parentClass) \
101  BOOL (*addItem)(clsName *self, char *item); \
102  BOOL (*removeItem)(clsName *self, int index); \
103  BOOL (*setItem)(clsName *self, int index, char *item); \
104  char* (*getItem)(clsName *self, int index);
105 
130 struct _mSpinBoxClass
131 {
132  mSpinBoxClassHeader(mSpinBox, mSpinner)
133 };
134 
135 MGNCS_EXPORT extern mSpinBoxClass g_stmSpinBoxCls;
136 
137 #define mSpinBoxRendererHeader(clsName, parentClass) \
138  mSpinnerRendererHeader(clsName, parentClass)
139 
146 struct _mSpinBoxRenderer
147 {
148  mSpinBoxRendererHeader(mSpinBox, mSpinner)
149 };
150 
152 enum mSpinBoxProp {
153  NCSP_SPNBOX_MAXPOS = NCSP_SPNR_MAXPOS,
154  NCSP_SPNBOX_MINPOS = NCSP_SPNR_MINPOS,
155  NCSP_SPNBOX_CURPOS = NCSP_SPNR_CURPOS,
156  NCSP_SPNBOX_LINESTEP = NCSP_SPNR_LINESTEP,
157  NCSP_SPNBOX_MAX = NCSP_SPNR_MAX
158 };
159 
160 
165 #define NCSS_SPNBOX_VERTICAL (NCSS_SPNR_VERTICAL)
166 
171 #define NCSS_SPNBOX_HORIZONTAL (NCSS_SPNR_HORIZONTAL)
172 
177 #define NCSS_SPNBOX_AUTOLOOP (NCSS_SPNR_AUTOLOOP)
178 
183 #define NCSS_SPNBOX_NUMBER (0x0000L<<NCSS_SPNR_SHIFT)
184 
189 #define NCSS_SPNBOX_STRING (0x0001L<<NCSS_SPNR_SHIFT)
190 
195 #define NCSS_SPNBOX_SORT (0x0002L<<NCSS_SPNR_SHIFT)
196 
201 #define NCSS_SPNBOX_EDITNOBORDER (0x0004L<<NCSS_SPNR_SHIFT)
202 
207 #define NCSS_SPNBOX_EDITBASELINE (0x0008L<<NCSS_SPNR_SHIFT)
208 
213 #define NCSS_SPNBOX_READONLY (0x0010L<<NCSS_SPNR_SHIFT)
214 
219 #define NCSS_SPNBOX_UPPERCASE (0x0020L<<NCSS_SPNR_SHIFT)
220 
225 #define NCSS_SPNBOX_LOWERCASE (0x0040L<<NCSS_SPNR_SHIFT)
226 
231 #define NCSS_SPNBOX_AUTOFOCUS (0x0080L<<NCSS_SPNR_SHIFT)
232 
233 #define NCSS_SPNBOX_SHIFT (NCSS_SPNR_SHIFT + 9)
234 
235 
237 enum mSpinBoxNotify {
238  NCSN_SPNBOX_CHANGED = NCSN_SPNR_CHANGED,
239  NCSN_SPNBOX_REACHMAX = NCSN_SPNR_REACHMAX,
240  NCSN_SPNBOX_REACHMIN = NCSN_SPNR_REACHMIN,
241  NCSN_SPNBOX_MAX = NCSN_SPNR_MAX
242 };
243 
247 
248 #define NCSST_SPNBOX_NORMAL 0x0000
249 #define NCSST_SPNBOX_DISABLE 0x0001
250 #define NCSST_SPNBOX_HILIGHT 0x0002
251 #define NCSST_SPNBOX_PUSHED 0x0004
252 
255 #ifdef __cplusplus
256 }
257 #endif /* __cplusplus */
258 
259 #endif /* _MGUI_NCSCTRL_SPINBOX_H */
260 #endif //_MGNCSCTRL_SPINBOX