mtoolitem.h
00001
00002
00003
00004
00005
00006
00007
00008 #ifndef _MG_MINIMTOOLITEM_H_
00009 #define _MG_MINIMTOOLITEM_H_
00010
00011 #ifdef __cplusplus
00012 extern "C"{
00013 #endif
00014
00025 enum mToolItemType{
00026 NCS_UNKNOWNTOOLITEM = 0,
00027 NCS_PUSHTOOLITEM,
00028 NCS_MENUTOOLITEM,
00029 NCS_WIDGETTOOLITEM,
00030 NCS_SEPARATORTOOLITEM
00031 };
00032
00033 typedef struct _mToolImage{
00034 PBITMAP pbmp;
00035 unsigned char flags;
00036 unsigned char cell_count;
00037 unsigned short ref;
00038 }mToolImage;
00039
00040 #define TOOLIMGF_UNLOAD 0x01
00041 #define TOOLIMGF_VERTCELL 0x02 //the image of cell a vert arranged
00042
00053 MGNCS_EXPORT mToolImage * ncsNewToolImage(PBITMAP pbmp, int cell_count, BOOL autoUnload, BOOL bVert);
00064 MGNCS_EXPORT mToolImage * ncsNewToolImageFromFile(const char *fileName, int cell_count, BOOL autoUnload, BOOL bVert);
00070 MGNCS_EXPORT void ncsFreeToolImage(mToolImage *mti);
00071
00081 MGNCS_EXPORT BOOL ncsDrawToolImageCell(mToolImage *mti, HDC hdc, int idx, const RECT *prc);
00082
00087 enum mToolItemEvent{
00091 NCSN_TOOLITEM_CLICKED = 1,
00095 NCSN_TOOLITEM_PUSHED,
00099 NCSN_TOOLITEM_SHOWMENU,
00103 NCSN_TOOLITEM_STATE_CHANGED
00104 };
00105
00110 #define NCS_TOOLITEM_FLAG_TEXT_LEFT 0x01
00111
00116 #define NCS_TOOLITEM_FLAG_TEXT_UP NCS_TOOLITEM_FLAG_TEXT_LEFT
00117
00121 #define NCS_TOOLITEM_FLAG_VERT 0x02
00122
00123 #define NCS_TOOLITEM_LABEL_TEXT_LEFT 0x10
00124 #define NCS_TOOLITEM_LABEL_TEXT_RIGHT 0x20
00125 #define NCS_TOOLITEM_LABEL_TEXT_CENTER 0x40
00126
00127 #define NCS_TOOLITEM_LABEL_TEXT_TOP 0x80
00128 #define NCS_TOOLITEM_LABEL_TEXT_BOTTOM 0x100
00129 #define NCS_TOOLITEM_LABEL_TEXT_VCENTER 0x200
00130
00143 MGNCS_EXPORT void* ncsCreatePushToolItem(int id, mToolImage *img, const char* str, UINT flags);
00144
00145
00150 MGNCS_EXPORT BOOL ncsInitToolItems(void);
00151
00167 MGNCS_EXPORT void* ncsCreateMenuToolItem(int id, mToolImage *img, const char* str, UINT flags, mPopMenuMgr *menu);
00168
00173 #define NCS_TOOLITEM_UNCHECKED 0x00
00174
00178 #define NCS_TOOLITEM_CHECKED 0x01
00179
00195 MGNCS_EXPORT void* ncsCreateCheckToolItem(int id, mToolImage *img, const char* str, UINT flags, int state);
00211 MGNCS_EXPORT void* ncsCreateRadioToolItem(int id, mToolImage *img, const char* str, UINT flags);
00212
00221 MGNCS_EXPORT void* ncsCreateWidgetToolItem(mWidget* widget);
00222
00229 MGNCS_EXPORT void* ncsCreateSeparatorItem(void);
00230
00240 MGNCS_EXPORT int ncsGetToolItemType(void *toolitem);
00241
00249 MGNCS_EXPORT BOOL ncsIsPushToolItem(void *toolitem);
00257 MGNCS_EXPORT BOOL ncsIsMenuToolItem(void *toolitem);
00265 MGNCS_EXPORT BOOL ncsIsSeparatorToolItem(void *toolitem);
00273 MGNCS_EXPORT BOOL ncsIsWidgetToolItem(void *toolitem);
00274
00276
00283 MGNCS_EXPORT int ncsToolItem_getId(void *self);
00292 MGNCS_EXPORT int ncsToolItem_setId(void *self, int id);
00301 MGNCS_EXPORT BOOL ncsToolItem_setCheck(void *self, int check_state);
00309 MGNCS_EXPORT int ncsToolItem_getCheck(void *self);
00310
00320 MGNCS_EXPORT BOOL ncsToolItem_showMenu(void*self, mObject *owner);
00321
00322
00334 MGNCS_EXPORT mObject* ncsNewToolItem(int id, mObjectClass* _class, DWORD param);
00335
00336 #define NEWTOOLITEM(id, Object, param) \
00337 (Object*)(ncsNewToolItem((id), (mObjectClass*)&Class(Object), (DWORD)(param)))
00338
00348 MGNCS_EXPORT void ncsFreeToolItem(mObject* obj);
00349
00350 #define FREETOOLITEM(obj) \
00351 ncsFreeToolItem((mObject*)(obj))
00352
00355 #ifdef __cplusplus
00356 }
00357 #endif
00358
00359 #endif