mGNCS API Reference  v1.5.0
A new control set and a new framework for MiniGUI apps
mlist_layout.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 
55 #ifndef _MGUI_WIDGET_LAYOUT_H
56 #define _MGUI_WIDGET_LAYOUT_H
57 
58 #ifdef _MGNCSCTRL_LIST
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif /* __cplusplus */
63 
69 typedef struct _mListLayout mListLayout;
70 typedef struct _mListLayoutClass mListLayoutClass;
71 
72 #define mListLayoutHeader(className)\
73  mObjectHeader(className) \
74  mAbstractList *list; \
75  Uint16 itemHeight; \
76  Uint16 itemWidth;
77 
78 struct _mListLayout
79 {
80  mListLayoutHeader(mListLayout)
81 };
82 
83 #define mListLayoutClassHeader(clsName, superCls) \
84  mObjectClassHeader(clsName, superCls) \
85  BOOL (*setProperty)(clsName*, int id, DWORD value); \
86  DWORD (*getProperty)(clsName*, int id); \
87  mNode* (*onDirKey)(clsName*,mNode* refNode, int direct);\
88  mNode* (*onMouseHit)(clsName*, int mouseX, int mouseY); \
89  int (*getNodeRect)(clsName*, mNode *node, RECT *rcNode);\
90  BOOL (*recalcContSize)(clsName*, int flags); \
91  void (*init)(clsName*, mAbstractList *list, int defItemW, int defItemH);\
92  void (*update)(clsName*, HDC hdc, const RECT* rcVis, RECT *rcCont); \
93  void (*nodeEvent)(clsName*, int eventId, DWORD eventInfo);
94 
95 struct _mListLayoutClass
96 {
97  mListLayoutClassHeader(mListLayout, mObject)
98 };
99 
100 enum mListLayoutStatus
101 {
102  NCSF_LIST_LAYOUT_ITEMHCHANGED = 0x01,
103  NCSF_LIST_LAYOUT_ITEMWCHANGED = 0x02,
104 };
105 
110 enum mListLayoutProp
111 {
112 
113  NCSP_LIST_LAYOUT_DEFITEMHEIGHT = 10,//RW
114  NCSP_LIST_LAYOUT_DEFITEMWIDTH, //RW
118  NCSP_LIST_LAYOUT_MAX,
119 };
120 
127 MGNCS_EXPORT extern mListLayoutClass g_stmListLayoutCls;
128 
131 /*=========================================================*/
132 typedef struct _mLVIconLayout mLVIconLayout;
133 typedef struct _mLVIconLayoutClass mLVIconLayoutClass;
134 
135 #define mLVIconLayoutHeader(className) \
136  mListLayoutHeader(className) \
137  int nrCol;
138 
139 struct _mLVIconLayout
140 {
141  mLVIconLayoutHeader(mLVIconLayout)
142 };
143 
144 #define mLVIconLayoutClassHeader(clsName, superCls) \
145  mListLayoutClassHeader(clsName, superCls)
146 
147 struct _mLVIconLayoutClass
148 {
149  mLVIconLayoutClassHeader(mLVIconLayout, mListLayout)
150 };
151 
152 MGNCS_EXPORT extern mLVIconLayoutClass g_stmLVIconLayoutCls;
153 
154 /*=========================================================*/
155 typedef struct _mLHIconLayout mLHIconLayout;
156 typedef struct _mLHIconLayoutClass mLHIconLayoutClass;
157 
158 #define mLHIconLayoutHeader(className) \
159  mListLayoutHeader(className) \
160  Uint16 nrRow;
161 
162 struct _mLHIconLayout
163 {
164  mLHIconLayoutHeader(mLHIconLayout)
165 };
166 
167 #define mLHIconLayoutClassHeader(clsName, superCls) \
168  mListLayoutClassHeader(clsName, superCls)
169 
170 struct _mLHIconLayoutClass
171 {
172  mLHIconLayoutClassHeader(mLHIconLayout, mListLayout)
173 };
174 
175 MGNCS_EXPORT extern mLHIconLayoutClass g_stmLHIconLayoutCls;
176 
177 /*=========================================================*/
178 typedef struct _mLHCenterBoxLayout mLHCenterBoxLayout;
179 typedef struct _mLHCenterBoxLayoutClass mLHCenterBoxLayoutClass;
180 
181 #define mLHCenterBoxLayoutHeader(className) \
182  mLHIconLayoutHeader(className) \
183  int offx;
184 
185 struct _mLHCenterBoxLayout
186 {
187  mLHCenterBoxLayoutHeader(mLHIconLayout)
188 };
189 
190 #define mLHCenterBoxLayoutClassHeader(clsName, superCls) \
191  mLHIconLayoutClassHeader(clsName, superCls)
192 
193 struct _mLHCenterBoxLayoutClass
194 {
195  mLHCenterBoxLayoutClassHeader(mLHCenterBoxLayout, mLHIconLayout)
196 };
197 
202 enum mLHCenterBoxLayoutProp
203 {
207  NCSP_HCBOX_LAYOUT_OFFX = NCSP_LIST_LAYOUT_MAX + 1, //RO
211  NCSP_HCBOX_LAYOUT_MAX,
212 };
213 
214 MGNCS_EXPORT extern mLHCenterBoxLayoutClass g_stmLHCenterBoxLayoutCls;
215 
216 /*=========================================================*/
217 typedef struct _NCS_GROUP_INFO
218 {
219  int id;
220  char *text;
221  DWORD addData;
222 }NCS_GROUP_INFO;
223 
224 typedef struct _mLGroupLayout mLGroupLayout;
225 typedef struct _mLGroupLayoutClass mLGroupLayoutClass;
226 
227 #define NCSID_UNNAMED_GROUP 0
228 #define NCSID_UNNAMED_GROUPTEXT "Unnamed"
229 //return group id, if no group return NCSID_UNNAMED_GROUP
230 typedef int (*NCS_CB_INGROUP)(mNode *node);
231 
232 #define mLGroupLayoutHeader(className) \
233  mLVIconLayoutHeader(className) \
234  NCS_CB_CMPNODE cbCmpNode; \
235  NCS_CB_CMPNODE cbCmpGroup; \
236  NCS_CB_INGROUP cbInGroup; \
237  BOOL defaultGroup; \
238  mNode *groupRoot; \
239  int defGroupH;
240 
241 struct _mLGroupLayout
242 {
243  mLGroupLayoutHeader(mLGroupLayout)
244 };
245 
246 #define mLGroupLayoutClassHeader(clsName, superCls) \
247  mLVIconLayoutClassHeader(clsName, superCls) \
248  void (*setGroupInfo)(clsName*, NCS_CB_INGROUP inGroup, NCS_GROUP_INFO *groupInfo, int groupSize);\
249  NCS_CB_CMPNODE (*decorateNodeCmp)(clsName*, NCS_CB_CMPNODE func); \
250  NCS_CB_INGROUP (*setInGroupFunc)(clsName*, NCS_CB_INGROUP func); \
251  BOOL (*resetGroup)(clsName*, NCS_GROUP_INFO *groupInfo, int groupSize);
252 
253 struct _mLGroupLayoutClass
254 {
255  mLGroupLayoutClassHeader(mLGroupLayout, mLVIconLayout)
256 };
257 
258 
263 enum mLGroupLayoutProp
264 {
265 
266  NCSP_LGROUP_LAYOUT_NODECMPFUNC = NCSP_LIST_LAYOUT_MAX + 1, //RO
267 
268  NCSP_LGROUP_LAYOUT_GROUPCMPFUNC,//RW
272  NCSP_LGROUP_LAYOUT_MAX,
273 };
274 
275 MGNCS_EXPORT extern mLGroupLayoutClass g_stmLGroupLayoutCls;
276 
277 #ifdef __cplusplus
278 }
279 #endif /* __cplusplus */
280 
281 #endif /* _MGUI_WIDGET_LAYOUT_H */
282 #endif //_MGNCSCTRL_LIST
283 
mObject
the Object struct
mNode
The structure of mNode. It is the basic class of all nodes occur within specific controls....