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