1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/xtihandler.h
3 // Purpose: XTI handlers
4 // Author: Stefan Csomor
5 // Modified by: Francesco Montorsi
7 // Copyright: (c) 1997 Julian Smart
8 // (c) 2003 Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _XTIHANDLER_H_
13 #define _XTIHANDLER_H_
17 #if wxUSE_EXTENDED_RTTI
21 // copied from event.h which cannot be included at this place
23 class WXDLLIMPEXP_FWD_BASE wxEvent
;
26 #define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
28 #define wxMSVC_FWD_MULTIPLE_BASES
31 class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler
;
32 typedef void (wxEvtHandler::*wxEventFunction
)(wxEvent
&);
33 typedef wxEventFunction wxObjectEventFunction
;
35 // ----------------------------------------------------------------------------
38 // this describes an event sink
39 // ----------------------------------------------------------------------------
41 class WXDLLIMPEXP_BASE wxHandlerInfo
43 friend class WXDLLIMPEXP_BASE wxDynamicClassInfo
;
46 wxHandlerInfo(wxHandlerInfo
* &iter
,
47 wxClassInfo
* itsClass
,
49 wxObjectEventFunction address
,
50 const wxClassInfo
* eventClassInfo
) :
51 m_eventFunction(address
),
53 m_eventClassInfo(eventClassInfo
),
62 // return the name of this handler
63 const wxString
& GetName() const { return m_name
; }
65 // return the class info of the event
66 const wxClassInfo
*GetEventClassInfo() const { return m_eventClassInfo
; }
68 // get the handler function pointer
69 wxObjectEventFunction
GetEventFunction() const { return m_eventFunction
; }
71 // returns NULL if this is the last handler of this class
72 wxHandlerInfo
* GetNext() const { return m_next
; }
74 // return the class this property is declared in
75 const wxClassInfo
* GetDeclaringClass() const { return m_itsClass
; }
79 // inserts this handler at the end of the linked chain which begins
80 // with "iter" handler.
81 void Insert(wxHandlerInfo
* &iter
);
83 // removes this handler from the linked chain of the m_itsClass handlers.
86 wxObjectEventFunction m_eventFunction
;
88 const wxClassInfo
* m_eventClassInfo
;
89 wxHandlerInfo
* m_next
;
90 wxClassInfo
* m_itsClass
;
93 #define wxHANDLER(name,eventClassType) \
94 static wxHandlerInfo _handlerInfo##name( first, class_t::GetClassInfoStatic(), \
95 wxT(#name), (wxObjectEventFunction) (wxEventFunction) &name, \
96 wxCLASSINFO( eventClassType ) );
98 #define wxBEGIN_HANDLERS_TABLE(theClass) \
99 wxHandlerInfo *theClass::GetHandlersStatic() \
101 typedef theClass class_t; \
102 static wxHandlerInfo* first = NULL;
104 #define wxEND_HANDLERS_TABLE() \
107 #define wxEMPTY_HANDLERS_TABLE(theClass) \
108 wxBEGIN_HANDLERS_TABLE(theClass) \
109 wxEND_HANDLERS_TABLE()
111 #endif // wxUSE_EXTENDED_RTTI
112 #endif // _XTIHANDLER_H_