]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/notebook.h
wxWindow::GetBestSize() added
[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$
7// Copyright: (c) Julian Smart and Markus Holzem
a3622daa 8// Licence: wxWindows license
b5f2afe5
VZ
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _NOTEBOOK_H
12#define _NOTEBOOK_H
13
14#ifdef __GNUG__
15 #pragma interface "notebook.h"
16#endif
17
18// ----------------------------------------------------------------------------
19// headers
20// ----------------------------------------------------------------------------
74b31181 21
7c0ea335
VZ
22#include "wx/control.h"
23#include "wx/dynarray.h"
b5f2afe5
VZ
24
25// ----------------------------------------------------------------------------
26// types
27// ----------------------------------------------------------------------------
28
29// fwd declarations
fbc535ff
JS
30class WXDLLEXPORT wxImageList;
31class WXDLLEXPORT wxWindow;
b5f2afe5
VZ
32
33// array of notebook pages
fbc535ff 34typedef wxWindow WXDLLEXPORT wxNotebookPage; // so far, any window can be a page
184b5d99 35
a497618a 36WX_DEFINE_EXPORTED_ARRAY(wxNotebookPage *, wxArrayPages);
b5f2afe5 37
b5f2afe5
VZ
38// ----------------------------------------------------------------------------
39// wxNotebook
40// ----------------------------------------------------------------------------
41
4d0f3cd6
VZ
42// FIXME this class should really derive from wxTabCtrl, but the interface is not
43// exactly the same, so I can't do it right now and instead we reimplement
44// part of wxTabCtrl here
a3622daa 45class WXDLLEXPORT wxNotebook : public wxControl
b5f2afe5
VZ
46{
47public:
48 // ctors
49 // -----
50 // default for dynamic class
51 wxNotebook();
52 // the same arguments as for wxControl (@@@ any special styles?)
53 wxNotebook(wxWindow *parent,
35eca07c 54 wxWindowID id,
b5f2afe5
VZ
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
debe6624 57 long style = 0,
b5f2afe5
VZ
58 const wxString& name = "notebook");
59 // Create() function
60 bool Create(wxWindow *parent,
35eca07c 61 wxWindowID id,
b5f2afe5
VZ
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
debe6624 64 long style = 0,
b5f2afe5
VZ
65 const wxString& name = "notebook");
66 // dtor
67 ~wxNotebook();
68
69 // accessors
70 // ---------
71 // get number of pages in the dialog
72 int GetPageCount() const;
73
74 // set the currently selected page, return the index of the previously
75 // selected one (or -1 on error)
76 // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
77 int SetSelection(int nPage);
78 // cycle thru the tabs
79 void AdvanceSelection(bool bForward = TRUE);
80 // get the currently selected page
81 int GetSelection() const { return m_nSelection; }
82
83 // set/get the title of a page
84 bool SetPageText(int nPage, const wxString& strText);
85 wxString GetPageText(int nPage) const;
86
87 // image list stuff: each page may have an image associated with it. All
88 // the images belong to an image list, so you have to
89 // 1) create an image list
90 // 2) associate it with the notebook
91 // 3) set for each page it's image
92 // associate image list with a control
93 void SetImageList(wxImageList* imageList);
94 // get pointer (may be NULL) to the associated image list
95 wxImageList* GetImageList() const { return m_pImageList; }
96
97 // sets/returns item's image index in the current image list
98 int GetPageImage(int nPage) const;
99 bool SetPageImage(int nPage, int nImage);
100
b5f2afe5
VZ
101 // currently it's always 1 because wxGTK doesn't support multi-row
102 // tab controls
103 int GetRowCount() const;
104
105 // control the appearance of the notebook pages
106 // set the size (the same for all pages)
107 void SetPageSize(const wxSize& size);
108 // set the padding between tabs (in pixels)
109 void SetPadding(const wxSize& padding);
110
111 // operations
112 // ----------
113 // remove one page from the notebook
114 bool DeletePage(int nPage);
621793f4
JS
115 // remove one page from the notebook, without deleting
116 bool RemovePage(int nPage);
b5f2afe5
VZ
117 // remove all pages
118 bool DeleteAllPages();
119 // adds a new page to the notebook (it will be deleted ny the notebook,
120 // don't delete it yourself). If bSelect, this page becomes active.
121 bool AddPage(wxNotebookPage *pPage,
122 const wxString& strText,
123 bool bSelect = FALSE,
8a33ea62 124 int imageId = -1);
b5f2afe5
VZ
125 // the same as AddPage(), but adds it at the specified position
126 bool InsertPage(int nPage,
127 wxNotebookPage *pPage,
128 const wxString& strText,
129 bool bSelect = FALSE,
8a33ea62 130 int imageId = -1);
b5f2afe5
VZ
131 // get the panel which represents the given page
132 wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; }
133
58a8ab88
JS
134 // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH
135 // style.
136 void SetTabSize(const wxSize& sz);
137
b5f2afe5
VZ
138 // callbacks
139 // ---------
9026ad85 140 void OnSize(wxSizeEvent& event);
b5f2afe5 141 void OnSelChange(wxNotebookEvent& event);
8a33ea62
VZ
142 void OnSetFocus(wxFocusEvent& event);
143 void OnNavigationKey(wxNavigationKeyEvent& event);
35eca07c 144
b5f2afe5
VZ
145 // base class virtuals
146 // -------------------
a23fd0e1 147 virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
5475b960
VZ
148 virtual void SetConstraintSizes(bool recurse = TRUE);
149 virtual bool DoPhase(int nPhase);
b5f2afe5
VZ
150
151protected:
152 // common part of all ctors
153 void Init();
154
155 // helper functions
156 void ChangePage(int nOldSel, int nSel); // change pages
b5f2afe5
VZ
157
158 wxImageList *m_pImageList; // we can have an associated image list
159 wxArrayPages m_aPages; // array of pages
160
161 int m_nSelection; // the current selection (-1 if none)
162
163 DECLARE_DYNAMIC_CLASS(wxNotebook)
164 DECLARE_EVENT_TABLE()
165};
166
b5f2afe5 167#endif // _NOTEBOOK_H