]> git.saurik.com Git - wxWidgets.git/blame - include/wx/notebook.h
Define wxUSE_NOTEBOOK for Mac. Required ny sizer.
[wxWidgets.git] / include / wx / notebook.h
CommitLineData
34138703
JS
1#ifndef _WX_NOTEBOOK_H_BASE_
2#define _WX_NOTEBOOK_H_BASE_
53b28675 3
4d0f3cd6
VZ
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
14class WXDLLEXPORT wxNotebookEvent : public wxNotifyEvent
15{
16public:
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
33private:
34 int m_nSel, // currently selected page
35 m_nOldSel; // previously selected page
36
37 DECLARE_DYNAMIC_CLASS(wxNotebookEvent)
38};
39
40// ----------------------------------------------------------------------------
2e4df4bf 41// event types and macros for them
4d0f3cd6
VZ
42// ----------------------------------------------------------------------------
43
2e4df4bf
VZ
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
50BEGIN_DECLARE_EVENT_TYPES()
51 DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, 802)
52 DECLARE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, 803)
53END_DECLARE_EVENT_TYPES()
54
4d0f3cd6
VZ
55typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
56
25889d3c
JS
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) \
2e4df4bf 60 DECLARE_EVENT_TABLE_ENTRY( \
82a5f02c 61 wxEVT_COMMAND_NB_PAGE_CHANGED, \
25889d3c
JS
62 id, \
63 -1, \
64 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
65 NULL \
82a5f02c 66 ),
25889d3c
JS
67
68#define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
2e4df4bf 69 DECLARE_EVENT_TABLE_ENTRY( \
82a5f02c 70 wxEVT_COMMAND_NB_PAGE_CHANGING, \
25889d3c
JS
71 id, \
72 -1, \
73 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
74 NULL \
82a5f02c 75 ),
25889d3c
JS
76
77#else
78
4d0f3cd6 79#define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
2e4df4bf 80 DECLARE_EVENT_TABLE_ENTRY( \
4d0f3cd6
VZ
81 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \
82 id, \
83 -1, \
84 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
85 NULL \
82a5f02c 86 ),
4d0f3cd6
VZ
87
88#define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
2e4df4bf 89 DECLARE_EVENT_TABLE_ENTRY( \
4d0f3cd6
VZ
90 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, \
91 id, \
92 -1, \
93 (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
94 NULL \
82a5f02c 95 ),
4d0f3cd6 96
25889d3c
JS
97#endif
98
4d0f3cd6
VZ
99// ----------------------------------------------------------------------------
100// wxNotebook class itself
101// ----------------------------------------------------------------------------
102
2049ba38 103#if defined(__WXMSW__)
1e6d9499
JS
104#ifdef __WIN16__
105 #include "wx/generic/notebook.h"
106#else
6a415c9a 107 #include "wx/msw/notebook.h"
1e6d9499 108#endif
2049ba38 109#elif defined(__WXMOTIF__)
793f619f 110 #include "wx/generic/notebook.h"
2049ba38 111#elif defined(__WXGTK__)
53b28675 112 #include "wx/gtk/notebook.h"
b4e76e0d
RR
113#elif defined(__WXQT__)
114 #include "wx/qt/notebook.h"
34138703 115#elif defined(__WXMAC__)
4765d335 116 #include "wx/mac/notebook.h"
1777b9bb
DW
117#elif defined(__WXPM__)
118 #include "wx/os2/notebook.h"
34138703
JS
119#elif defined(__WXSTUBS__)
120 #include "wx/stubs/notebook.h"
53b28675
RR
121#endif
122
123#endif
34138703 124 // _WX_NOTEBOOK_H_BASE_