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