25 #include "FXCallback.h" 29 #include "FXMetaClass.h" 52 #define FXDECLARE(classname) \ 54 struct FXMapEntry { FX::FXSelector keylo; FX::FXSelector keyhi; long (classname::* func)(FX::FXObject*,FX::FXSelector,void*); }; \ 55 static const FX::FXMetaClass metaClass; \ 56 static FX::FXObject* manufacture(); \ 57 virtual const FX::FXMetaClass* getMetaClass() const; \ 58 virtual long handle(FX::FXObject* sender,FX::FXSelector sel,void* ptr); \ 63 #define FXIMPLEMENT(classname,baseclassname,mapping,nmappings) \ 64 FX::FXObject* classname::manufacture(){return new classname;} \ 65 const FX::FXMetaClass classname::metaClass(#classname,classname::manufacture,&baseclassname::metaClass,mapping,nmappings,sizeof(classname::FXMapEntry)); \ 66 const FX::FXMetaClass* classname::getMetaClass() const { return &classname::metaClass; } \ 67 long classname::handle(FX::FXObject* sender,FX::FXSelector sel,void* ptr){ \ 68 const FXMapEntry* me=(const FXMapEntry*)metaClass.search(sel); \ 69 return me ? (this->* me->func)(sender,sel,ptr) : baseclassname::handle(sender,sel,ptr); \ 74 #define FXDECLARE_ABSTRACT(classname) \ 76 struct FXMapEntry { FX::FXSelector keylo; FX::FXSelector keyhi; long (classname::* func)(FX::FXObject*,FX::FXSelector,void*); }; \ 77 static const FX::FXMetaClass metaClass; \ 78 virtual const FX::FXMetaClass* getMetaClass() const; \ 79 virtual long handle(FX::FXObject* sender,FX::FXSelector sel,void* ptr); \ 84 #define FXIMPLEMENT_ABSTRACT(classname,baseclassname,mapping,nmappings) \ 85 const FX::FXMetaClass classname::metaClass(#classname,FX::FXMetaClass::nullObject,&baseclassname::metaClass,mapping,nmappings,sizeof(classname::FXMapEntry)); \ 86 const FX::FXMetaClass* classname::getMetaClass() const { return &classname::metaClass; } \ 87 long classname::handle(FX::FXObject* sender,FX::FXSelector sel,void* ptr){ \ 88 const FXMapEntry* me=(const FXMapEntry*)metaClass.search(sel); \ 89 return me ? (this->* me->func)(sender,sel,ptr) : baseclassname::handle(sender,sel,ptr); \ 94 #define FXMETACLASS(classname) (&classname::metaClass) 98 #define FXDEFMAP(classname) static const classname::FXMapEntry 101 #define FXMAPTYPES(typelo,typehi,func) {FXSEL(typelo,FX::MINKEY),FXSEL(typehi,FX::MAXKEY),&func} 104 #define FXMAPTYPE(type,func) {FXSEL(type,FX::MINKEY),FXSEL(type,FX::MAXKEY),&func} 107 #define FXMAPFUNCS(type,keylo,keyhi,func) {FXSEL(type,keylo),FXSEL(type,keyhi),&func} 110 #define FXMAPFUNC(type,key,func) {FXSEL(type,key),FXSEL(type,key),&func} 116 typedef FXCallback<long (FXObject*,FXSelector,FXptr)> FXMessageCallback;
119 typedef FXMessageCallback::Method FXMessageCallbackWrapper;
122 FX::FXSelector keylo;
123 FX::FXSelector keyhi;
124 FX::FXMessageCallbackWrapper method;
143 const FXchar* getClassName()
const;
146 FXbool isMemberOf(
const FXMetaClass* metaclass)
const;
149 virtual long tryHandle(
FXObject* sender,FXSelector sel,
void* ptr);
152 virtual long onDefault(
FXObject*,FXSelector,
void*);
155 virtual void save(
FXStream& store)
const;
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Definition: FX4Splitter.h:28
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138