githubEdit

Foundation Class

mObject

Introduction of mObject

mObject is the foundation class of all mGNCS, it:

  • Encapsulates mGNCS inheritance and virtual function realization

  • Defines the most fundamental class member structure

At the same time, a group of operation functions are defined to control the behavior of class

The class is foundation class and cannot be used directly

  • Direct child class:

    • mComponent

Operation Function of mObject

In mGNCS, many operations about class have mObject pointer as the parameter, and these are

  • Type judgment operation: ncsInstanceOf, equivalent to instance of operator of java, case of judging if a pointer is the appointed class

For the convenience of operation, macro is provided

Example

In addition, to judge if a pointer is mObject object, ncsIsValidObj can be used:

Corresponding macro is

  • Type conversion operation: ncsSafeCast, safe type conversion, similar to dynamic_cast operator of C++

Corresponding macro is

Example

  • Other functions: newObject, deleteOBject, TYPENAME macro.

To create an object, newObject will be used, because it will call constructor function of the object.

To delete an object, deleteObject will be used, because it will call destructor function of the object

mComponent

Introduction of mComponent

mComponent provides the most fundamental realization of component. Component is the most fundamental element of mGNCS program.

The class is foundation class and cannot be used directly

  • Inherited from: mObject

  • Direct child class

  • mWidget

  • mInvsbComp

Method of mComponent

  • setProperty

  • Set property of the component

  • Return: TRUE – setting successful; FALSE –setting failed

  • Params

    • int id - ID of property

    • DWORD value – property value

  • getProperty

  • Get property of the component

  • Return: property value or DWORD(-1)

  • Params

    • int id – property ID

  • setId

  • Set Id of the component

  • Return: return old Id

  • Params

  • int id - new id

  • getId

  • Get component Id

  • Return: component Id

  • getReleated

  • Get components related to the component, such as parent component, child component and brother component

  • Return: NULL or corresponding component object pointer

  • Params:

  • int releated: relation type: one of NCS_COMP_NEXT, NCS_COMP_PREV, NCS_COMP_PARENT and NCS_COMP_CHILDREN

  • setReleated:

  • Set associated component

  • Return: associated component pointer after setting, if the setting is not successful, NULL is returned

  • Params

    • mComponent* comp – set component pointer

    • int related – same as getReletaed

  • getChild

  • Get child component appointed by id

  • Return : NULL or corresponding component pointer

  • Params:

    • int id – id of the component to get

Operation Function of mComponent

Component supports some universal operations

  • Event installation and unloading function

  • Register related functions

mWidget

Introduction of mWidget

mWidget is the foundation class of all the controls

  • Inherited from mComponent

  • Direct child class

  • mStatic

  • mButton

  • mPanel

  • mScrollWidget

  • mProgressBar

  • mPropSheet

  • mSlider

  • mSpinbox

Style of mWidget

Style ID

Property Name of miniStudio

Explanation

NCSS_NOTIFY

Notify

Decide if the control generates Notification event

Property of mWidget

Property name

Property name of miniStudio

Type

RW

Explanation

NCSP_WIDGET_RDR

Renderer

const char*

W

Set current renderer of the control

NCSP_WIDGET_TEXT

Text

const char*

W

Set text content of the current control

NCSP_WIDGET_BKIMAGE

BkImage

PBITMAP

RW

Set or get current background image

NCSP_WIDGET_BKIMAGE_MODE

BkImageMode

Set or get current background image drawing mode

NCSP_WIDGET_BKIMAGE_FILE

-

const char*

Set current background image, and automatically load from the file name

Method of mWidget

None

Event of mWidget

  • MSG_NCCREATE

  • Description: the first message of the window when the window non client area is created. Now the window is still not built, and the functions with the window sentence handle as the parameter cannot be called

  • Callback: void (* NCS_CB_ONNCCREATE)(mWidget *);

  • Returned value: none

  • Parameter

  • mWidget * event generator object pointer

  • MSG_CREATE

  • Description: generated when the window is created.

  • Callback: typedef BOOL(*) NCS_CB_ONCREATE (mWidget *, DWORD dwAddData)

  • Returned value: TRUE – continue creating; FALSE – exit creating

  • Parameter

  • mWidget *

  • DWORD dwAddData additional data

  • Notification message

  • All the events generated from the notification message use the callback

  • void (* NCS_CB_NOTIFY)(mWidget *, int nc_code);

  • Returned value: none

  • Parameter

  • mWidget * event generator object pointer

  • int nc_code : event notification code, used to distinguish different events

*Note: Callback of all the notification events is NCS_CB_NOTIFY*

Operation Function of mWidget

  • Functions that create controls

  • Direct associated operation of object pointer and window sentence handle

Example of mWidget

mWidget cannot be used directly


<< Renderer and Resources Management | Table of Contents | Static Box and Derived Control Classes >>

Last updated