Other Class
This chapter introduces some mGNCS non control classes. They are designed to provide for the control class to use.
mReferencedObj
mReferencedObjThe class encapsulate an automatic counting, allowing to control the life circle of the object through automatic quoting when the object is transferred.
The class is mainly used on some non control classes, such as the class of mToolItem and mPropMenuMgr etc.
Inheritance relation
mObjectmRefrencedObj
Direct child classes
mPropMenuMgrmToolItemmToolImage
Method of mReferencedObj
mReferencedObjQuote related ports, and there are two:
addRef automatically adds 1 to the counting, and returns new counting. release will automatically reduce 1 for the counting, and returns new counting; if the counting is 0, automatically call destroy method, delete the object, including memory of the object. mReferenceObj and its derived class need to call NEW or NEWEX macro to create, because release method will call DELETE macro to release the created object. The derived class can change the release mode of the object through covering release method.
Example of mReferencedObj
mReferencedObjThe class is an abstract class, and cannot be used directly.
mPopMenuMgr
mPopMenuMgrmPopMenuMgr stores the information of PropMenu, and it can:
Create a
PopMenuat any time for usePartial
MenuIteminformation can be obtained to fill intoMENUITEMINFOstructure, and provide for the related functions of MiniGUI to useInheritance relation
mObjectmReferencedObjmPopMenuMgr
Method of mPopMenuMgr
mPopMenuMgrMethod of adding a
MenuItemtomPopMenuMgr
Parameter
type – menu item type, same as the definition of MiniGUI
MENUITEMINFOMTF_STRINGMTF_BITMAPMTF_BMPSTRINGMTF_RADIOCHECKMTF_MARKCHECKMTF_SEPARATOR
caption of str – Item, valid when type ==
MTF_STRINGorMTF_BMPSTRINGBit map of bmp – item, valid when type ==
MTF_BITMAPorMTF_BMPSTRINGid of id – item, it is a must to mark an id
state – item status, same as the definition of MiniGUI
MENUITEMINFOMFS_GRAYEDMFS_DISABLEDMFS_CHECKEDMFS_ENABLEDMFS_UNCHECKED
subMenu- sub menu manageradd_data– additional data of the user
return:
TRUEorFALSECreate a
PopMenu, return the sentence handle of the Menu
Automatically create and pop up a Pop Menu
params:
owner points out
PopMenurelated object, which must be amWidgetor its child class, PopMenu will sendMSG_COMMANDto owner
return : None
Add a segmentation bar to
MenuItem
Get information of appointed
MenuItem
Fill information of appointed
MenuItemtoMENUITEMINFOparams:
idx - index or id of menuitem
pmii – output parameter
byCommand:TRUE– idx is id of menu item;FALSE– idx is index of menu item
return :
TRUE/FALSE
Example of mPopMenuMgr
mPopMenuMgrRefer to the example of mMenuButton
mToolImage
mToolImagemToolImage is the class providing images to mToolItem. The class encapsulates all types of images for the convenience of the users to select
Inheritance relation
mObjectmReferencedObjmToolImage
Method of mToolImage
mToolImageThe method of mToolImage is open, and the functions provided below can be called directly.
Create new
mToolImageobject from an image object
params
pbmp : source of image
cell_count:number of small images that pbmp containsautoUnload: automatically callUnloadBitmapto delete the imagebVert: if arrangement of small images is vertical
return :
mToolImagepointerCreate
mToolImageobject from an image file
Release a
mToolImageobject
Draw image of appointed position managed by
mToolImage
params:
mti :
mToolImagepointerhdc : objective
DCsentence handleidx : small image index
prc: objective rectangle
return
TRUEorFALSE
For the users, mainly creating and deleting related functions are used, and draw function is used by ToolItem
Example of mToolImage
mToolImagemToolItem
mToolItemmToolItem is the basic class of item of mToolbar. The class and its derived class are not public. Users only need to automatically create through API provided externally.
mToolbar also delete the ones automatically managing mToolItem
Type of mToolItem
mToolItemmToolItem has many child classes. In external interface, it is manifested as all kinds of types, and these definitions are as below:
Type of a ToolItem can be detected through the function below
Get the type of
ToolItem
The function below can rapidly detect the type of an item
Creation and Deletion of mToolItem
mToolItemCreate a
PushToolItem
params:
img:
mToolImagepointer, can beNULLstr: literal pointer, can be
NULL, but eitherimgorstrmust not beNULLflags: define the relation between
imgandstrNCS_TOOLITEM_FLAG_TEXT_LEFT/NCS_TOOLITEM_FLAG_TEXT_UP, the text is on the left or top, default is right or bottomNCS_TOOLITEM_FLAG_VERT, image and str are vertically arranged, and it is horizontal arrangement by default
return: item pointer
Create a Menu Tool Item
Create a
MenuToolItem, parameter menu is amPopMenuMgr, and other parameters are as aboveCreate a Check Tool Item
Parameter is same as
ncsCreatePushToolItem.Create a radio Tool Item
Parameter is same as
ncsCreatePushToolItem.RadioToolItemis automatically grouped, starting from the first or previous separator and ending to the final or next separator, direct allRadioToolItemare mutually excluding.Create a
ToolItemcontainingmWidgetpointer
params
widget :
mWidgetobject pointer
return : item pointer
Create a separator
return item pointer
Other mToolItem Functions
mToolItem FunctionsmToolItem provides some other functions, used to operate ToolItem
Get or set ID of
ToolItem
If it cannot set or cannot get, return -1.
Get or set Check status of
CheckToolItem:
Only valid aiming at Check/RadioToolItem. When calling
ncsToolItem_getCheckfor otherToolItem, unchecked status will be returned foreverPop up menu for
MenuToolItem
Only aim at menu Tool item, owner is a
mWidgt*object
Example of mToolItem
mToolItem<< Invisible Control Class | Table of Contents | Graphics Device Interfaces >>
Last updated