1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/xtihandler.h
3 // Purpose: XTI handlers
4 // Author: Stefan Csomor
5 // Modified by: Francesco Montorsi
8 // Copyright: (c) 1997 Julian Smart
9 // (c) 2003 Stefan Csomor
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef _XTIHANDLER_H_
14 #define _XTIHANDLER_H_
18 #if wxUSE_EXTENDED_RTTI
22 // copied from event.h which cannot be included at this place, TODO MOVE to common file
24 class WXDLLIMPEXP_FWD_BASE wxEvent
;
27 #define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
29 #define wxMSVC_FWD_MULTIPLE_BASES
32 class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler
;
33 typedef void (wxEvtHandler::*wxEventFunction
)(wxEvent
&);
34 typedef wxEventFunction wxObjectEventFunction
;
36 // ----------------------------------------------------------------------------
39 // this describes an event sink
40 // ----------------------------------------------------------------------------
42 class WXDLLIMPEXP_BASE wxHandlerInfo
44 friend class WXDLLIMPEXP_BASE wxDynamicClassInfo
;
47 wxHandlerInfo(wxHandlerInfo
* &iter
,
48 wxClassInfo
* itsClass
,
50 wxObjectEventFunction address
,
51 const wxClassInfo
* eventClassInfo
) :
52 m_eventFunction(address
),
54 m_eventClassInfo(eventClassInfo
),
63 // return the name of this handler
64 const wxString
& GetName() const { return m_name
; }
66 // return the class info of the event
67 const wxClassInfo
*GetEventClassInfo() const { return m_eventClassInfo
; }
69 // get the handler function pointer
70 wxObjectEventFunction
GetEventFunction() const { return m_eventFunction
; }
72 // returns NULL if this is the last handler of this class
73 wxHandlerInfo
* GetNext() const { return m_next
; }
75 // return the class this property is declared in
76 const wxClassInfo
* GetDeclaringClass() const { return m_itsClass
; }
80 // inserts this handler at the end of the linked chain which begins
81 // with "iter" handler.
82 void Insert(wxHandlerInfo
* &iter
);
84 // removes this handler from the linked chain of the m_itsClass handlers.
87 wxObjectEventFunction m_eventFunction
;
89 const wxClassInfo
* m_eventClassInfo
;
90 wxHandlerInfo
* m_next
;
91 wxClassInfo
* m_itsClass
;
94 #define wxHANDLER(name,eventClassType) \
95 static wxHandlerInfo _handlerInfo##name( first, class_t::GetClassInfoStatic(), \
96 wxT(#name), (wxObjectEventFunction) (wxEventFunction) &name, \
97 CLASSINFO( eventClassType ) );
99 #define wxBEGIN_HANDLERS_TABLE(theClass) \
100 wxHandlerInfo *theClass::GetHandlersStatic() \
102 typedef theClass class_t; \
103 static wxHandlerInfo* first = NULL;
105 #define wxEND_HANDLERS_TABLE() \
108 #define wxEMPTY_HANDLERS_TABLE(theClass) \
109 wxBEGIN_HANDLERS_TABLE(theClass) \
110 wxEND_HANDLERS_TABLE()
112 #endif // wxUSE_EXTENDED_RTTI
113 #endif // _XTIHANDLER_H_