]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/notebook.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / msw / notebook.h
CommitLineData
b5f2afe5 1/////////////////////////////////////////////////////////////////////////////
bc8793f4 2// Name: wx/msw/notebook.h
b5f2afe5
VZ
3// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4// Author: Robert Roebling
5// Modified by: Vadim Zeitlin for Windows version
371a5b4e 6// Copyright: (c) Julian Smart
65571936 7// Licence: wxWindows licence
b5f2afe5
VZ
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef _NOTEBOOK_H
11#define _NOTEBOOK_H
12
1e6feb95
VZ
13#if wxUSE_NOTEBOOK
14
b5f2afe5
VZ
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
74b31181 18
7c0ea335 19#include "wx/control.h"
b5f2afe5 20
b5f2afe5
VZ
21// ----------------------------------------------------------------------------
22// wxNotebook
23// ----------------------------------------------------------------------------
24
53a2db12 25class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
b5f2afe5
VZ
26{
27public:
28 // ctors
29 // -----
30 // default for dynamic class
31 wxNotebook();
32 // the same arguments as for wxControl (@@@ any special styles?)
33 wxNotebook(wxWindow *parent,
35eca07c 34 wxWindowID id,
b5f2afe5
VZ
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
debe6624 37 long style = 0,
630ad6c6 38 const wxString& name = wxNotebookNameStr);
b5f2afe5
VZ
39 // Create() function
40 bool Create(wxWindow *parent,
35eca07c 41 wxWindowID id,
b5f2afe5
VZ
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize,
debe6624 44 long style = 0,
630ad6c6 45 const wxString& name = wxNotebookNameStr);
caf95d2a 46 virtual ~wxNotebook();
b5f2afe5
VZ
47
48 // accessors
49 // ---------
50 // get number of pages in the dialog
8d34bf5c 51 virtual size_t GetPageCount() const;
b5f2afe5
VZ
52
53 // set the currently selected page, return the index of the previously
7e837615 54 // selected one (or wxNOT_FOUND on error)
b5f2afe5 55 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
15aad3b9 56 int SetSelection(size_t nPage);
b5f2afe5 57
1d6fcbcc
VZ
58 // changes selected page without sending events
59 int ChangeSelection(size_t nPage);
60
b5f2afe5 61 // set/get the title of a page
15aad3b9
VZ
62 bool SetPageText(size_t nPage, const wxString& strText);
63 wxString GetPageText(size_t nPage) const;
b5f2afe5
VZ
64
65 // image list stuff: each page may have an image associated with it. All
66 // the images belong to an image list, so you have to
67 // 1) create an image list
68 // 2) associate it with the notebook
69 // 3) set for each page it's image
70 // associate image list with a control
71 void SetImageList(wxImageList* imageList);
b5f2afe5
VZ
72
73 // sets/returns item's image index in the current image list
15aad3b9
VZ
74 int GetPageImage(size_t nPage) const;
75 bool SetPageImage(size_t nPage, int nImage);
b5f2afe5 76
b5f2afe5
VZ
77 // currently it's always 1 because wxGTK doesn't support multi-row
78 // tab controls
79 int GetRowCount() const;
80
81 // control the appearance of the notebook pages
82 // set the size (the same for all pages)
83 void SetPageSize(const wxSize& size);
84 // set the padding between tabs (in pixels)
85 void SetPadding(const wxSize& padding);
86
87 // operations
88 // ----------
b5f2afe5
VZ
89 // remove all pages
90 bool DeleteAllPages();
e450aa69 91
efa14cf2 92 // inserts a new page to the notebook (it will be deleted ny the notebook,
b5f2afe5 93 // don't delete it yourself). If bSelect, this page becomes active.
15aad3b9 94 bool InsertPage(size_t nPage,
b5f2afe5
VZ
95 wxNotebookPage *pPage,
96 const wxString& strText,
078cf5cb 97 bool bSelect = false,
1871b9fa 98 int imageId = NO_IMAGE);
b5f2afe5 99
58a8ab88
JS
100 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
101 // style.
102 void SetTabSize(const wxSize& sz);
103
e450aa69
VZ
104 // hit test
105 virtual int HitTest(const wxPoint& pt, long *flags = NULL) const;
106
107 // calculate the size of the notebook from the size of its page
2ce7af35
JS
108 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
109
b5f2afe5
VZ
110 // callbacks
111 // ---------
9026ad85 112 void OnSize(wxSizeEvent& event);
8a33ea62 113 void OnNavigationKey(wxNavigationKeyEvent& event);
35eca07c 114
b5f2afe5
VZ
115 // base class virtuals
116 // -------------------
0b481c72 117
a23fd0e1 118 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
0df3fbd7
VZ
119 virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
120 WXWORD pos, WXHWND control);
0b481c72
VZ
121
122#if wxUSE_CONSTRAINTS
078cf5cb 123 virtual void SetConstraintSizes(bool recurse = true);
5475b960 124 virtual bool DoPhase(int nPhase);
0b481c72 125#endif // wxUSE_CONSTRAINTS
b5f2afe5 126
25057aba
JS
127 // Attempts to get colour for UX theme page background
128 wxColour GetThemeBackgroundColour() const;
caf95d2a
VZ
129
130 // implementation only
131 // -------------------
132
133#if wxUSE_UXTHEME
c4a95f6f
VZ
134 virtual bool SetBackgroundColour(const wxColour& colour)
135 {
136 if ( !wxNotebookBase::SetBackgroundColour(colour) )
137 return false;
caf95d2a 138
c4a95f6f 139 UpdateBgBrush();
9b7d2b81 140
c4a95f6f
VZ
141 return true;
142 }
6f02a879 143
6f02a879
VZ
144 // draw child background
145 virtual bool MSWPrintChild(WXHDC hDC, wxWindow *win);
d9317033
VZ
146
147 virtual bool MSWHasInheritableBackground() const { return true; }
bc8793f4
WS
148#endif // wxUSE_UXTHEME
149
150 // translate wxWin styles to the Windows ones
151 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
6f02a879 152
b5f2afe5
VZ
153protected:
154 // common part of all ctors
155 void Init();
156
5482ee07 157 // hides the currently shown page and shows the given one (if not -1) and
681be2ef 158 // updates m_selection accordingly
5482ee07 159 void UpdateSelection(int selNew);
1d6fcbcc 160
1e6feb95 161 // remove one page from the notebook, without deleting
15aad3b9 162 virtual wxNotebookPage *DoRemovePage(size_t nPage);
1e6feb95 163
c3732409
VZ
164 // get the page rectangle for the current notebook size
165 //
166 // returns empty rectangle if an error occurs, do test for it
167 wxRect GetPageSize() const;
168
2015f2b3
VZ
169 // set the size of the given page to fit in the notebook
170 void AdjustPageSize(wxNotebookPage *page);
171
ffafd8a5 172#if wxUSE_UXTHEME
0a81f130
VZ
173 // return the themed brush for painting our children
174 virtual WXHBRUSH MSWGetCustomBgBrush() { return m_hbrBackground; }
175
de359565
VZ
176 // gets the bitmap of notebook background and returns a brush from it
177 WXHBRUSH QueryBgBitmap();
c4a95f6f 178
caf95d2a
VZ
179 // creates the brush to be used for drawing the tab control background
180 void UpdateBgBrush();
07c19327 181
c3732409
VZ
182 // common part of QueryBgBitmap() and MSWPrintChild()
183 //
184 // if child == NULL, draw background for the entire notebook itself
185 bool DoDrawBackground(WXHDC hDC, wxWindow *child = NULL);
caf95d2a 186#endif // wxUSE_UXTHEME
2015f2b3 187
dfb47d83
VZ
188 // these function are only used for reducing flicker on notebook resize and
189 // we don't need to do this for WinCE
190#ifndef __WXWINCE__
191 void OnEraseBackground(wxEraseEvent& event);
192 void OnPaint(wxPaintEvent& event);
193
194 // true if we have already subclassed our updown control
195 bool m_hasSubclassedUpdown;
feb32e31
VZ
196
197 // true if we already refreshed the current page after showing the window
198 bool m_doneUpdateHack;
dfb47d83
VZ
199#endif // __WXWINCE__
200
caf95d2a
VZ
201#if wxUSE_UXTHEME
202 // background brush used to paint the tab control
203 WXHBRUSH m_hbrBackground;
204#endif // wxUSE_UXTHEME
8acd402f 205
2015f2b3 206
fc7a2a60 207 DECLARE_DYNAMIC_CLASS_NO_COPY(wxNotebook)
b5f2afe5
VZ
208 DECLARE_EVENT_TABLE()
209};
210
1e6feb95
VZ
211#endif // wxUSE_NOTEBOOK
212
b5f2afe5 213#endif // _NOTEBOOK_H