]> git.saurik.com Git - wxWidgets.git/blame - include/wx/xtihandler.h
Fix keyboard navigation in wxGrid with reordered columns.
[wxWidgets.git] / include / wx / xtihandler.h
CommitLineData
e1d3601a
PC
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/xtihandler.h
3// Purpose: XTI handlers
4// Author: Stefan Csomor
5// Modified by: Francesco Montorsi
6// Created: 27/07/03
7// RCS-ID: $Id$
8// Copyright: (c) 1997 Julian Smart
9// (c) 2003 Stefan Csomor
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _XTIHANDLER_H_
14#define _XTIHANDLER_H_
15
16#include "wx/defs.h"
17
18#if wxUSE_EXTENDED_RTTI
19
6c887dde
SC
20#include "wx/xti.h"
21
c294641f 22// copied from event.h which cannot be included at this place
6c887dde
SC
23
24class WXDLLIMPEXP_FWD_BASE wxEvent;
25
26#ifdef __VISUALC__
27#define wxMSVC_FWD_MULTIPLE_BASES __multiple_inheritance
28#else
29#define wxMSVC_FWD_MULTIPLE_BASES
30#endif
31
32class WXDLLIMPEXP_FWD_BASE wxMSVC_FWD_MULTIPLE_BASES wxEvtHandler;
33typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
34typedef wxEventFunction wxObjectEventFunction;
e1d3601a
PC
35
36// ----------------------------------------------------------------------------
37// Handler Info
38//
39// this describes an event sink
40// ----------------------------------------------------------------------------
41
42class WXDLLIMPEXP_BASE wxHandlerInfo
43{
44 friend class WXDLLIMPEXP_BASE wxDynamicClassInfo;
45
46public:
47 wxHandlerInfo(wxHandlerInfo* &iter,
48 wxClassInfo* itsClass,
49 const wxString& name,
50 wxObjectEventFunction address,
51 const wxClassInfo* eventClassInfo) :
52 m_eventFunction(address),
53 m_name(name),
54 m_eventClassInfo(eventClassInfo),
55 m_itsClass(itsClass)
56 {
57 Insert(iter);
58 }
59
60 ~wxHandlerInfo()
61 { Remove(); }
62
63 // return the name of this handler
64 const wxString& GetName() const { return m_name; }
65
66 // return the class info of the event
67 const wxClassInfo *GetEventClassInfo() const { return m_eventClassInfo; }
68
69 // get the handler function pointer
70 wxObjectEventFunction GetEventFunction() const { return m_eventFunction; }
71
72 // returns NULL if this is the last handler of this class
73 wxHandlerInfo* GetNext() const { return m_next; }
74
75 // return the class this property is declared in
76 const wxClassInfo* GetDeclaringClass() const { return m_itsClass; }
77
78private:
79
80 // inserts this handler at the end of the linked chain which begins
81 // with "iter" handler.
82 void Insert(wxHandlerInfo* &iter);
83
84 // removes this handler from the linked chain of the m_itsClass handlers.
85 void Remove();
86
87 wxObjectEventFunction m_eventFunction;
88 wxString m_name;
89 const wxClassInfo* m_eventClassInfo;
90 wxHandlerInfo* m_next;
91 wxClassInfo* m_itsClass;
92};
93
94#define wxHANDLER(name,eventClassType) \
95 static wxHandlerInfo _handlerInfo##name( first, class_t::GetClassInfoStatic(), \
96 wxT(#name), (wxObjectEventFunction) (wxEventFunction) &name, \
97 CLASSINFO( eventClassType ) );
98
99#define wxBEGIN_HANDLERS_TABLE(theClass) \
100 wxHandlerInfo *theClass::GetHandlersStatic() \
101 { \
102 typedef theClass class_t; \
103 static wxHandlerInfo* first = NULL;
104
105#define wxEND_HANDLERS_TABLE() \
106 return first; }
107
108#define wxEMPTY_HANDLERS_TABLE(theClass) \
109 wxBEGIN_HANDLERS_TABLE(theClass) \
110 wxEND_HANDLERS_TABLE()
111
112#endif // wxUSE_EXTENDED_RTTI
113#endif // _XTIHANDLER_H_