1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/xtihandler.h
3 // Purpose: XTI handlers
4 // Author: Stefan Csomor
5 // Modified by: Francesco Montorsi
7 // RCS-ID: $Id: xti.h 47299 2007-07-10 15:58:27Z FM $
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
20 #include "wx/string.h"
22 class WXDLLIMPEXP_BASE wxObject
;
23 class WXDLLIMPEXP_BASE wxClassInfo
;
24 class WXDLLIMPEXP_BASE wxDynamicClassInfo
;
25 class WXDLLIMPEXP_BASE wxHashTable
;
26 class WXDLLIMPEXP_BASE wxHashTable_Node
;
27 class WXDLLIMPEXP_BASE wxObjectRefData
;
28 class WXDLLIMPEXP_BASE wxEvent
;
29 class WXDLLIMPEXP_BASE wxEvtHandler
;
31 typedef void (wxObject::*wxObjectEventFunction
)(wxEvent
&);
33 // ----------------------------------------------------------------------------
36 // this describes an event sink
37 // ----------------------------------------------------------------------------
39 class WXDLLIMPEXP_BASE wxHandlerInfo
41 friend class WXDLLIMPEXP_BASE wxDynamicClassInfo
;
44 wxHandlerInfo(wxHandlerInfo
* &iter
,
45 wxClassInfo
* itsClass
,
47 wxObjectEventFunction address
,
48 const wxClassInfo
* eventClassInfo
) :
49 m_eventFunction(address
),
51 m_eventClassInfo(eventClassInfo
),
60 // return the name of this handler
61 const wxString
& GetName() const { return m_name
; }
63 // return the class info of the event
64 const wxClassInfo
*GetEventClassInfo() const { return m_eventClassInfo
; }
66 // get the handler function pointer
67 wxObjectEventFunction
GetEventFunction() const { return m_eventFunction
; }
69 // returns NULL if this is the last handler of this class
70 wxHandlerInfo
* GetNext() const { return m_next
; }
72 // return the class this property is declared in
73 const wxClassInfo
* GetDeclaringClass() const { return m_itsClass
; }
77 // inserts this handler at the end of the linked chain which begins
78 // with "iter" handler.
79 void Insert(wxHandlerInfo
* &iter
);
81 // removes this handler from the linked chain of the m_itsClass handlers.
84 wxObjectEventFunction m_eventFunction
;
86 const wxClassInfo
* m_eventClassInfo
;
87 wxHandlerInfo
* m_next
;
88 wxClassInfo
* m_itsClass
;
91 #define wxHANDLER(name,eventClassType) \
92 static wxHandlerInfo _handlerInfo##name( first, class_t::GetClassInfoStatic(), \
93 wxT(#name), (wxObjectEventFunction) (wxEventFunction) &name, \
94 CLASSINFO( eventClassType ) );
96 #define wxBEGIN_HANDLERS_TABLE(theClass) \
97 wxHandlerInfo *theClass::GetHandlersStatic() \
99 typedef theClass class_t; \
100 static wxHandlerInfo* first = NULL;
102 #define wxEND_HANDLERS_TABLE() \
105 #define wxEMPTY_HANDLERS_TABLE(theClass) \
106 wxBEGIN_HANDLERS_TABLE(theClass) \
107 wxEND_HANDLERS_TABLE()
109 #endif // wxUSE_EXTENDED_RTTI
110 #endif // _XTIHANDLER_H_