25 #include "FXCallback.h" 48 #define FXDECLARE(classname) \ 50 struct FXMapEntry { FX::FXSelector keylo; FX::FXSelector keyhi; long (classname::* func)(FX::FXObject*,FX::FXSelector,void*); }; \ 51 static const FX::FXMetaClass metaClass; \ 52 static FX::FXObject* manufacture(); \ 53 virtual const FX::FXMetaClass* getMetaClass() const; \ 54 virtual long handle(FX::FXObject* sender,FX::FXSelector sel,void* ptr); \ 59 #define FXIMPLEMENT(classname,baseclassname,mapping,nmappings) \ 60 FX::FXObject* classname::manufacture(){return new classname;} \ 61 const FX::FXMetaClass classname::metaClass(#classname,classname::manufacture,&baseclassname::metaClass,mapping,nmappings,sizeof(classname::FXMapEntry)); \ 62 const FX::FXMetaClass* classname::getMetaClass() const { return &classname::metaClass; } \ 63 long classname::handle(FX::FXObject* sender,FX::FXSelector sel,void* ptr){ \ 64 const FXMapEntry* me=(const FXMapEntry*)metaClass.search(sel); \ 65 return me ? (this->* me->func)(sender,sel,ptr) : baseclassname::handle(sender,sel,ptr); \ 70 #define FXDECLARE_ABSTRACT(classname) \ 72 struct FXMapEntry { FX::FXSelector keylo; FX::FXSelector keyhi; long (classname::* func)(FX::FXObject*,FX::FXSelector,void*); }; \ 73 static const FX::FXMetaClass metaClass; \ 74 virtual const FX::FXMetaClass* getMetaClass() const; \ 75 virtual long handle(FX::FXObject* sender,FX::FXSelector sel,void* ptr); \ 80 #define FXIMPLEMENT_ABSTRACT(classname,baseclassname,mapping,nmappings) \ 81 const FX::FXMetaClass classname::metaClass(#classname,FX::FXMetaClass::nullObject,&baseclassname::metaClass,mapping,nmappings,sizeof(classname::FXMapEntry)); \ 82 const FX::FXMetaClass* classname::getMetaClass() const { return &classname::metaClass; } \ 83 long classname::handle(FX::FXObject* sender,FX::FXSelector sel,void* ptr){ \ 84 const FXMapEntry* me=(const FXMapEntry*)metaClass.search(sel); \ 85 return me ? (this->* me->func)(sender,sel,ptr) : baseclassname::handle(sender,sel,ptr); \ 90 #define FXMETACLASS(classname) (&classname::metaClass) 94 #define FXDEFMAP(classname) static const classname::FXMapEntry 97 #define FXMAPTYPES(typelo,typehi,func) {FXSEL(typelo,FX::MINKEY),FXSEL(typehi,FX::MAXKEY),&func} 100 #define FXMAPTYPE(type,func) {FXSEL(type,FX::MINKEY),FXSEL(type,FX::MAXKEY),&func} 103 #define FXMAPFUNCS(type,keylo,keyhi,func) {FXSEL(type,keylo),FXSEL(type,keyhi),&func} 106 #define FXMAPFUNC(type,key,func) {FXSEL(type,key),FXSEL(type,key),&func} 112 typedef FXCallback<long (FXObject*,FXSelector,FXptr)> FXMessageCallback;
115 typedef FXMessageCallback::Method FXMessageCallbackWrapper;
118 FX::FXSelector keylo;
119 FX::FXSelector keyhi;
120 FX::FXMessageCallbackWrapper method;
139 const FXchar* getClassName()
const;
142 FXbool isMemberOf(
const FXMetaClass* metaclass)
const;
145 virtual long tryHandle(
FXObject* sender,FXSelector sel,
void* ptr);
148 virtual long onDefault(
FXObject*,FXSelector,
void*);
151 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:134