00001
00025 #ifdef _MGNCSCTRL_LISTBOX
00026
00027 #ifndef _MGUI_CTRL_LSTBOX_H
00028 #define _MGUI_CTRL_LSTBOX_H
00029
00030
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034
00035 #include "mitem.h"
00036 #include "mitem_manager.h"
00037 #include "mitemview.h"
00046 typedef struct _NCS_LSTBOX_ITEMINFO
00047 {
00051 char* string;
00052
00068 DWORD flag;
00069
00073 DWORD image;
00074
00078 DWORD addData;
00079 }NCS_LSTBOX_ITEMINFO;
00080
00081 typedef struct _mListBox mListBox;
00082 typedef struct _mListBoxClass mListBoxClass;
00083 typedef struct _mListBoxRenderer mListBoxRenderer;
00084
00089 #define NCSCTRL_LISTBOX NCSCLASSNAME("listbox")
00090
00095 #define NCSS_LSTBOX_SHIFT (NCSS_ITEMV_SHIFT+4)
00096
00101 #define NCSS_LSTBOX_SINGLE NCSS_ITEMV_SINGLE
00102
00107 #define NCSS_LSTBOX_MULTIPLE NCSS_ITEMV_MULTIPLE
00108
00113 #define NCSS_LSTBOX_SORT NCSS_ITEMV_AUTOSORT
00114
00120 #define NCSS_LSTBOX_MOUSEFOLLOW (0x0001<<NCSS_ITEMV_SHIFT)
00121
00126 #define NCSS_LSTBOX_STRING (0x0000<<NCSS_ITEMV_SHIFT)
00127
00132 #define NCSS_LSTBOX_USEBITMAP (0x0002<<NCSS_ITEMV_SHIFT)
00133
00138 #define NCSS_LSTBOX_CHECKBOX (0x0004<<NCSS_ITEMV_SHIFT)
00139
00145 #define NCSS_LSTBOX_AUTOCHECK (0x0008<<NCSS_ITEMV_SHIFT)
00146
00151 #define NCSS_LSTBOX_AUTOCHECKBOX \
00152 (NCSS_LSTBOX_CHECKBOX | NCSS_LSTBOX_AUTOCHECK)
00153
00154
00155 #define NCSF_LSTBOX_SHIFT (NCSF_ITEM_SHIFT + 4)
00156
00157
00162 #define NCSF_LSTBOX_CMBLANK (0x0000<<NCSF_ITEM_SHIFT)
00163
00168 #define NCSF_LSTBOX_CMCHECKED (0x0001<<NCSF_ITEM_SHIFT)
00169
00174 #define NCSF_LSTBOX_CMPARTCHECKED (0x0002<<NCSF_ITEM_SHIFT)
00175
00180 #define NCSF_LSTBOX_CHECKMASK \
00181 (NCSF_LSTBOX_CMBLANK | NCSF_LSTBOX_CMCHECKED | NCSF_LSTBOX_CMPARTCHECKED)
00182
00187 #define NCSF_LSTBOX_BOLD (0x0004<<NCSF_ITEM_SHIFT)
00188
00193 #define NCSF_LSTBOX_SIGNIFICANT (0x0008<<NCSF_ITEM_SHIFT)
00194
00195 #define mListBoxHeader(className) \
00196 mItemViewHeader(className) \
00197 PLOGFONT font; \
00198 int itemVisibles; \
00199 int itemHilighted; \
00200 int selItem; \
00201 DWORD listFlag;
00202
00223 struct _mListBox
00224 {
00225 mListBoxHeader(mListBox)
00226 };
00227
00228 #define mListBoxClassHeader(clsName, parentClass) \
00229 mItemViewClassHeader(clsName, parentClass) \
00230 int (*onChar)(clsName*, int asciiCode, DWORD keyFlags); \
00231 int (*setSel)(clsName*, int newSel, int flag); \
00232 int (*addString)(clsName*, const char* string, DWORD addData); \
00233 int (*insertString)(clsName*, const char* string, DWORD addData, int index);\
00234 int (*findString)(clsName*, int start, char* string, BOOL bExact); \
00235 BOOL (*delString) (clsName*, int index); \
00236 void (*addItems)(clsName*, NCS_LSTBOX_ITEMINFO *info, int count); \
00237 int (*removeItemByIdx)(clsName*, int index); \
00238 BOOL (*bold)(clsName*, int index, BOOL bold); \
00239 BOOL (*isHilightByIdx)(clsName*, int index); \
00240 BOOL (*enableByIdx)(clsName*, int index, BOOL enable); \
00241 int (*selectByIdx)(clsName*, int index); \
00242 int (*deselectByIdx)(clsName*, int index); \
00243 BOOL (*setCheckMark)(clsName*, int index, DWORD mark); \
00244 DWORD (*getCheckMark)(clsName*, int index);
00245
00329 struct _mListBoxClass
00330 {
00331 mListBoxClassHeader(mListBox, mItemView)
00332 };
00333
00334 #define mListBoxRendererHeader(clsName, parentClass) \
00335 mItemViewRendererHeader(clsName, parentClass)
00336
00342 struct _mListBoxRenderer {
00343 mListBoxRendererHeader(mListBox, mItemView)
00344 };
00345
00350 enum mListBoxProp
00351 {
00355 NCSP_LSTBOX_ITEMWIDTH = NCSP_SWGT_CONTWIDTH,
00356
00360 NCSP_LSTBOX_ITEMCOUNT = NCSP_ITEMV_ITEMCOUNT,
00361
00365 NCSP_LSTBOX_ITEMHEIGHT = NCSP_ITEMV_MAX + 1,
00366
00370 NCSP_LSTBOX_TOPITEM,
00371
00379 NCSP_LSTBOX_HILIGHTEDITEM,
00380
00384 NCSP_LSTBOX_MAX,
00385 };
00386
00391 enum mListBoxNotify
00392 {
00396 NCSN_LSTBOX_CLICKED = NCSN_ITEMV_CLICKED,
00397
00401 NCSN_LSTBOX_SELCHANGED = NCSN_ITEMV_SELCHANGED,
00402
00406 NCSN_LSTBOX_ENTER = NCSN_ITEMV_ENTER,
00407
00411 NCSN_LSTBOX_SETFOCUS = NCSN_ITEMV_SETFOCUS,
00412
00416 NCSN_LSTBOX_KILLFOCUS = NCSN_ITEMV_KILLFOCUS,
00417
00421 NCSN_LSTBOX_ERRSPACE = NCSN_ITEMV_MAX + 1,
00422
00426 NCSN_LSTBOX_DBCLK,
00427
00432 NCSN_LSTBOX_CMCANCEL,
00433
00434 NCSN_LSTBOX_SELCANCEL = NCSN_LSTBOX_CMCANCEL,
00435
00439 NCSN_LSTBOX_CLKCHKMARK,
00440
00444 NCSN_LSTBOX_MAX,
00445 };
00446
00453 MGNCS_EXPORT extern mListBoxClass g_stmListBoxCls;
00456 #ifdef __cplusplus
00457 }
00458 #endif
00459
00460 #endif
00461 #endif //_MGNCSCTRL_LISTBOX