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