mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
mlistbox.h
Go to the documentation of this file.
1 
42 #ifdef _MGNCSCTRL_LISTBOX
43 
44 #ifndef _MGUI_CTRL_LSTBOX_H
45 #define _MGUI_CTRL_LSTBOX_H
46 
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif /* __cplusplus */
51 
52 #include "mitem.h"
53 #include "mitem_manager.h"
54 #include "mitemview.h"
63 typedef struct _NCS_LSTBOX_ITEMINFO
64 {
68  char* string;
69 
85  DWORD flag;
86 
90  DWORD image;
91 
95  DWORD addData;
96 }NCS_LSTBOX_ITEMINFO;
97 
98 typedef struct _mListBox mListBox;
99 typedef struct _mListBoxClass mListBoxClass;
100 typedef struct _mListBoxRenderer mListBoxRenderer;
101 
106 #define NCSCTRL_LISTBOX NCSCLASSNAME("listbox")
107 
112 #define NCSS_LSTBOX_SHIFT (NCSS_ITEMV_SHIFT+4)
113 
118 #define NCSS_LSTBOX_SINGLE NCSS_ITEMV_SINGLE
119 
124 #define NCSS_LSTBOX_MULTIPLE NCSS_ITEMV_MULTIPLE
125 
130 #define NCSS_LSTBOX_SORT NCSS_ITEMV_AUTOSORT
131 
137 #define NCSS_LSTBOX_MOUSEFOLLOW (0x0001<<NCSS_ITEMV_SHIFT)
138 
143 #define NCSS_LSTBOX_STRING (0x0000<<NCSS_ITEMV_SHIFT)
144 
149 #define NCSS_LSTBOX_USEBITMAP (0x0002<<NCSS_ITEMV_SHIFT)
150 
155 #define NCSS_LSTBOX_CHECKBOX (0x0004<<NCSS_ITEMV_SHIFT)
156 
162 #define NCSS_LSTBOX_AUTOCHECK (0x0008<<NCSS_ITEMV_SHIFT)
163 
168 #define NCSS_LSTBOX_AUTOCHECKBOX \
169  (NCSS_LSTBOX_CHECKBOX | NCSS_LSTBOX_AUTOCHECK)
170 
171 //for list flags
172 #define NCSF_LSTBOX_SHIFT (NCSF_ITEM_SHIFT + 4)
173 
174 /* check mark, for NCSS_LSTBOX_CHECKBOX*/
179 #define NCSF_LSTBOX_CMBLANK (0x0000<<NCSF_ITEM_SHIFT)
180 
185 #define NCSF_LSTBOX_CMCHECKED (0x0001<<NCSF_ITEM_SHIFT)
186 
191 #define NCSF_LSTBOX_CMPARTCHECKED (0x0002<<NCSF_ITEM_SHIFT)
192 
197 #define NCSF_LSTBOX_CHECKMASK \
198  (NCSF_LSTBOX_CMBLANK | NCSF_LSTBOX_CMCHECKED | NCSF_LSTBOX_CMPARTCHECKED)
199 
204 #define NCSF_LSTBOX_BOLD (0x0004<<NCSF_ITEM_SHIFT)
205 
210 #define NCSF_LSTBOX_SIGNIFICANT (0x0008<<NCSF_ITEM_SHIFT)
211 
212 #define mListBoxHeader(className) \
213  mItemViewHeader(className) \
214  PLOGFONT font; \
215  int itemVisibles; \
216  int itemHilighted; \
217  int selItem; \
218  DWORD listFlag;
219 
240 struct _mListBox
241 {
242  mListBoxHeader(mListBox)
243 };
244 
245 #define mListBoxClassHeader(clsName, parentClass) \
246  mItemViewClassHeader(clsName, parentClass) \
247  int (*onChar)(clsName*, int asciiCode, DWORD keyFlags); \
248  int (*setSel)(clsName*, int newSel, int flag); \
249  int (*addString)(clsName*, const char* string, DWORD addData); \
250  int (*insertString)(clsName*, const char* string, DWORD addData, int index);\
251  int (*findString)(clsName*, int start, char* string, BOOL bExact); \
252  BOOL (*delString) (clsName*, int index); \
253  void (*addItems)(clsName*, NCS_LSTBOX_ITEMINFO *info, int count); \
254  int (*removeItemByIdx)(clsName*, int index); \
255  BOOL (*bold)(clsName*, int index, BOOL bold); \
256  BOOL (*isHilightByIdx)(clsName*, int index); \
257  BOOL (*enableByIdx)(clsName*, int index, BOOL enable); \
258  int (*selectByIdx)(clsName*, int index); \
259  int (*deselectByIdx)(clsName*, int index); \
260  BOOL (*setCheckMark)(clsName*, int index, DWORD mark); \
261  DWORD (*getCheckMark)(clsName*, int index);
262 
346 struct _mListBoxClass
347 {
348  mListBoxClassHeader(mListBox, mItemView)
349 };
350 
351 #define mListBoxRendererHeader(clsName, parentClass) \
352  mItemViewRendererHeader(clsName, parentClass)
353 
359 struct _mListBoxRenderer {
360  mListBoxRendererHeader(mListBox, mItemView)
361 };
362 
367 enum mListBoxProp
368 {
372  NCSP_LSTBOX_ITEMWIDTH = NCSP_SWGT_CONTWIDTH,
373 
377  NCSP_LSTBOX_ITEMCOUNT = NCSP_ITEMV_ITEMCOUNT,
378 
382  NCSP_LSTBOX_ITEMHEIGHT = NCSP_ITEMV_MAX + 1,
383 
387  NCSP_LSTBOX_TOPITEM,
388 
396  NCSP_LSTBOX_HILIGHTEDITEM,
397 
401  NCSP_LSTBOX_MAX,
402 };
403 
408 enum mListBoxNotify
409 {
413  NCSN_LSTBOX_CLICKED = NCSN_ITEMV_CLICKED,
414 
418  NCSN_LSTBOX_SELCHANGED = NCSN_ITEMV_SELCHANGED,
419 
423  NCSN_LSTBOX_ENTER = NCSN_ITEMV_ENTER,
424 
428  NCSN_LSTBOX_SETFOCUS = NCSN_ITEMV_SETFOCUS,
429 
433  NCSN_LSTBOX_KILLFOCUS = NCSN_ITEMV_KILLFOCUS,
434 
438  NCSN_LSTBOX_ERRSPACE = NCSN_ITEMV_MAX + 1,
439 
443  NCSN_LSTBOX_DBCLK,
444 
449  NCSN_LSTBOX_CMCANCEL,
450  // Obsolete.
451  NCSN_LSTBOX_SELCANCEL = NCSN_LSTBOX_CMCANCEL,
452 
456  NCSN_LSTBOX_CLKCHKMARK,
457 
461  NCSN_LSTBOX_MAX,
462 };
463 
470 MGNCS_EXPORT extern mListBoxClass g_stmListBoxCls;
473 #ifdef __cplusplus
474 }
475 #endif /* __cplusplus */
476 
477 #endif /* _MGUI_CTRL_LSTBOX_H */
478 #endif //_MGNCSCTRL_LISTBOX
The structure of mItemView control, which derived from mScrollWidget. It is the abstract superclass o...