mcombobox.h
Go to the documentation of this file.00001
00019 #ifdef _MGNCSCTRL_COMBOBOX
00020
00021 #ifndef _MGUI_PANEL_COMBOBOX_H
00022 #define _MGUI_PANEL_COMBOBOX_H
00023
00024
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028
00038 #define NCSCTRL_COMBOBOX NCSCLASSNAME("combobox")
00039
00040 typedef struct _mCombobox mCombobox;
00041 typedef struct _mComboboxClass mComboboxClass;
00042 typedef struct _mComboboxRenderer mComboboxRenderer;
00043
00044 #define mComboboxHeader(clsName) \
00045 mPanelHeader(clsName) \
00046 mListBox *listbox; \
00047 mSlEdit *edit; \
00048 RECT rcList; \
00049 RECT rcEdit; \
00050 RECT rcBtn; \
00051 unsigned int flag; \
00052 int dropWidth;
00053
00075 struct _mCombobox
00076 {
00077 mComboboxHeader(mCombobox)
00078 };
00079
00080 #define mComboboxClassHeader(clsName, parentClass) \
00081 mPanelClassHeader(clsName, parentClass) \
00082 BOOL (*addItem)(clsName *self, const char *item, DWORD addData); \
00083 BOOL (*removeItem)(clsName *self, int index); \
00084 BOOL (*setItem)(clsName *self, int index, const char *item); \
00085 const char* (*getItem)(clsName *self, int index); \
00086 void (*setAddData)(clsName *self, int index, DWORD addData); \
00087 DWORD (*getAddData)(clsName *self, int index);
00088
00114 struct _mComboboxClass
00115 {
00116 mComboboxClassHeader(mCombobox, mPanel)
00117 };
00118
00119 MGNCS_EXPORT extern mComboboxClass g_stmComboboxCls;
00120
00121 #define mComboboxRendererHeader(clsName, parentClass) \
00122 mPanelRendererHeader(clsName, parentClass) \
00123 void (*drawDropDownBtn)(clsName* self, HDC, const RECT*);
00124
00137 struct _mComboboxRenderer {
00138 mComboboxRendererHeader(mCombobox, mPanel)
00139 };
00140
00145 enum mComboboxProp {
00151 NCSP_COMB_ITEMHEIGHT = NCSP_LSTBOX_ITEMHEIGHT,
00157 NCSP_COMB_ITEMCOUNT = NCSP_LSTBOX_ITEMCOUNT,
00164 NCSP_COMB_DROPDOWNHEIGHT = NCSP_PANEL_MAX + 1,
00171 NCSP_COMB_TEXTLIMIT,
00178 NCSP_COMB_SELECT,
00179 NCSP_COMB_MAX
00180 };
00181
00182
00187 #define NCSS_CMBOX_SIMPLE 0x0000L
00188
00193 #define NCSS_CMBOX_DROPDOWNLIST (0x0001L<<NCSS_PANEL_SHIFT)
00194
00199 #define NCSS_CMBOX_SORT (0x0002L<<NCSS_PANEL_SHIFT)
00200
00205 #define NCSS_CMBOX_EDITNOBORDER (0x0004L<<NCSS_PANEL_SHIFT)
00206
00211 #define NCSS_CMBOX_EDITBASELINE (0x0008L<<NCSS_PANEL_SHIFT)
00212
00217 #define NCSS_CMBOX_READONLY (0x0010L<<NCSS_PANEL_SHIFT)
00218
00223 #define NCSS_CMBOX_UPPERCASE (0x0020L<<NCSS_PANEL_SHIFT)
00224
00229 #define NCSS_CMBOX_LOWERCASE (0x0040L<<NCSS_PANEL_SHIFT)
00230
00235 #define NCSS_CMBOX_AUTOFOCUS (0x0080L<<NCSS_PANEL_SHIFT)
00236
00237 #define NCSS_CMBOX_SHIFT (NCSS_PANEL_SHIFT + 9)
00238
00239
00241 enum enumComboboxNotify {
00242 NCSN_CMBOX_SELCHANGE = NCSN_PANEL_MAX + 1,
00243 NCSN_CMBOX_SETFOCUS,
00244 NCSN_CMBOX_KILLFOCUS,
00245 NCSN_CMBOX_EDITCHANGE,
00246 NCSN_CMBOX_DROPDOWN,
00247 NCSN_CMBOX_CLOSEUP,
00248 NCSN_CMBOX_SELECTOK,
00249 NCSN_CMBOX_SELECTCANCEL,
00250 NCSN_CMBOX_MAX
00251 };
00252
00253
00257
00258 #define NCSF_CMBOX_BUTTONDOWN 0x0001
00259 #define NCSF_CMBOX_BUTTONUP 0x0002
00260 #define NCSF_CMBOX_DROPPED 0x0004
00261 #define NCSF_CMBOX_HILIGHT 0x0008
00262
00263 #define SET_STATE(lp, mask) (lp->flag |= (mask))
00264 #define CLEAR_STATE(lp, mask) (lp->flag &= ~(mask))
00265 #define IS_SET(lp, mask) (lp->flag & (mask))
00266
00269 #ifdef __cplusplus
00270 }
00271 #endif
00272
00273 #endif
00274 #endif //_MGNCSCTRL_COMBOBOX