mGNCS API Reference  v1.5.0
A new control set and a new framework for MiniGUI apps
mlistbox.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_LISTBOX
55 
56 #ifndef _MGUI_CTRL_LSTBOX_H
57 #define _MGUI_CTRL_LSTBOX_H
58 
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif /* __cplusplus */
63 
64 #include "mitem.h"
65 #include "mitem_manager.h"
66 #include "mitemview.h"
75 typedef struct _NCS_LSTBOX_ITEMINFO
76 {
80  char* string;
81 
97  DWORD flag;
98 
102  DWORD image;
103 
107  DWORD addData;
108 }NCS_LSTBOX_ITEMINFO;
109 
110 typedef struct _mListBox mListBox;
111 typedef struct _mListBoxClass mListBoxClass;
112 typedef struct _mListBoxRenderer mListBoxRenderer;
113 
118 #define NCSCTRL_LISTBOX NCSCLASSNAME("listbox")
119 
124 #define NCSS_LSTBOX_SHIFT (NCSS_ITEMV_SHIFT+4)
125 
130 #define NCSS_LSTBOX_SINGLE NCSS_ITEMV_SINGLE
131 
136 #define NCSS_LSTBOX_MULTIPLE NCSS_ITEMV_MULTIPLE
137 
142 #define NCSS_LSTBOX_SORT NCSS_ITEMV_AUTOSORT
143 
149 #define NCSS_LSTBOX_MOUSEFOLLOW (0x0001<<NCSS_ITEMV_SHIFT)
150 
155 #define NCSS_LSTBOX_STRING (0x0000<<NCSS_ITEMV_SHIFT)
156 
161 #define NCSS_LSTBOX_USEBITMAP (0x0002<<NCSS_ITEMV_SHIFT)
162 
167 #define NCSS_LSTBOX_CHECKBOX (0x0004<<NCSS_ITEMV_SHIFT)
168 
174 #define NCSS_LSTBOX_AUTOCHECK (0x0008<<NCSS_ITEMV_SHIFT)
175 
180 #define NCSS_LSTBOX_AUTOCHECKBOX \
181  (NCSS_LSTBOX_CHECKBOX | NCSS_LSTBOX_AUTOCHECK)
182 
183 //for list flags
184 #define NCSF_LSTBOX_SHIFT (NCSF_ITEM_SHIFT + 4)
185 
186 /* check mark, for NCSS_LSTBOX_CHECKBOX*/
191 #define NCSF_LSTBOX_CMBLANK (0x0000<<NCSF_ITEM_SHIFT)
192 
197 #define NCSF_LSTBOX_CMCHECKED (0x0001<<NCSF_ITEM_SHIFT)
198 
203 #define NCSF_LSTBOX_CMPARTCHECKED (0x0002<<NCSF_ITEM_SHIFT)
204 
209 #define NCSF_LSTBOX_CHECKMASK \
210  (NCSF_LSTBOX_CMBLANK | NCSF_LSTBOX_CMCHECKED | NCSF_LSTBOX_CMPARTCHECKED)
211 
216 #define NCSF_LSTBOX_BOLD (0x0004<<NCSF_ITEM_SHIFT)
217 
222 #define NCSF_LSTBOX_SIGNIFICANT (0x0008<<NCSF_ITEM_SHIFT)
223 
224 #define mListBoxHeader(className) \
225  mItemViewHeader(className) \
226  PLOGFONT font; \
227  int itemVisibles; \
228  int itemHilighted; \
229  int selItem; \
230  DWORD listFlag;
231 
252 struct _mListBox
253 {
254  mListBoxHeader(mListBox)
255 };
256 
257 #define mListBoxClassHeader(clsName, parentClass) \
258  mItemViewClassHeader(clsName, parentClass) \
259  int (*onChar)(clsName*, int asciiCode, DWORD keyFlags); \
260  int (*setSel)(clsName*, int newSel, int flag); \
261  int (*addString)(clsName*, const char* string, DWORD addData); \
262  int (*insertString)(clsName*, const char* string, DWORD addData, int index);\
263  int (*findString)(clsName*, int start, char* string, BOOL bExact); \
264  BOOL (*delString) (clsName*, int index); \
265  void (*addItems)(clsName*, NCS_LSTBOX_ITEMINFO *info, int count); \
266  int (*removeItemByIdx)(clsName*, int index); \
267  BOOL (*bold)(clsName*, int index, BOOL bold); \
268  BOOL (*isHilightByIdx)(clsName*, int index); \
269  BOOL (*enableByIdx)(clsName*, int index, BOOL enable); \
270  int (*selectByIdx)(clsName*, int index); \
271  int (*deselectByIdx)(clsName*, int index); \
272  BOOL (*setCheckMark)(clsName*, int index, DWORD mark); \
273  DWORD (*getCheckMark)(clsName*, int index);
274 
358 struct _mListBoxClass
359 {
360  mListBoxClassHeader(mListBox, mItemView)
361 };
362 
363 #define mListBoxRendererHeader(clsName, parentClass) \
364  mItemViewRendererHeader(clsName, parentClass)
365 
371 struct _mListBoxRenderer {
372  mListBoxRendererHeader(mListBox, mItemView)
373 };
374 
379 enum mListBoxProp
380 {
384  NCSP_LSTBOX_ITEMWIDTH = NCSP_SWGT_CONTWIDTH,
385 
389  NCSP_LSTBOX_ITEMCOUNT = NCSP_ITEMV_ITEMCOUNT,
390 
394  NCSP_LSTBOX_ITEMHEIGHT = NCSP_ITEMV_MAX + 1,
395 
399  NCSP_LSTBOX_TOPITEM,
400 
408  NCSP_LSTBOX_HILIGHTEDITEM,
409 
413  NCSP_LSTBOX_MAX,
414 };
415 
420 enum mListBoxNotify
421 {
425  NCSN_LSTBOX_CLICKED = NCSN_ITEMV_CLICKED,
426 
430  NCSN_LSTBOX_SELCHANGED = NCSN_ITEMV_SELCHANGED,
431 
435  NCSN_LSTBOX_ENTER = NCSN_ITEMV_ENTER,
436 
440  NCSN_LSTBOX_SETFOCUS = NCSN_ITEMV_SETFOCUS,
441 
445  NCSN_LSTBOX_KILLFOCUS = NCSN_ITEMV_KILLFOCUS,
446 
450  NCSN_LSTBOX_ERRSPACE = NCSN_ITEMV_MAX + 1,
451 
455  NCSN_LSTBOX_DBCLK,
456 
461  NCSN_LSTBOX_CMCANCEL,
462  // Obsolete.
463  NCSN_LSTBOX_SELCANCEL = NCSN_LSTBOX_CMCANCEL,
464 
468  NCSN_LSTBOX_CLKCHKMARK,
469 
473  NCSN_LSTBOX_MAX,
474 };
475 
482 MGNCS_EXPORT extern mListBoxClass g_stmListBoxCls;
485 #ifdef __cplusplus
486 }
487 #endif /* __cplusplus */
488 
489 #endif /* _MGUI_CTRL_LSTBOX_H */
490 #endif //_MGNCSCTRL_LISTBOX
mItemView
The structure of mItemView control, which derived from mScrollWidget. It is the abstract superclass o...
mitem.h
NCSN_ITEMV_SETFOCUS
@ NCSN_ITEMV_SETFOCUS
Definition: mitemview.h:605
NCSN_ITEMV_CLICKED
@ NCSN_ITEMV_CLICKED
Definition: mitemview.h:585
mitem_manager.h
NCSP_SWGT_CONTWIDTH
@ NCSP_SWGT_CONTWIDTH
Definition: mscroll_widget.h:282
NCSN_ITEMV_ENTER
@ NCSN_ITEMV_ENTER
Definition: mitemview.h:600
NCSN_ITEMV_SELCHANGED
@ NCSN_ITEMV_SELCHANGED
Definition: mitemview.h:595
mitemview.h
NCSP_ITEMV_MAX
@ NCSP_ITEMV_MAX
Definition: mitemview.h:574
NCSP_ITEMV_ITEMCOUNT
@ NCSP_ITEMV_ITEMCOUNT
Definition: mitemview.h:570
NCSN_ITEMV_KILLFOCUS
@ NCSN_ITEMV_KILLFOCUS
Definition: mitemview.h:610
NCSN_ITEMV_MAX
@ NCSN_ITEMV_MAX
Definition: mitemview.h:615