]> git.saurik.com Git - wxWidgets.git/blob - include/wx/notebook.h
Committing in .
[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 macros
42 // ----------------------------------------------------------------------------
43
44 typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
45
46 // Truncation in 16-bit BC++ means we need to define these differently
47 #if defined(__BORLANDC__) && defined(__WIN16__)
48 #define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
49 { \
50 wxEVT_COMMAND_NB_PAGE_CHANGED, \
51 id, \
52 -1, \
53 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
54 NULL \
55 },
56
57 #define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
58 { \
59 wxEVT_COMMAND_NB_PAGE_CHANGING, \
60 id, \
61 -1, \
62 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
63 NULL \
64 },
65
66 #else
67
68 #define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
69 { \
70 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \
71 id, \
72 -1, \
73 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
74 NULL \
75 },
76
77 #define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
78 { \
79 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \
80 id, \
81 -1, \
82 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
83 NULL \
84 },
85
86 #endif
87
88 // ----------------------------------------------------------------------------
89 // wxNotebook class itself
90 // ----------------------------------------------------------------------------
91
92 #if defined(__WXMSW__)
93 #ifdef __WIN16__
94 #include "wx/generic/notebook.h"
95 #else
96 #include "wx/msw/notebook.h"
97 #endif
98 #elif defined(__WXMOTIF__)
99 #include "wx/generic/notebook.h"
100 #elif defined(__WXGTK__)
101 #include "wx/gtk/notebook.h"
102 #elif defined(__WXQT__)
103 #include "wx/qt/notebook.h"
104 #elif defined(__WXMAC__)
105 #include "wx/mac/notebook.h"
106 #elif defined(__WXPM__)
107 #include "wx/os2/notebook.h"
108 #elif defined(__WXSTUBS__)
109 #include "wx/stubs/notebook.h"
110 #endif
111
112 #endif
113 // _WX_NOTEBOOK_H_BASE_