]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxTabView}}\label{wxtabview} | |
2 | ||
3 | Responsible for drawing tabs onto a window, and dealing with input. | |
4 | ||
5 | Please note that the preferred class for programming tabbed windows is \helpref{wxNotebook}{wxnotebook}. | |
6 | This class is retained for backward compatibility. | |
7 | ||
8 | \wxheading{Derived from} | |
9 | ||
10 | \helpref{wxObject}{wxobject} | |
11 | ||
12 | \wxheading{Include files} | |
13 | ||
14 | <wx/tab.h> | |
15 | ||
16 | \wxheading{See also} | |
17 | ||
18 | \helpref{wxTabView overview}{wxtabviewoverview}, \helpref{wxPanelTabView}{wxpaneltabview} | |
19 | ||
20 | \latexignore{\rtfignore{\wxheading{Members}}} | |
21 | ||
22 | \membersection{wxTabView::wxTabView} | |
23 | ||
24 | \func{}{wxTabView}{\param{long }{style = wxTAB\_STYLE\_DRAW\_BOX \pipe wxTAB\_STYLE\_COLOUR\_INTERIOR}} | |
25 | ||
26 | Constructor. | |
27 | ||
28 | {\it style} may be a bit list of the following: | |
29 | ||
30 | \begin{twocollist}\itemsep=0pt | |
31 | \twocolitem{wxTAB\_STYLE\_DRAW\_BOX}{Draw a box around the view area. Most commonly used for dialogs.} | |
32 | \twocolitem{wxTAB\_STYLE\_COLOUR\_INTERIOR}{Draw tab backgrounds in the specified colour. Omitting this style | |
33 | will ensure that the tab background matches the dialog background.} | |
34 | \end{twocollist} | |
35 | ||
36 | \membersection{wxTabView::AddTab}\label{wxtabviewaddtab} | |
37 | ||
38 | \func{wxTabControl *}{AddTab}{\param{int}{ id}, \param{const wxString\& }{label}, \param{wxTabControl *}{existingTab=NULL}} | |
39 | ||
40 | Adds a tab to the view. | |
41 | ||
42 | {\it id} is the application-chosen identifier for the tab, which will be used in subsequent tab operations. | |
43 | ||
44 | {\it label} is the label to give the tab. | |
45 | ||
46 | {\it existingTab} maybe NULL to specify a new tab, or non-NULL to indicate that an existing tab should be used. | |
47 | ||
48 | A new layer (row) is started when the current layer has been filled up with tabs. | |
49 | ||
50 | \membersection{wxTabView::CalculateTabWidth}\label{wxtabviewcalculatetabwidth} | |
51 | ||
52 | \func{int}{CalculateTabWidth}{\param{int}{ noTabs}, \param{bool}{ adjustView = false}} | |
53 | ||
54 | The application can specify the tab width using this function, in terms | |
55 | of the number of tabs per layer (row) which will fit the view area, which | |
56 | should have been set previously with SetViewRect. | |
57 | ||
58 | {\it noTabs} is the number of tabs which should take up the full width | |
59 | of the view area. | |
60 | ||
61 | {\it adjustView} can be set to true in order to readjust the view width | |
62 | to exactly fit the given number of tabs. | |
63 | ||
64 | The new tab width is returned. | |
65 | ||
66 | \membersection{wxTabView::ClearTabs} | |
67 | ||
68 | \func{void}{ClearTabs}{\param{bool }{deleteTabs=true}} | |
69 | ||
70 | Clears the tabs, deleting them if {\it deleteTabs} is true. | |
71 | ||
72 | \membersection{wxTabView::Draw} | |
73 | ||
74 | \func{void}{Draw}{\param{wxDC\& }{dc}} | |
75 | ||
76 | Draws the tabs and (optionally) a box around the view area. | |
77 | ||
78 | \membersection{wxTabView::FindTabControlForId} | |
79 | ||
80 | \func{wxTabControl *}{FindTabControlForId}{\param{int}{ id}} | |
81 | ||
82 | Finds the wxTabControl corresponding to {\it id}. | |
83 | ||
84 | \membersection{wxTabView::FindTabControlForPosition} | |
85 | ||
86 | \func{wxTabControl *}{FindTabControlForPosition}{\param{int}{ layer}, \param{int}{ position}} | |
87 | ||
88 | Finds the wxTabControl at layer {\it layer}, position in layer {\it position}, both starting from | |
89 | zero. Note that tabs change layer as they are selected or deselected. | |
90 | ||
91 | \membersection{wxTabView::GetBackgroundBrush} | |
92 | ||
93 | \func{wxBrush *}{GetBackgroundBrush}{\void} | |
94 | ||
95 | Returns the brush used to draw in the background colour. It is set when | |
96 | SetBackgroundColour is called. | |
97 | ||
98 | \membersection{wxTabView::GetBackgroundColour} | |
99 | ||
100 | \func{wxColour}{GetBackgroundColour}{\void} | |
101 | ||
102 | Returns the colour used for each tab background. By default, this is | |
103 | light grey. To ensure a match with the dialog or panel background, omit | |
104 | the wxTAB\_STYLE\_COLOUR\_INTERIOR flag from the wxTabView constructor. | |
105 | ||
106 | \membersection{wxTabView::GetBackgroundPen} | |
107 | ||
108 | \func{wxPen *}{GetBackgroundPen}{\void} | |
109 | ||
110 | Returns the pen used to draw in the background colour. It is set when | |
111 | SetBackgroundColour is called. | |
112 | ||
113 | \membersection{wxTabView::GetHighlightColour} | |
114 | ||
115 | \func{wxColour}{GetHighlightColour}{\void} | |
116 | ||
117 | Returns the colour used for bright highlights on the left side of `3D' surfaces. By default, this is white. | |
118 | ||
119 | \membersection{wxTabView::GetHighlightPen} | |
120 | ||
121 | \func{wxPen *}{GetHighlightPen}{\void} | |
122 | ||
123 | Returns the pen used to draw 3D effect highlights. This is set when | |
124 | SetHighlightColour is called. | |
125 | ||
126 | \membersection{wxTabView::GetHorizontalTabOffset} | |
127 | ||
128 | \func{int}{GetHorizontalTabOffset}{\void} | |
129 | ||
130 | Returns the horizontal spacing by which each tab layer is offset from the one below. | |
131 | ||
132 | \membersection{wxTabView::GetNumberOfLayers} | |
133 | ||
134 | \func{int}{GetNumberOfLayers}{\void} | |
135 | ||
136 | Returns the number of layers (rows of tabs). | |
137 | ||
138 | \membersection{wxTabView::GetSelectedTabFont} | |
139 | ||
140 | \func{wxFont *}{GetSelectedTabFont}{\void} | |
141 | ||
142 | Returns the font to be used for the selected tab label. | |
143 | ||
144 | \membersection{wxTabView::GetShadowColour} | |
145 | ||
146 | \func{wxColour}{GetShadowColour}{\void} | |
147 | ||
148 | Returns the colour used for shadows on the right-hand side of `3D' surfaces. By default, this is dark grey. | |
149 | ||
150 | \membersection{wxTabView::GetTabHeight} | |
151 | ||
152 | \func{int}{GetTabHeight}{\void} | |
153 | ||
154 | Returns the tab default height. | |
155 | ||
156 | \membersection{wxTabView::GetTabFont} | |
157 | ||
158 | \func{wxFont *}{GetTabFont}{\void} | |
159 | ||
160 | Returns the tab label font. | |
161 | ||
162 | \membersection{wxTabView::GetTabSelectionHeight} | |
163 | ||
164 | \func{int}{GetTabSelectionHeight}{\void} | |
165 | ||
166 | Returns the height to be used for the currently selected tab; normally a few pixels | |
167 | higher than the other tabs. | |
168 | ||
169 | \membersection{wxTabView::GetTabStyle} | |
170 | ||
171 | \func{long}{GetTabStyle}{\void} | |
172 | ||
173 | Returns the tab style. See constructor documentation for details of valid styles. | |
174 | ||
175 | \membersection{wxTabView::GetTabWidth} | |
176 | ||
177 | \func{int}{GetTabWidth}{\void} | |
178 | ||
179 | Returns the tab default width. | |
180 | ||
181 | \membersection{wxTabView::GetTextColour} | |
182 | ||
183 | \func{wxColour}{GetTextColour}{\void} | |
184 | ||
185 | Returns the colour used to draw label text. By default, this is | |
186 | black. | |
187 | ||
188 | \membersection{wxTabView::GetTopMargin} | |
189 | ||
190 | \func{int}{GetTopMargin}{\void} | |
191 | ||
192 | Returns the height between the top of the view area and the bottom of the first | |
193 | row of tabs. | |
194 | ||
195 | \membersection{wxTabView::GetShadowPen} | |
196 | ||
197 | \func{wxPen *}{GetShadowPen}{\void} | |
198 | ||
199 | Returns the pen used to draw 3D effect shadows. This is set when | |
200 | SetShadowColour is called. | |
201 | ||
202 | \membersection{wxTabView::GetViewRect} | |
203 | ||
204 | \func{wxRectangle}{GetViewRect}{\void} | |
205 | ||
206 | Returns the rectangle specifying the view area (above which tabs are | |
207 | placed). | |
208 | ||
209 | \membersection{wxTabView::GetVerticalTabTextSpacing} | |
210 | ||
211 | \func{int}{GetVerticalTabTextSpacing}{\void} | |
212 | ||
213 | Returns the vertical spacing between the top of an unselected tab, and the tab label. | |
214 | ||
215 | \membersection{wxTabView::GetWindow} | |
216 | ||
217 | \func{wwxWindow *}{GetWindow}{\void} | |
218 | ||
219 | Returns the window for the view. | |
220 | ||
221 | \membersection{wxTabView::OnCreateTabControl} | |
222 | ||
223 | \func{wxTabControl *}{OnCreateTabControl}{\void} | |
224 | ||
225 | Creates a new tab control. By default, this returns a wxTabControl object, but the application may wish | |
226 | to define a derived class, in which case the tab view should be subclassed and this function overridden. | |
227 | ||
228 | \membersection{wxTabView::LayoutTabs} | |
229 | ||
230 | \func{void}{LayoutTabs}{\void} | |
231 | ||
232 | Recalculates the positions of the tabs, and adjusts the layer of the selected tab if necessary. | |
233 | ||
234 | You may want to call this function if the view width has changed (for example, from an OnSize handler). | |
235 | ||
236 | \membersection{wxTabView::OnEvent} | |
237 | ||
238 | \func{bool}{OnEvent}{\param{wxMouseEvent\& }{event}} | |
239 | ||
240 | Processes mouse events sent from the panel or dialog. Returns true if the event was processed, | |
241 | false otherwise. | |
242 | ||
243 | \membersection{wxTabView::OnTabActivate} | |
244 | ||
245 | \func{void}{OnTabActivate}{\param{int}{ activateId}, \param{int}{ deactivateId}} | |
246 | ||
247 | Called when a tab is activated, with the new active tab id, and the former active tab id. | |
248 | ||
249 | \membersection{wxTabView::OnTabPreActivate} | |
250 | ||
251 | \func{bool}{OnTabPreActivate}{\param{int}{ activateId}, \param{int}{ deactivateId}} | |
252 | ||
253 | Called just before a tab is activated, with the new active tab id, and the former active tab id. | |
254 | ||
255 | If the function returns false, the tab is not activated. | |
256 | ||
257 | \membersection{wxTabView::SetBackgroundColour} | |
258 | ||
259 | \func{void}{SetBackgroundColour}{\param{const wxColour\&}{ col}} | |
260 | ||
261 | Sets the colour to be used for each tab background. By default, this is | |
262 | light grey. To ensure a match with the dialog or panel background, omit | |
263 | the wxTAB\_STYLE\_COLOUR\_INTERIOR flag from the wxTabView constructor. | |
264 | ||
265 | \membersection{wxTabView::SetHighlightColour} | |
266 | ||
267 | \func{void}{SetHighlightColour}{\param{const wxColour\&}{ col}} | |
268 | ||
269 | Sets the colour to be used for bright highlights on the left side of `3D' surfaces. By default, this is white. | |
270 | ||
271 | \membersection{wxTabView::SetHorizontalTabOffset} | |
272 | ||
273 | \func{void}{SetHorizontalTabOffset}{\param{int}{ offset}} | |
274 | ||
275 | Sets the horizontal spacing by which each tab layer is offset from the one below. | |
276 | ||
277 | \membersection{wxTabView::SetSelectedTabFont} | |
278 | ||
279 | \func{void}{SetSelectedTabFont}{\param{wxFont *}{font}} | |
280 | ||
281 | Sets the font to be used for the selected tab label. | |
282 | ||
283 | \membersection{wxTabView::SetShadowColour} | |
284 | ||
285 | \func{void}{SetShadowColour}{\param{const wxColour\&}{ col}} | |
286 | ||
287 | Sets the colour to be used for shadows on the right-hand side of `3D' surfaces. By default, this is dark grey. | |
288 | ||
289 | \membersection{wxTabView::SetTabFont} | |
290 | ||
291 | \func{void}{SetTabFont}{\param{wxFont *}{font}} | |
292 | ||
293 | Sets the tab label font. | |
294 | ||
295 | \membersection{wxTabView::SetTabStyle} | |
296 | ||
297 | \func{void}{SetTabStyle}{\param{long}{ tabStyle}} | |
298 | ||
299 | Sets the tab style. See constructor documentation for details of valid styles. | |
300 | ||
301 | \membersection{wxTabView::SetTabSize} | |
302 | ||
303 | \func{void}{SetTabSize}{\param{int}{ width}, \param{int}{ height}} | |
304 | ||
305 | Sets the tab default width and height. | |
306 | ||
307 | \membersection{wxTabView::SetTabSelectionHeight} | |
308 | ||
309 | \func{void}{SetTabSelectionHeight}{\param{int}{ height}} | |
310 | ||
311 | Sets the height to be used for the currently selected tab; normally a few pixels | |
312 | higher than the other tabs. | |
313 | ||
314 | \membersection{wxTabView::SetTabSelection} | |
315 | ||
316 | \func{void}{SetTabSelection}{\param{int}{ sel}, \param{bool}{ activateTool=true}} | |
317 | ||
318 | Sets the selected tab, calling the application's OnTabActivate function. | |
319 | ||
320 | If {\it activateTool} is false, OnTabActivate will not be called. | |
321 | ||
322 | \membersection{wxTabView::SetTextColour} | |
323 | ||
324 | \func{void}{SetTextColour}{\param{const wxColour\&}{ col}} | |
325 | ||
326 | Sets the colour to be used to draw label text. By default, this is | |
327 | black. | |
328 | ||
329 | \membersection{wxTabView::SetTopMargin} | |
330 | ||
331 | \func{void}{SetTopMargin}{\param{int}{ margin}} | |
332 | ||
333 | Sets the height between the top of the view area and the bottom of the first | |
334 | row of tabs. | |
335 | ||
336 | \membersection{wxTabView::SetVerticalTabTextSpacing} | |
337 | ||
338 | \func{void}{SetVerticalTabTextSpacing}{\param{int}{ spacing}} | |
339 | ||
340 | Sets the vertical spacing between the top of an unselected tab, and the tab label. | |
341 | ||
342 | \membersection{wxTabView::SetViewRect}\label{wxtabviewsetviewrect} | |
343 | ||
344 | \func{void}{SetViewRect}{\param{const wxRectangle\& }{rect}} | |
345 | ||
346 | Sets the rectangle specifying the view area (above which tabs are | |
347 | placed). This must be set by the application. | |
348 | ||
349 | \membersection{wxTabView::SetWindow} | |
350 | ||
351 | \func{void}{SetWindow}{\param{wxWindow *}{window}} | |
352 | ||
353 | Set the window that the tab view will use for drawing onto. | |
354 | ||
355 |