mGNCS4Touch API Reference  v1.5.0
A set of mGNCS-compliant controls for devices with a touch screen.
mpicker.h
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 /*
14  * \file mpicker.h
15  * \author miniStudio team of FMSoft
16  * \date 2010/10/09
17  *
18  \verbatim
19 
20  This file is part of mGNCS4Touch, one of MiniGUI components.
21 
22  Copyright (C) 2008-2018 FMSoft (http://www.fmsoft.cn).
23 
24  This program is free software: you can redistribute it and/or modify
25  it under the terms of the GNU General Public License as published by
26  the Free Software Foundation, either version 3 of the License, or
27  (at your option) any later version.
28 
29  This program is distributed in the hope that it will be useful,
30  but WITHOUT ANY WARRANTY; without even the implied warranty of
31  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32  GNU General Public License for more details.
33 
34  You should have received a copy of the GNU General Public License
35  along with this program. If not, see <http://www.gnu.org/licenses/>.
36 
37  Or,
38 
39  As this program is a library, any link to this program must follow
40  GNU General Public License version 3 (GPLv3). If you cannot accept
41  GPLv3, you need to be licensed from FMSoft.
42 
43  If you have got a commercial license of this program, please use it
44  under the terms and conditions of the commercial license.
45 
46  For more information about the commercial license, please refer to
47  <http://www.minigui.com/blog/minigui-licensing-policy/>.
48 
49  \endverbatim
50 */
51 
52 #ifndef __MGNCS4TOUCH_PCK_H__
53 #define __MGNCS4TOUCH_PCK_H__
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif /* __cplusplus */
58 
59 #define NCSCTRL_PICKER NCSCLASSNAME("picker")
60 
61 typedef struct _mPicker mPicker;
62 typedef struct _mPickerClass mPickerClass;
63 typedef struct _mPickerRenderer mPickerRenderer;
64 
65 #define mPickerHeader(clsName) \
66  mAnimationHeader(clsName) \
67  PRIVATE MGEFF_ANIMATION handle; \
68  PRIVATE HDC bkDC; \
69  PRIVATE float key; \
70  PRIVATE int mouseY; \
71  PRIVATE unsigned char itemAlign; \
72  PRIVATE unsigned int hMargin; \
73  PRIVATE unsigned int vMargin; \
74  PUBLIC unsigned int itemVisible; \
75  PUBLIC int maxValue; \
76  PUBLIC int minValue; \
77  PUBLIC unsigned int span; \
78  PUBLIC unsigned int numBits; \
79  PUBLIC unsigned int showBits; \
80  PUBLIC int selIdx;
81 
82 struct _mPicker {
83  mPickerHeader(mPicker)
84 };
85 
86 #define mPickerClassHeader(clsName, parentClass) \
87  mAnimationClassHeader(clsName, parentClass) \
88  PRIVATE void (*runAnimation)(clsName*, float startvalue, float endvalue); \
89  PRIVATE void (*endAnimation)(clsName*); \
90  PUBLIC BOOL (*addItem)(clsName*, int index, const char* string); \
91  PUBLIC BOOL (*addItems)(clsName*, const char** strings, int len); \
92  PUBLIC BOOL (*rmItem)(clsName*, int index); \
93  PUBLIC BOOL (*setRange)(clsName*, int min, int max); \
94  PUBLIC BOOL (*setSpan)(clsName*, int span); \
95  PUBLIC void (*enableItems)(clsName*, int idxFrom, int count); \
96  PUBLIC void (*disableItems)(clsName*, int idxFrom, int count);
97 
98 struct _mPickerClass {
99  mPickerClassHeader(mPicker, mAnimation)
100 };
101 
102 #define mPickerRendererHeader(clsName, parentClass) \
103  mAnimationRendererHeader(clsName, parentClass)
104 
105 struct _mPickerRenderer {
106  mPickerRendererHeader(mPicker, mAnimation)
107 };
108 
109 #define NCSS_PCK_NUMBER (0x01 << NCSS_ICONV_SHIFT)
110 #define NCSS_PCK_STRINGS (0x02 << NCSS_ICONV_SHIFT)
111 #define NCSS_PCK_LOOP (NCSS_ICONV_LOOP)
112 // left round corner
113 #define NCSS_PCK_LRC (0x04 << NCSS_ICONV_SHIFT)
114 // right round corner
115 #define NCSS_PCK_RRC (0x08 << NCSS_ICONV_SHIFT)
116 // both round corner
117 #define NCSS_PCK_BRC (0x10 << NCSS_ICONV_SHIFT)
118 
119 #define NCSS_PCK_SHIFT (NCSS_ICONV_SHIFT + 5)
120 
121 enum mPickerProp {
122  NCSP_PCK_ALIGN = NCSP_ICONV_MAX + 1,
123  NCSP_PCK_LINES,
124  NCSP_PCK_COUNT,
125  NCSP_PCK_SELIDX,
126  NCSP_PCK_HMARGIN,
127  NCSP_PCK_VMARGIN,
128  NCSP_PCK_NUMBERBITS,
129  NCSP_PCK_SHOWBERBITS,
130  NCSP_PCK_MAX
131 };
132 
133 enum mPickerNotify {
134  NCSN_PCK_SELCHANGED = NCSN_ICONV_MAX + 1,
135  NCSN_PCK_REACHMIN,
136  NCSN_PCK_REACHMAX,
137  NCSN_PCK_MAX
138 };
139 
140 MTOUCH_EXPORT extern mPickerClass g_stmPickerCls;
141 
142 #ifdef __cplusplus
143 }
144 #endif /* __cplusplus */
145 
146 #endif /* __MGNCS4TOUCH_PCK_H__ */
147 
mAnimation