]>
Commit | Line | Data |
---|---|---|
0e320a79 DW |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: notebook.h | |
3 | // Purpose: MSW/GTK compatible notebook (a.k.a. property sheet) | |
cdf1e714 | 4 | // Author: David Webster |
0e320a79 DW |
5 | // Modified by: |
6 | // RCS-ID: $Id$ | |
cdf1e714 DW |
7 | // Copyright: (c) David Webster |
8 | // Licence: wxWindows licence | |
0e320a79 DW |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
f289196b DW |
11 | #ifndef _NOTEBOOK_H |
12 | #define _NOTEBOOK_H | |
0e320a79 | 13 | |
f289196b | 14 | #if wxUSE_NOTEBOOK |
0e320a79 DW |
15 | |
16 | // ---------------------------------------------------------------------------- | |
f289196b | 17 | // headers |
0e320a79 DW |
18 | // ---------------------------------------------------------------------------- |
19 | ||
f289196b | 20 | #include "wx/control.h" |
0e320a79 | 21 | |
0e320a79 DW |
22 | // ---------------------------------------------------------------------------- |
23 | // wxNotebook | |
24 | // ---------------------------------------------------------------------------- | |
25 | ||
210a651b | 26 | class WXDLLEXPORT wxNotebook : public wxNotebookBase |
0e320a79 DW |
27 | { |
28 | public: | |
f289196b DW |
29 | // |
30 | // Ctors | |
31 | // ----- | |
32 | // Default for dynamic class | |
33 | // | |
34 | wxNotebook(); | |
35 | ||
36 | // | |
37 | // the same arguments as for wxControl | |
38 | // | |
39 | wxNotebook( wxWindow* pParent | |
40 | ,wxWindowID vId | |
41 | ,const wxPoint& rPos = wxDefaultPosition | |
42 | ,const wxSize& rSize = wxDefaultSize | |
43 | ,long lStyle = 0 | |
44 | ,const wxString& rsName = "notebook" | |
45 | ); | |
46 | ||
47 | bool Create( wxWindow* pParent | |
48 | ,wxWindowID vId | |
49 | ,const wxPoint& rPos = wxDefaultPosition | |
50 | ,const wxSize& rSize = wxDefaultSize | |
51 | ,long lStyle = 0 | |
52 | ,const wxString& rsName = "notebook" | |
53 | ); | |
54 | ||
55 | // | |
56 | // Accessors | |
57 | // --------- | |
58 | // Get number of pages in the dialog | |
59 | // | |
60 | int GetPageCount(void) const; | |
61 | ||
62 | // | |
63 | // Set the currently selected page, return the index of the previously | |
0e320a79 DW |
64 | // selected one (or -1 on error) |
65 | // NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events | |
f289196b DW |
66 | // |
67 | int SetSelection(int nPage); | |
68 | ||
69 | // | |
70 | // Get the currently selected page | |
71 | // | |
72 | inline int GetSelection(void) const { return m_nSelection; } | |
73 | ||
74 | // | |
75 | // Set/Get the title of a page | |
76 | // | |
77 | bool SetPageText( int nPage | |
78 | ,const wxString& sStrText | |
79 | ); | |
80 | wxString GetPageText(int nPage) const; | |
81 | ||
82 | // | |
83 | // Image list stuff: each page may have an image associated with it. All | |
84 | // the images belong to an image list, so you have to | |
85 | // 1) create an image list | |
86 | // 2) associate it with the notebook | |
87 | // 3) set for each page it's image | |
0e320a79 | 88 | // associate image list with a control |
f289196b DW |
89 | // |
90 | void SetImageList(wxImageList* pImageList); | |
91 | ||
92 | // | |
93 | // Sets/returns item's image index in the current image list | |
94 | // | |
95 | int GetPageImage(int nPage) const; | |
96 | bool SetPageImage( int nPage | |
97 | ,int nImage | |
98 | ); | |
99 | ||
100 | // | |
101 | // Currently it's always 1 because wxGTK doesn't support multi-row | |
0e320a79 | 102 | // tab controls |
f289196b DW |
103 | // |
104 | int GetRowCount(void) const; | |
0e320a79 | 105 | |
f289196b DW |
106 | // |
107 | // control the appearance of the notebook pages | |
0e320a79 | 108 | // set the size (the same for all pages) |
f289196b DW |
109 | // |
110 | void SetPageSize(const wxSize& rSize); | |
111 | ||
112 | // | |
113 | // Set the padding between tabs (in pixels) | |
114 | // | |
115 | void SetPadding(const wxSize& rPadding); | |
116 | ||
117 | // | |
118 | // Operations | |
119 | // ---------- | |
120 | // Remove all pages | |
121 | // | |
122 | bool DeleteAllPages(void); | |
123 | ||
124 | // | |
125 | // Adds a new page to the notebook (it will be deleted ny the notebook, | |
0e320a79 | 126 | // don't delete it yourself). If bSelect, this page becomes active. |
f289196b DW |
127 | // |
128 | bool AddPage( wxNotebookPage* pPage | |
129 | ,const wxString& rsStrText | |
130 | ,bool bSelect = FALSE | |
131 | ,int nImageId = -1 | |
132 | ); | |
133 | ||
134 | // | |
135 | // The same as AddPage(), but adds it at the specified position | |
136 | // | |
137 | bool InsertPage( int nPage | |
138 | ,wxNotebookPage* pPage | |
139 | ,const wxString& rsStrText | |
140 | ,bool bSelect = FALSE | |
141 | ,int nImageId = -1 | |
142 | ); | |
143 | ||
144 | // | |
cdf1e714 DW |
145 | // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH |
146 | // style. | |
f289196b DW |
147 | // |
148 | void SetTabSize(const wxSize& rSize); | |
149 | ||
150 | // | |
151 | // Callbacks | |
152 | // --------- | |
153 | // | |
154 | void OnSize(wxSizeEvent& rEvent); | |
155 | void OnSelChange(wxNotebookEvent& rEvent); | |
156 | void OnSetFocus(wxFocusEvent& rEvent); | |
157 | void OnNavigationKey(wxNavigationKeyEvent& rEvent); | |
158 | ||
159 | // | |
160 | // Base class virtuals | |
161 | // ------------------- | |
162 | // | |
163 | virtual bool OS2OnScroll( int nOrientation | |
164 | ,WXWORD wSBCode | |
165 | ,WXWORD wPos | |
166 | ,WXHWND hControl | |
167 | ); | |
168 | virtual void SetConstraintSizes(bool bRecurse = TRUE); | |
169 | virtual bool DoPhase(int nPhase); | |
170 | ||
171 | protected: | |
172 | // | |
173 | // Common part of all ctors | |
174 | // | |
175 | void Init(void); | |
cdf1e714 | 176 | |
f289196b DW |
177 | // |
178 | // Translate wxWin styles to the PM ones | |
179 | // | |
180 | virtual WXDWORD OS2GetStyle( long lFlags | |
181 | ,WXDWORD* pwExstyle = NULL | |
182 | ) const; | |
cdf1e714 | 183 | |
f289196b DW |
184 | // |
185 | // Remove one page from the notebook, without deleting | |
186 | // | |
187 | virtual wxNotebookPage* DoRemovePage(int nPage); | |
0e320a79 | 188 | |
f289196b DW |
189 | // |
190 | // Helper functions | |
191 | // | |
f289196b DW |
192 | |
193 | int m_nSelection; // The current selection (-1 if none) | |
0e320a79 | 194 | |
f289196b DW |
195 | private: |
196 | wxArrayLong m_alPageId; | |
197 | int m_nTabSize; // holds the largest tab size | |
0e320a79 | 198 | |
f289196b DW |
199 | DECLARE_DYNAMIC_CLASS(wxNotebook) |
200 | DECLARE_EVENT_TABLE() | |
201 | }; // end of CLASS wxNotebook | |
0e320a79 | 202 | |
f289196b | 203 | #endif // wxUSE_NOTEBOOK |
0e320a79 | 204 | |
f289196b | 205 | #endif // _NOTEBOOK_H |
0e320a79 | 206 |