]> git.saurik.com Git - wxWidgets.git/blob - include/wx/notebook.h
wxRadioBox fixed on mac
[wxWidgets.git] / include / wx / notebook.h
1 #ifndef _WX_NOTEBOOK_H_BASE_
2 #define _WX_NOTEBOOK_H_BASE_
3
4 // ----------------------------------------------------------------------------
5 // headers
6 // ----------------------------------------------------------------------------
7
8 #include "wx/event.h" // the base class: wxNotifyEvent
9
10 // ----------------------------------------------------------------------------
11 // notebook event class (used by NOTEBOOK_PAGE_CHANGED/ING events)
12 // ----------------------------------------------------------------------------
13
14 class WXDLLEXPORT wxNotebookEvent : public wxNotifyEvent
15 {
16 public:
17 wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
18 int nSel = -1, int nOldSel = -1)
19 : wxNotifyEvent(commandType, id)
20 {
21 m_nSel = nSel;
22 m_nOldSel = nOldSel;
23 }
24
25 // accessors
26 // the currently selected page (-1 if none)
27 int GetSelection() const { return m_nSel; }
28 void SetSelection(int nSel) { m_nSel = nSel; }
29 // the page that was selected before the change (-1 if none)
30 int GetOldSelection() const { return m_nOldSel; }
31 void SetOldSelection(int nOldSel) { m_nOldSel = nOldSel; }
32
33 private:
34 int m_nSel, // currently selected page
35 m_nOldSel; // previously selected page
36
37 DECLARE_DYNAMIC_CLASS(wxNotebookEvent)
38 };
39
40 // ----------------------------------------------------------------------------
41 // event types and macros for them
42 // ----------------------------------------------------------------------------
43
44 #if defined(__BORLANDC__) && defined(__WIN16__)
45 // For 16-bit BC++, these 2 would be identical otherwise (truncated)
46 #define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_COMMAND_NB_PAGE_CHANGED
47 #define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_COMMAND_NB_PAGE_CHANGING
48 #endif
49
50 BEGIN_DECLARE_EVENT_TYPES()
51 DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 802)
52 DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 803)
53 END_DECLARE_EVENT_TYPES()
54
55 typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
56
57 // Truncation in 16-bit BC++ means we need to define these differently
58 #if defined(__BORLANDC__) && defined(__WIN16__)
59 #define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
60 DECLARE_EVENT_TABLE_ENTRY( \
61 wxEVT_COMMAND_NB_PAGE_CHANGED, \
62 id, \
63 -1, \
64 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
65 NULL \
66 ),
67
68 #define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
69 DECLARE_EVENT_TABLE_ENTRY( \
70 wxEVT_COMMAND_NB_PAGE_CHANGING, \
71 id, \
72 -1, \
73 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
74 NULL \
75 ),
76
77 #else
78
79 #define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
80 DECLARE_EVENT_TABLE_ENTRY( \
81 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \
82 id, \
83 -1, \
84 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
85 NULL \
86 ),
87
88 #define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
89 DECLARE_EVENT_TABLE_ENTRY( \
90 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \
91 id, \
92 -1, \
93 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
94 NULL \
95 ),
96
97 #endif
98
99 // ----------------------------------------------------------------------------
100 // wxNotebook class itself
101 // ----------------------------------------------------------------------------
102
103 #if defined(__WXMSW__)
104 #ifdef __WIN16__
105 #include "wx/generic/notebook.h"
106 #else
107 #include "wx/msw/notebook.h"
108 #endif
109 #elif defined(__WXMOTIF__)
110 #include "wx/generic/notebook.h"
111 #elif defined(__WXGTK__)
112 #include "wx/gtk/notebook.h"
113 #elif defined(__WXQT__)
114 #include "wx/qt/notebook.h"
115 #elif defined(__WXMAC__)
116 #include "wx/mac/notebook.h"
117 #elif defined(__WXPM__)
118 #include "wx/os2/notebook.h"
119 #elif defined(__WXSTUBS__)
120 #include "wx/stubs/notebook.h"
121 #endif
122
123 #endif
124 // _WX_NOTEBOOK_H_BASE_