]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/notebook.h
removed wxFunction
[wxWidgets.git] / include / wx / msw / notebook.h
CommitLineData
b5f2afe5
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: msw/notebook.h
3// Purpose: MSW/GTK compatible notebook (a.k.a. property sheet)
4// Author: Robert Roebling
5// Modified by: Vadim Zeitlin for Windows version
6// RCS-ID: $Id$
371a5b4e
JS
7// Copyright: (c) Julian Smart
8// Licence: wxWindows licence
b5f2afe5
VZ
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _NOTEBOOK_H
12#define _NOTEBOOK_H
13
14#ifdef __GNUG__
15 #pragma interface "notebook.h"
16#endif
17
1e6feb95
VZ
18#if wxUSE_NOTEBOOK
19
b5f2afe5
VZ
20// ----------------------------------------------------------------------------
21// headers
22// ----------------------------------------------------------------------------
74b31181 23
7c0ea335 24#include "wx/control.h"
b5f2afe5 25
b5f2afe5
VZ
26// ----------------------------------------------------------------------------
27// wxNotebook
28// ----------------------------------------------------------------------------
29
17816c2e
JS
30/*
31 * Flags returned by HitTest
32 */
33
34#define wxNB_HITTEST_NOWHERE 1
35#define wxNB_HITTEST_ONICON 2
36#define wxNB_HITTEST_ONLABEL 4
37#define wxNB_HITTEST_ONITEM 6
38
1e6feb95 39class WXDLLEXPORT wxNotebook : public wxNotebookBase
b5f2afe5
VZ
40{
41public:
42 // ctors
43 // -----
44 // default for dynamic class
45 wxNotebook();
46 // the same arguments as for wxControl (@@@ any special styles?)
47 wxNotebook(wxWindow *parent,
35eca07c 48 wxWindowID id,
b5f2afe5
VZ
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
debe6624 51 long style = 0,
2b5f62a0 52 const wxString& name = wxNOTEBOOK_NAME);
b5f2afe5
VZ
53 // Create() function
54 bool Create(wxWindow *parent,
35eca07c 55 wxWindowID id,
b5f2afe5
VZ
56 const wxPoint& pos = wxDefaultPosition,
57 const wxSize& size = wxDefaultSize,
debe6624 58 long style = 0,
2b5f62a0 59 const wxString& name = wxNOTEBOOK_NAME);
b5f2afe5
VZ
60
61 // accessors
62 // ---------
63 // get number of pages in the dialog
64 int GetPageCount() const;
65
66 // set the currently selected page, return the index of the previously
67 // selected one (or -1 on error)
68 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
69 int SetSelection(int nPage);
b5f2afe5
VZ
70 // get the currently selected page
71 int GetSelection() const { return m_nSelection; }
72
73 // set/get the title of a page
74 bool SetPageText(int nPage, const wxString& strText);
75 wxString GetPageText(int nPage) const;
76
77 // image list stuff: each page may have an image associated with it. All
78 // the images belong to an image list, so you have to
79 // 1) create an image list
80 // 2) associate it with the notebook
81 // 3) set for each page it's image
82 // associate image list with a control
83 void SetImageList(wxImageList* imageList);
b5f2afe5
VZ
84
85 // sets/returns item's image index in the current image list
86 int GetPageImage(int nPage) const;
87 bool SetPageImage(int nPage, int nImage);
88
b5f2afe5
VZ
89 // currently it's always 1 because wxGTK doesn't support multi-row
90 // tab controls
91 int GetRowCount() const;
92
93 // control the appearance of the notebook pages
94 // set the size (the same for all pages)
95 void SetPageSize(const wxSize& size);
96 // set the padding between tabs (in pixels)
97 void SetPadding(const wxSize& padding);
98
85b43fbf
JS
99 // Windows only: attempts to get colour for UX theme page background
100 wxColour GetThemeBackgroundColour();
101
b5f2afe5
VZ
102 // operations
103 // ----------
b5f2afe5
VZ
104 // remove all pages
105 bool DeleteAllPages();
efa14cf2 106 // inserts a new page to the notebook (it will be deleted ny the notebook,
b5f2afe5 107 // don't delete it yourself). If bSelect, this page becomes active.
b5f2afe5
VZ
108 bool InsertPage(int nPage,
109 wxNotebookPage *pPage,
110 const wxString& strText,
111 bool bSelect = FALSE,
8a33ea62 112 int imageId = -1);
b5f2afe5 113
58a8ab88
JS
114 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
115 // style.
116 void SetTabSize(const wxSize& sz);
117
85b43fbf
JS
118 // Windows only: attempts to apply the UX theme page background to this page
119 void ApplyThemeBackground(wxWindow* window, const wxColour& colour);
17816c2e
JS
120
121 // Hit test
122 int HitTest(const wxPoint& pt, long& flags);
2ce7af35
JS
123 // calculate the size of the notebook from the size of its page
124 virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
125
b5f2afe5
VZ
126 // callbacks
127 // ---------
9026ad85 128 void OnSize(wxSizeEvent& event);
b5f2afe5 129 void OnSelChange(wxNotebookEvent& event);
8a33ea62
VZ
130 void OnSetFocus(wxFocusEvent& event);
131 void OnNavigationKey(wxNavigationKeyEvent& event);
35eca07c 132
b5f2afe5
VZ
133 // base class virtuals
134 // -------------------
0b481c72 135
a23fd0e1 136 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
0df3fbd7
VZ
137 virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
138 WXWORD pos, WXHWND control);
0b481c72
VZ
139
140#if wxUSE_CONSTRAINTS
5475b960
VZ
141 virtual void SetConstraintSizes(bool recurse = TRUE);
142 virtual bool DoPhase(int nPhase);
0b481c72 143#endif // wxUSE_CONSTRAINTS
b5f2afe5
VZ
144
145protected:
146 // common part of all ctors
147 void Init();
148
0df3fbd7
VZ
149 // translate wxWin styles to the Windows ones
150 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
151
1e6feb95
VZ
152 // remove one page from the notebook, without deleting
153 virtual wxNotebookPage *DoRemovePage(int nPage);
154
2015f2b3
VZ
155 // set the size of the given page to fit in the notebook
156 void AdjustPageSize(wxNotebookPage *page);
157
158
2b5f62a0
VZ
159 // the current selection (-1 if none)
160 int m_nSelection;
b5f2afe5 161
2015f2b3 162
b5f2afe5
VZ
163 DECLARE_DYNAMIC_CLASS(wxNotebook)
164 DECLARE_EVENT_TABLE()
165};
166
1e6feb95
VZ
167#endif // wxUSE_NOTEBOOK
168
b5f2afe5 169#endif // _NOTEBOOK_H