mGNCS API Reference
v1.2.0
A new control set and a new framework for MiniGUI apps
|
Macros | |
#define | TYPENAME(obj) ((obj)?(((obj)->_class)?((obj)->_class)->typeName:""):"") |
Get the class name form a Object pointer. More... | |
#define | INSTANCEOF(obj, clss) ncsInstanceOf((mObject*)(obj), (mObjectClass*)(void*)(&Class(clss))) |
A wrapper of ncsInstanceOf, just like java's instanceof. More... | |
#define | CHECKOBJ(obj) ncsIsValidObj((mObject*)obj) |
the wrapper of ncsIsValidObj More... | |
#define | TYPE_CAST(Type, obj) ((Type*)(obj)) |
unsafe cast. donot check the type of class More... | |
#define | SAFE_CAST(Type, obj) TYPE_CAST(Type, ncsSafeCast((mObject*)obj,(mObjectClass*)(void*)(&(Class(Type))))) |
wrapper of ncsSafeCast, check the class type before cast. More... | |
#define | SAFE_CAST_CLASS(Clss, ClssCast) ((ClassType(ClssCast)*)(ncsSafeCastClass((mObjectClass*)Clss, (mObjectClass*)(void*)(&Class(ClssCast))))) |
the wrapper of ncsSafeCastClass More... | |
Typedefs | |
typedef BOOL(* | NCS_CB_ONOBJEVENT) (mObject *self, mObject *sender, int eventId, DWORD param) |
The Callback of connection. More... | |
Functions | |
MGNCS_EXPORT mObject * | newObject (mObjectClass *_class) |
new a object instance, like new operator in C++ More... | |
MGNCS_EXPORT void | deleteObject (mObject *obj) |
delete a object intance, like delete operator in C++ More... | |
MGNCS_EXPORT BOOL | ncsInstanceOf (mObject *object, mObjectClass *clss) |
check an object is the class instance or not, same as instanceof operator in Java More... | |
static mObject * | ncsIsValidObj (mObject *obj) |
Check a pointer is a valid mObject or not. More... | |
MGNCS_EXPORT mObject * | ncsSafeCast (mObject *obj, mObjectClass *clss) |
safe type cast function, like the dynamic_cast operator in C++ More... | |
MGNCS_EXPORT mObjectClass * | ncsSafeCastClass (mObjectClass *clss, mObjectClass *castCls) |
cast from a supper class to derived class type safely More... | |
MGNCS_EXPORT BOOL | ncsAddEventListener (mObject *sender, mObject *listener, NCS_CB_ONOBJEVENT eventProc, int eventId) |
connect sender object to listener object More... | |
MGNCS_EXPORT BOOL | ncsAddEventListeners (mObject *sender, mObject *listener, NCS_CB_ONOBJEVENT eventProc, int *eventIds) |
connect a group of events from sender to listener More... | |
MGNCS_EXPORT BOOL | ncsRemoveEventListener (mObject *listener) |
remove the connections which are listened by the object More... | |
MGNCS_EXPORT BOOL | ncsRemoveEventConnect (mObject *listener, mObject *source, int eventId) |
remove a special event connect More... | |
MGNCS_EXPORT BOOL | ncsRemoveEventSource (mObject *sender) |
remove the connections when a sender is destroied More... | |
MGNCS_EXPORT void | ncsRaiseEvent (mObject *sender, int eventId, DWORD param) |
raise an event to listeners More... | |
#define CHECKOBJ | ( | obj | ) | ncsIsValidObj((mObject*)obj) |
#define INSTANCEOF | ( | obj, | |
clss | |||
) | ncsInstanceOf((mObject*)(obj), (mObjectClass*)(void*)(&Class(clss))) |
A wrapper of ncsInstanceOf, just like java's instanceof.
Example: Test a object is mComponentClass: INSTANCEOF(obj, mComponent)
Definition at line 416 of file mobject.h.
Referenced by ncsIsValidObj().
#define SAFE_CAST | ( | Type, | |
obj | |||
) | TYPE_CAST(Type, ncsSafeCast((mObject*)obj,(mObjectClass*)(void*)(&(Class(Type))))) |
wrapper of ncsSafeCast, check the class type before cast.
#define SAFE_CAST_CLASS | ( | Clss, | |
ClssCast | |||
) | ((ClassType(ClssCast)*)(ncsSafeCastClass((mObjectClass*)Clss, (mObjectClass*)(void*)(&Class(ClssCast))))) |
#define TYPE_CAST | ( | Type, | |
obj | |||
) | ((Type*)(obj)) |
#define TYPENAME | ( | obj | ) | ((obj)?(((obj)->_class)?((obj)->_class)->typeName:""):"") |
void deleteObject | ( | mObject * | obj | ) |
delete a object intance, like delete operator in C++
obj | - the object want to delete |
Referenced by initObjectArgs().
BOOL ncsAddEventListener | ( | mObject * | sender, |
mObject * | listener, | ||
NCS_CB_ONOBJEVENT | eventProc, | ||
int | eventId | ||
) |
connect sender object to listener object
sender | The sender of event |
listener | The listener of event |
eventProc | The processing callback of event |
eventId | The id of event |
MGNCS_EXPORT BOOL ncsAddEventListeners | ( | mObject * | sender, |
mObject * | listener, | ||
NCS_CB_ONOBJEVENT | eventProc, | ||
int * | eventIds | ||
) |
connect a group of events from sender to listener
BOOL ncsAddEventListeners(mObject sender, \ mObject listener, \ NCS_CB_ONOBJEVENT eventProc, \ int* eventIds);
sender | The sender of events |
listener | The listener of events |
eventProc | The processing callback of events |
eventIds | The id array of events, end by 0 |
BOOL ncsInstanceOf | ( | mObject * | object, |
mObjectClass * | clss | ||
) |
check an object is the class instance or not, same as instanceof operator in Java
object | - the pointer of object being to test |
clss | - the pointer of class for test |
void ncsRaiseEvent | ( | mObject * | sender, |
int | event_id, | ||
DWORD | param | ||
) |
raise an event to listeners
sender | event sender |
event_id | the id of event |
param | the event param |
remove a special event connect
listener | the listener object |
source | the source object |
event | the special event want to remove |
BOOL ncsRemoveEventListener | ( | mObject * | listener | ) |
remove the connections which are listened by the object
listener | the object pointer of listener |
BOOL ncsRemoveEventSource | ( | mObject * | sender | ) |
remove the connections when a sender is destroied
sender | the sender of events |
mObject * ncsSafeCast | ( | mObject * | obj, |
mObjectClass * | clss | ||
) |
safe type cast function, like the dynamic_cast operator in C++
obj | - the mObject pointer being casted |
clss | - the target type to cast |
mObjectClass * ncsSafeCastClass | ( | mObjectClass * | clss, |
mObjectClass * | castCls | ||
) |
cast from a supper class to derived class type safely
clss | - the supper type class pointer |
castCls | - the derived class type pointer |
mObject * newObject | ( | mObjectClass * | _class | ) |
new a object instance, like new operator in C++
_class | - the class of the object |
Referenced by initObjectArgs().