mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
mtoolitem.h
Go to the documentation of this file.
1 
42 #ifndef _MG_MINIMTOOLITEM_H_
43 #define _MG_MINIMTOOLITEM_H_
44 
45 #ifdef __cplusplus
46 extern "C"{
47 #endif
48 
60  NCS_UNKNOWNTOOLITEM = 0,
61  NCS_PUSHTOOLITEM,
62  NCS_MENUTOOLITEM,
63  NCS_WIDGETTOOLITEM,
64  NCS_SEPARATORTOOLITEM
65 };
66 
67 typedef struct _mToolImage{
68  PBITMAP pbmp;
69  unsigned char flags;
70  unsigned char cell_count;
71  unsigned short ref;
72 }mToolImage;
73 
74 #define TOOLIMGF_UNLOAD 0x01
75 #define TOOLIMGF_VERTCELL 0x02 //the image of cell a vert arranged
76 
87 MGNCS_EXPORT mToolImage * ncsNewToolImage(PBITMAP pbmp, int cell_count, BOOL autoUnload, BOOL bVert);
98 MGNCS_EXPORT mToolImage * ncsNewToolImageFromFile(const char *fileName, int cell_count, BOOL autoUnload, BOOL bVert);
104 MGNCS_EXPORT void ncsFreeToolImage(mToolImage *mti);
105 //BOOL ncsGetToolImageCell(mToolImage *mti, int idx, RECT *prc);
115 MGNCS_EXPORT BOOL ncsDrawToolImageCell(mToolImage *mti, HDC hdc, int idx, const RECT *prc);
116 
138 };
139 
144 #define NCS_TOOLITEM_FLAG_TEXT_LEFT 0x01
145 
150 #define NCS_TOOLITEM_FLAG_TEXT_UP NCS_TOOLITEM_FLAG_TEXT_LEFT
151 
155 #define NCS_TOOLITEM_FLAG_VERT 0x02
156 
157 #define NCS_TOOLITEM_LABEL_TEXT_LEFT 0x10
158 #define NCS_TOOLITEM_LABEL_TEXT_RIGHT 0x20
159 #define NCS_TOOLITEM_LABEL_TEXT_CENTER 0x40
160 
161 #define NCS_TOOLITEM_LABEL_TEXT_TOP 0x80
162 #define NCS_TOOLITEM_LABEL_TEXT_BOTTOM 0x100
163 #define NCS_TOOLITEM_LABEL_TEXT_VCENTER 0x200
164 
177 MGNCS_EXPORT void* ncsCreatePushToolItem(int id, mToolImage *img, const char* str, UINT flags);
178 
179 
184 MGNCS_EXPORT BOOL ncsInitToolItems(void);
185 
201 MGNCS_EXPORT void* ncsCreateMenuToolItem(int id, mToolImage *img, const char* str, UINT flags, mPopMenuMgr *menu);
202 
207 #define NCS_TOOLITEM_UNCHECKED 0x00
208 
212 #define NCS_TOOLITEM_CHECKED 0x01
213 
229 MGNCS_EXPORT void* ncsCreateCheckToolItem(int id, mToolImage *img, const char* str, UINT flags, int state);
245 MGNCS_EXPORT void* ncsCreateRadioToolItem(int id, mToolImage *img, const char* str, UINT flags);
246 
255 MGNCS_EXPORT void* ncsCreateWidgetToolItem(mWidget* widget);
256 
263 MGNCS_EXPORT void* ncsCreateSeparatorItem(void);
264 
274 MGNCS_EXPORT int ncsGetToolItemType(void *toolitem);
275 
283 MGNCS_EXPORT BOOL ncsIsPushToolItem(void *toolitem);
291 MGNCS_EXPORT BOOL ncsIsMenuToolItem(void *toolitem);
299 MGNCS_EXPORT BOOL ncsIsSeparatorToolItem(void *toolitem);
307 MGNCS_EXPORT BOOL ncsIsWidgetToolItem(void *toolitem);
308 
310 
317 MGNCS_EXPORT int ncsToolItem_getId(void *self);
326 MGNCS_EXPORT int ncsToolItem_setId(void *self, int id);
335 MGNCS_EXPORT BOOL ncsToolItem_setCheck(void *self, int check_state);
343 MGNCS_EXPORT int ncsToolItem_getCheck(void *self);
344 
354 MGNCS_EXPORT BOOL ncsToolItem_showMenu(void*self, mObject *owner);
355 
356 
368 MGNCS_EXPORT mObject* ncsNewToolItem(int id, mObjectClass* _class, DWORD param);
369 
370 #define NEWTOOLITEM(id, Object, param) \
371  (Object*)(ncsNewToolItem((id), (mObjectClass*)&Class(Object), (DWORD)(param)))
372 
382 MGNCS_EXPORT void ncsFreeToolItem(mObject* obj);
383 
384 #define FREETOOLITEM(obj) \
385  ncsFreeToolItem((mObject*)(obj))
386 
389 #ifdef __cplusplus
390  }
391 #endif
392 
393 #endif /* _MG_MINIMTOOLITEM_H_ */
MGNCS_EXPORT mToolImage * ncsNewToolImage(PBITMAP pbmp, int cell_count, BOOL autoUnload, BOOL bVert)
create a tool image for tool item
MGNCS_EXPORT BOOL ncsIsMenuToolItem(void *toolitem)
check the toolitem is menu tool item or not
MGNCS_EXPORT BOOL ncsIsPushToolItem(void *toolitem)
check the toolitem is push item or not
MGNCS_EXPORT BOOL ncsInitToolItems(void)
initialize tool items
MGNCS_EXPORT BOOL ncsIsSeparatorToolItem(void *toolitem)
check the toolitem is separator tool item or not
MGNCS_EXPORT void * ncsCreatePushToolItem(int id, mToolImage *img, const char *str, UINT flags)
create push tool item. a push tool item like a push button
MGNCS_EXPORT BOOL ncsToolItem_setCheck(void *self, int check_state)
set the check state of toolitem
MGNCS_EXPORT int ncsToolItem_setId(void *self, int id)
get the id of toolitem
the members of mPropMenuMgr
MGNCS_EXPORT mToolImage * ncsNewToolImageFromFile(const char *fileName, int cell_count, BOOL autoUnload, BOOL bVert)
create a tool image from file,
mToolItemEvent
define the event code of tool item
Definition: mtoolitem.h:121
MGNCS_EXPORT void * ncsCreateSeparatorItem(void)
create separator item
define the mWidget members, inherit from mComponent
the Object struct
MGNCS_EXPORT mObject * ncsNewToolItem(int id, mObjectClass *_class, DWORD param)
new a tool item object
mToolItemType
define the type of toolitem
Definition: mtoolitem.h:59
MGNCS_EXPORT void ncsFreeToolItem(mObject *obj)
free the tool item object
MGNCS_EXPORT void ncsFreeToolImage(mToolImage *mti)
free the toolimage
MGNCS_EXPORT BOOL ncsDrawToolImageCell(mToolImage *mti, HDC hdc, int idx, const RECT *prc)
draw a sub image from toolimage to hdc
MGNCS_EXPORT BOOL ncsToolItem_showMenu(void *self, mObject *owner)
show the menu of MenuToolItem
MGNCS_EXPORT void * ncsCreateCheckToolItem(int id, mToolImage *img, const char *str, UINT flags, int state)
create a check able tool item, like mCheckButton
MGNCS_EXPORT int ncsToolItem_getId(void *self)
get the id of toolitem
MGNCS_EXPORT void * ncsCreateMenuToolItem(int id, mToolImage *img, const char *str, UINT flags, mPopMenuMgr *menu)
create mnue tool item, like a mMenuButton
MGNCS_EXPORT BOOL ncsIsWidgetToolItem(void *toolitem)
check the toolitem is widget tool item or not
MGNCS_EXPORT void * ncsCreateRadioToolItem(int id, mToolImage *img, const char *str, UINT flags)
create a check able tool item, like mRadioButton
MGNCS_EXPORT int ncsToolItem_getCheck(void *self)
get the check state of toolitem
MGNCS_EXPORT int ncsGetToolItemType(void *toolitem)
get the type of item
MGNCS_EXPORT void * ncsCreateWidgetToolItem(mWidget *widget)
create a toolitem which include a mWidget object
the basic object class of NCS