mGNCS API Reference  v1.5.0
A new control set and a new framework for MiniGUI apps
Macros | Enumerations | Functions
mToolItem

Macros

#define NCS_TOOLITEM_FLAG_TEXT_LEFT   0x01
 indicate that create a tool item whoes text at left. default is in the right More...
 
#define NCS_TOOLITEM_FLAG_TEXT_UP   NCS_TOOLITEM_FLAG_TEXT_LEFT
 indicate that create a tool item whoes text at up More...
 
#define NCS_TOOLITEM_FLAG_VERT   0x02
 indicate that create a tool item whoes text and image arranged vertically More...
 
#define NCS_TOOLITEM_UNCHECKED   0x00
 tool item state unckecked More...
 
#define NCS_TOOLITEM_CHECKED   0x01
 tool item state checked More...
 

Enumerations

enum  mToolItemType
 define the type of toolitem More...
 
enum  mToolItemEvent { NCSN_TOOLITEM_CLICKED = 1, NCSN_TOOLITEM_PUSHED, NCSN_TOOLITEM_SHOWMENU, NCSN_TOOLITEM_STATE_CHANGED }
 define the event code of tool item More...
 

Functions

MGNCS_EXPORT mToolImage * ncsNewToolImage (PBITMAP pbmp, int cell_count, BOOL autoUnload, BOOL bVert)
 create a tool image for tool item More...
 
MGNCS_EXPORT mToolImage * ncsNewToolImageFromFile (const char *fileName, int cell_count, BOOL autoUnload, BOOL bVert)
 create a tool image from file, More...
 
MGNCS_EXPORT void ncsFreeToolImage (mToolImage *mti)
 free the toolimage More...
 
MGNCS_EXPORT BOOL ncsDrawToolImageCell (mToolImage *mti, HDC hdc, int idx, const RECT *prc)
 draw a sub image from toolimage to hdc More...
 
MGNCS_EXPORT BOOL ncsInitToolItems (void)
 initialize tool items More...
 
MGNCS_EXPORT void * ncsCreateWidgetToolItem (mWidget *widget)
 create a toolitem which include a mWidget object More...
 
MGNCS_EXPORT void * ncsCreateSeparatorItem (void)
 create separator item More...
 
MGNCS_EXPORT int ncsGetToolItemType (void *toolitem)
 get the type of item More...
 
MGNCS_EXPORT BOOL ncsIsPushToolItem (void *toolitem)
 check the toolitem is push item or not More...
 
MGNCS_EXPORT BOOL ncsIsMenuToolItem (void *toolitem)
 check the toolitem is menu tool item or not More...
 
MGNCS_EXPORT BOOL ncsIsSeparatorToolItem (void *toolitem)
 check the toolitem is separator tool item or not More...
 
MGNCS_EXPORT BOOL ncsIsWidgetToolItem (void *toolitem)
 check the toolitem is widget tool item or not More...
 
MGNCS_EXPORT int ncsToolItem_getId (void *self)
 get the id of toolitem More...
 
MGNCS_EXPORT int ncsToolItem_setId (void *self, int id)
 get the id of toolitem More...
 
MGNCS_EXPORT BOOL ncsToolItem_setCheck (void *self, int check_state)
 set the check state of toolitem More...
 
MGNCS_EXPORT int ncsToolItem_getCheck (void *self)
 get the check state of toolitem More...
 
MGNCS_EXPORT BOOL ncsToolItem_showMenu (void *self, mObject *owner)
 show the menu of MenuToolItem More...
 
MGNCS_EXPORT mObjectncsNewToolItem (int id, mObjectClass *_class, DWORD param)
 new a tool item object More...
 
MGNCS_EXPORT void ncsFreeToolItem (mObject *obj)
 free the tool item object More...
 

Detailed Description

Macro Definition Documentation

◆ NCS_TOOLITEM_CHECKED

#define NCS_TOOLITEM_CHECKED   0x01

tool item state checked

Definition at line 224 of file mtoolitem.h.

◆ NCS_TOOLITEM_FLAG_TEXT_LEFT

#define NCS_TOOLITEM_FLAG_TEXT_LEFT   0x01

indicate that create a tool item whoes text at left. default is in the right

Definition at line 156 of file mtoolitem.h.

◆ NCS_TOOLITEM_FLAG_TEXT_UP

#define NCS_TOOLITEM_FLAG_TEXT_UP   NCS_TOOLITEM_FLAG_TEXT_LEFT

indicate that create a tool item whoes text at up

Note
must combine with NCS_TOOLITEM_FLAG_VERT

Definition at line 162 of file mtoolitem.h.

◆ NCS_TOOLITEM_FLAG_VERT

#define NCS_TOOLITEM_FLAG_VERT   0x02

indicate that create a tool item whoes text and image arranged vertically

Definition at line 167 of file mtoolitem.h.

◆ NCS_TOOLITEM_UNCHECKED

#define NCS_TOOLITEM_UNCHECKED   0x00

tool item state unckecked

Definition at line 219 of file mtoolitem.h.

Enumeration Type Documentation

◆ mToolItemEvent

define the event code of tool item

Enumerator
NCSN_TOOLITEM_CLICKED 

When a tool item is checked

NCSN_TOOLITEM_PUSHED 

When a tool item is pushed

NCSN_TOOLITEM_SHOWMENU 

When a tool item want show a menu

NCSN_TOOLITEM_STATE_CHANGED 

When a tool item has changed its state

Definition at line 133 of file mtoolitem.h.

◆ mToolItemType

define the type of toolitem

Definition at line 71 of file mtoolitem.h.

Function Documentation

◆ ncsCreateSeparatorItem()

void * ncsCreateSeparatorItem ( void  )

create separator item

Returns
the object pointer

◆ ncsCreateWidgetToolItem()

void * ncsCreateWidgetToolItem ( mWidget widget)

create a toolitem which include a mWidget object

Parameters
widgetthe widget object, its parant must be a mToolBar
Returns
the object pointer

◆ ncsDrawToolImageCell()

BOOL ncsDrawToolImageCell ( mToolImage *  mti,
HDC  hdc,
int  idx,
const RECT *  prc 
)

draw a sub image from toolimage to hdc

Parameters
mti- the mToolImage object
hdc- the destination dc handle
idx- the index of sub image
prc- the area to draw bitmap

◆ ncsFreeToolImage()

void ncsFreeToolImage ( mToolImage *  mti)

free the toolimage

◆ ncsFreeToolItem()

void ncsFreeToolItem ( mObject obj)

free the tool item object

Parameters
obj– the object want to free
Returns
void

◆ ncsGetToolItemType()

int ncsGetToolItemType ( void *  toolitem)

get the type of item

Parameters
toolitem- the pointer of toolitem
Returns
the type of tool item
See also
mToolItemType

◆ ncsInitToolItems()

BOOL ncsInitToolItems ( void  )

initialize tool items

◆ ncsIsMenuToolItem()

BOOL ncsIsMenuToolItem ( void *  toolitem)

check the toolitem is menu tool item or not

Parameters
toolitem- the pointer of toolitem
Returns
TRUE or FALSE

◆ ncsIsPushToolItem()

BOOL ncsIsPushToolItem ( void *  toolitem)

check the toolitem is push item or not

Parameters
toolitem- the pointer of toolitem
Returns
TRUE or FALSE

◆ ncsIsSeparatorToolItem()

BOOL ncsIsSeparatorToolItem ( void *  toolitem)

check the toolitem is separator tool item or not

Parameters
toolitem- the pointer of toolitem
Returns
TRUE or FALSE

◆ ncsIsWidgetToolItem()

BOOL ncsIsWidgetToolItem ( void *  toolitem)

check the toolitem is widget tool item or not

Parameters
toolitem- the pointer of toolitem
Returns
TRUE or FALSE

◆ ncsNewToolImage()

mToolImage * ncsNewToolImage ( PBITMAP  pbmp,
int  cell_count,
BOOL  autoUnload,
BOOL  bVert 
)

create a tool image for tool item

Parameters
pbmp- the bitmap pointer used by toolitem
cell_count- the count of sub bitmaps in the pbmp
autoUnload- unload the pbmp when toolimage is deleted
bVert- the sub bitmaps is arranged vertically
Returns
a mToolIamge object

◆ ncsNewToolImageFromFile()

mToolImage * ncsNewToolImageFromFile ( const char *  fileName,
int  cell_count,
BOOL  autoUnload,
BOOL  bVert 
)

create a tool image from file,

See also
ncsNewToolImage
Parameters
fileName- the image file name
cell_count- the count of sub bitmaps in the pbmp
autoUnload- unload the pbmp when toolimage is deleted
bVert- the sub bitmaps is arranged vertically
Returns
a mToolIamge object

◆ ncsNewToolItem()

mObject * ncsNewToolItem ( int  id,
mObjectClass _class,
DWORD  param 
)

new a tool item object

Parameters
id– the id of toolid
_class– the class of toolitem implememnted, should be a mHotPiece class
param– the construct param of class
Returns
return a new item

◆ ncsToolItem_getCheck()

int ncsToolItem_getCheck ( void *  self)

get the check state of toolitem

Parameters
self- the toolitem pointer
Returns
check state

◆ ncsToolItem_getId()

int ncsToolItem_getId ( void *  self)

get the id of toolitem

Parameters
self- the toolitem pointer
Returns
id of toolitem

◆ ncsToolItem_setCheck()

BOOL ncsToolItem_setCheck ( void *  self,
int  check_state 
)

set the check state of toolitem

Parameters
self- the toolitem pointer
check_state- the state of check
Returns
TRUE or FALSE

◆ ncsToolItem_setId()

int ncsToolItem_setId ( void *  self,
int  id 
)

get the id of toolitem

Parameters
self- the toolitem pointer
id- the new id of toolitem
Returns
old id of toolitem

◆ ncsToolItem_showMenu()

BOOL ncsToolItem_showMenu ( void *  self,
mObject owner 
)

show the menu of MenuToolItem

Parameters
self- the pointer of Menu Tool Item
owner- the owner of the menu
Returns
TRUE or FALSE