]> git.saurik.com Git - wxWidgets.git/blame - include/wx/notebook.h
Make wxRichTextRectArray usable by other parts of wxRTC
[wxWidgets.git] / include / wx / notebook.h
CommitLineData
1e6feb95
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/notebook.h
3// Purpose: wxNotebook interface
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 01.02.01
99d80019 7// Copyright: (c) 1996-2000 Vadim Zeitlin
65571936 8// Licence: wxWindows licence
1e6feb95
VZ
9///////////////////////////////////////////////////////////////////////////////
10
34138703
JS
11#ifndef _WX_NOTEBOOK_H_BASE_
12#define _WX_NOTEBOOK_H_BASE_
53b28675 13
4d0f3cd6
VZ
14// ----------------------------------------------------------------------------
15// headers
16// ----------------------------------------------------------------------------
17
1e6feb95
VZ
18#include "wx/defs.h"
19
20#if wxUSE_NOTEBOOK
21
15aad3b9 22#include "wx/bookctrl.h"
1e6feb95 23
e450aa69
VZ
24// ----------------------------------------------------------------------------
25// constants
26// ----------------------------------------------------------------------------
27
9804d540
WS
28// wxNotebook hit results, use wxBK_HITTEST so other book controls can share them
29// if wxUSE_NOTEBOOK is disabled
e450aa69
VZ
30enum
31{
9804d540
WS
32 wxNB_HITTEST_NOWHERE = wxBK_HITTEST_NOWHERE,
33 wxNB_HITTEST_ONICON = wxBK_HITTEST_ONICON,
34 wxNB_HITTEST_ONLABEL = wxBK_HITTEST_ONLABEL,
35 wxNB_HITTEST_ONITEM = wxBK_HITTEST_ONITEM,
36 wxNB_HITTEST_ONPAGE = wxBK_HITTEST_ONPAGE
e450aa69
VZ
37};
38
90c0f63a
VZ
39// wxNotebook flags
40
41// use common book wxBK_* flags for describing alignment
42#define wxNB_DEFAULT wxBK_DEFAULT
43#define wxNB_TOP wxBK_TOP
44#define wxNB_BOTTOM wxBK_BOTTOM
45#define wxNB_LEFT wxBK_LEFT
46#define wxNB_RIGHT wxBK_RIGHT
47
48#define wxNB_FIXEDWIDTH 0x0100
49#define wxNB_MULTILINE 0x0200
50#define wxNB_NOPAGETHEME 0x0400
51#define wxNB_FLAT 0x0800
52
9804d540 53
1e6feb95
VZ
54typedef wxWindow wxNotebookPage; // so far, any window can be a page
55
53a2db12 56extern WXDLLIMPEXP_DATA_CORE(const char) wxNotebookNameStr[];
630ad6c6 57
28953245
SC
58#if wxUSE_EXTENDED_RTTI
59
60// ----------------------------------------------------------------------------
61// XTI accessor
62// ----------------------------------------------------------------------------
63
64class WXDLLEXPORT wxNotebookPageInfo : public wxObject
65{
66public:
67 wxNotebookPageInfo() { m_page = NULL; m_imageId = -1; m_selected = false; }
68 virtual ~wxNotebookPageInfo() { }
69
70 bool Create(wxNotebookPage *page,
71 const wxString& text,
72 bool selected,
73 int imageId)
74 {
75 m_page = page;
76 m_text = text;
77 m_selected = selected;
78 m_imageId = imageId;
79 return true;
80 }
81
82 wxNotebookPage* GetPage() const { return m_page; }
83 wxString GetText() const { return m_text; }
84 bool GetSelected() const { return m_selected; }
85 int GetImageId() const { return m_imageId; }
86
87private:
88 wxNotebookPage *m_page;
89 wxString m_text;
90 bool m_selected;
91 int m_imageId;
92
93 DECLARE_DYNAMIC_CLASS(wxNotebookPageInfo)
94};
95
96WX_DECLARE_EXPORTED_LIST(wxNotebookPageInfo, wxNotebookPageInfoList );
97
98#endif
99
1e6feb95
VZ
100// ----------------------------------------------------------------------------
101// wxNotebookBase: define wxNotebook interface
102// ----------------------------------------------------------------------------
103
53a2db12 104class WXDLLIMPEXP_CORE wxNotebookBase : public wxBookCtrlBase
1e6feb95
VZ
105{
106public:
15aad3b9
VZ
107 // ctors
108 // -----
109
6463b9f5 110 wxNotebookBase() { }
15aad3b9 111
61c083e7
WS
112 // wxNotebook-specific additions to wxBookCtrlBase interface
113 // ---------------------------------------------------------
1e6feb95
VZ
114
115 // get the number of rows for a control with wxNB_MULTILINE style (not all
116 // versions support it - they will always return 1 then)
117 virtual int GetRowCount() const { return 1; }
118
1e6feb95
VZ
119 // set the padding between tabs (in pixels)
120 virtual void SetPadding(const wxSize& padding) = 0;
121
122 // set the size of the tabs for wxNB_FIXEDWIDTH controls
123 virtual void SetTabSize(const wxSize& sz) = 0;
124
e450aa69 125
1e6feb95 126
15aad3b9
VZ
127 // implement some base class functions
128 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
22f3361e 129
25057aba
JS
130 // On platforms that support it, get the theme page background colour, else invalid colour
131 virtual wxColour GetThemeBackgroundColour() const { return wxNullColour; }
132
a570e8f8 133
ce7fe42e 134 // send wxEVT_NOTEBOOK_PAGE_CHANGING/ED events
a570e8f8
VZ
135
136 // returns false if the change to nPage is vetoed by the program
137 bool SendPageChangingEvent(int nPage);
138
139 // sends the event about page change from old to new (or GetSelection() if
7e837615
VZ
140 // new is wxNOT_FOUND)
141 void SendPageChangedEvent(int nPageOld, int nPageNew = wxNOT_FOUND);
a570e8f8 142
6b81fbd8
VZ
143 // wxBookCtrlBase overrides this method to return false but we do need
144 // focus because we have tabs
145 virtual bool AcceptsFocus() const { return wxControl::AcceptsFocus(); }
a570e8f8 146
28953245
SC
147#if wxUSE_EXTENDED_RTTI
148 // XTI accessors
149 virtual void AddPageInfo( wxNotebookPageInfo* info );
150 virtual const wxNotebookPageInfoList& GetPageInfos() const;
151#endif
152
15aad3b9 153protected:
28953245
SC
154#if wxUSE_EXTENDED_RTTI
155 wxNotebookPageInfoList m_pageInfos;
156#endif
c0c133e1 157 wxDECLARE_NO_COPY_CLASS(wxNotebookBase);
1e6feb95 158};
4d0f3cd6
VZ
159
160// ----------------------------------------------------------------------------
15aad3b9 161// notebook event class and related stuff
4d0f3cd6
VZ
162// ----------------------------------------------------------------------------
163
856b41f9
VZ
164// wxNotebookEvent is obsolete and defined for compatibility only (notice that
165// we use #define and not typedef to also keep compatibility with the existing
166// code which forward declares it)
167#define wxNotebookEvent wxBookCtrlEvent
3e97a905
VZ
168typedef wxBookCtrlEventFunction wxNotebookEventFunction;
169#define wxNotebookEventHandler(func) wxBookCtrlEventHandler(func)
4d0f3cd6 170
ce7fe42e
VZ
171wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGED, wxBookCtrlEvent );
172wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_NOTEBOOK_PAGE_CHANGING, wxBookCtrlEvent );
2e4df4bf 173
7fa03f04 174#define EVT_NOTEBOOK_PAGE_CHANGED(winid, fn) \
ce7fe42e 175 wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGED, winid, wxBookCtrlEventHandler(fn))
7fa03f04
VZ
176
177#define EVT_NOTEBOOK_PAGE_CHANGING(winid, fn) \
ce7fe42e 178 wx__DECLARE_EVT1(wxEVT_NOTEBOOK_PAGE_CHANGING, winid, wxBookCtrlEventHandler(fn))
4d0f3cd6
VZ
179
180// ----------------------------------------------------------------------------
181// wxNotebook class itself
182// ----------------------------------------------------------------------------
183
1e6feb95
VZ
184#if defined(__WXUNIVERSAL__)
185 #include "wx/univ/notebook.h"
186#elif defined(__WXMSW__)
aaace873 187 #include "wx/msw/notebook.h"
2049ba38 188#elif defined(__WXMOTIF__)
1e6feb95 189 #include "wx/generic/notebook.h"
1be7a35c 190#elif defined(__WXGTK20__)
1e6feb95 191 #include "wx/gtk/notebook.h"
1be7a35c
MR
192#elif defined(__WXGTK__)
193 #include "wx/gtk1/notebook.h"
34138703 194#elif defined(__WXMAC__)
ef0e9220 195 #include "wx/osx/notebook.h"
0201182b 196#elif defined(__WXCOCOA__)
0754a4b3 197 #include "wx/cocoa/notebook.h"
1777b9bb 198#elif defined(__WXPM__)
1e6feb95 199 #include "wx/os2/notebook.h"
53b28675
RR
200#endif
201
ce7fe42e
VZ
202// old wxEVT_COMMAND_* constants
203#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED wxEVT_NOTEBOOK_PAGE_CHANGED
204#define wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING wxEVT_NOTEBOOK_PAGE_CHANGING
205
1e6feb95
VZ
206#endif // wxUSE_NOTEBOOK
207
53b28675 208#endif
34138703 209 // _WX_NOTEBOOK_H_BASE_