]>
git.saurik.com Git - wxWidgets.git/blob - interface/aui/auibook.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxAuiNotebook
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 @headerfile auibook.h wx/aui/auibook.h
13 wxAuiNotebook is part of the wxAUI class framework.
14 See also @ref overview_aui.
16 wxAuiNotebook is a notebook control which implements many features common in
17 applications with dockable panes.
18 Specifically, wxAuiNotebook implements functionality which allows the user to
19 rearrange tab order via drag-and-drop, split the tab window into many different
20 splitter configurations, and toggle through different themes to customize
21 the control's look and feel.
23 An effort has been made to try to maintain an API as similar to that of
26 The default theme that is used is wxAuiDefaultTabArt, which provides a modern,
28 The theme can be changed by calling wxAuiNotebook::SetArtProvider.
31 @style{wxAUI_NB_DEFAULT_STYLE}
32 Defined as wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE |
33 wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB.
34 @style{wxAUI_NB_TAB_SPLIT}
35 Allows the tab control to be split by dragging a tab.
36 @style{wxAUI_NB_TAB_MOVE}
37 Allows a tab to be moved horizontally by dragging.
38 @style{wxAUI_NB_TAB_EXTERNAL_MOVE}
39 Allows a tab to be moved to another tab control.
40 @style{wxAUI_NB_TAB_FIXED_WIDTH}
41 With this style, all tabs have the same width.
42 @style{wxAUI_NB_SCROLL_BUTTONS}
43 With this style, left and right scroll buttons are displayed.
44 @style{wxAUI_NB_WINDOWLIST_BUTTON}
45 With this style, a drop-down list of windows is available.
46 @style{wxAUI_NB_CLOSE_BUTTON}
47 With this style, a close button is available on the tab bar.
48 @style{wxAUI_NB_CLOSE_ON_ACTIVE_TAB}
49 With this style, the close button is visible on the active tab.
50 @style{wxAUI_NB_CLOSE_ON_ALL_TABS}
51 With this style, the close button is visible on all tabs.
53 With this style, tabs are drawn along the top of the notebook.
54 @style{wxAUI_NB_BOTTOM}
55 With this style, tabs are drawn along the bottom of the notebook.
61 class wxAuiNotebook
: public wxControl
67 Constructor. Creates a wxAuiNotebok control.
69 wxAuiNotebook(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
70 const wxPoint
& pos
= wxDefaultPosition
,
71 const wxSize
& size
= wxDefaultSize
,
72 long style
= wxAUI_NB_DEFAULT_STYLE
);
76 If the @a select parameter is @true, calling this will generate a page change event.
78 bool AddPage(wxWindow
* page
, const wxString
& caption
,
80 const wxBitmap
& bitmap
= wxNullBitmap
);
83 Sets the selection to the next or previous page.
85 void AdvanceSelection(bool forward
= true);
88 Creates the notebook window.
90 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
91 const wxPoint
& pos
= wxDefaultPosition
,
92 const wxSize
& size
= wxDefaultSize
,
96 Deletes a page at the given index.
97 Calling this method will generate a page change event.
99 bool DeletePage(size_t page
);
102 Returns the associated art provider.
104 wxAuiTabArt
* GetArtProvider() const;
107 Returns the desired height of the notebook for the given page height.
108 Use this to fit the notebook to a given page size.
110 int GetHeightForPageHeight(int pageHeight
);
113 Returns the page specified by the given index.
115 wxWindow
* GetPage(size_t page_idx
) const;
118 Returns the tab bitmap for the page.
120 wxBitmap
GetPageBitmap(size_t page
) const;
123 Returns the number of pages in the notebook.
125 size_t GetPageCount() const;
128 Returns the page index for the specified window.
129 If the window is not found in the notebook, wxNOT_FOUND is returned.
131 int GetPageIndex(wxWindow
* page_wnd
) const;
134 Returns the tab label for the page.
136 wxString
GetPageText(size_t page
) const;
139 Returns the currently selected page.
141 int GetSelection() const;
144 Returns the height of the tab control.
146 int GetTabCtrlHeight() const;
149 InsertPage() is similar to AddPage, but allows the ability to specify the
151 If the @a select parameter is @true, calling this will generate a page change
154 bool InsertPage(size_t page_idx
, wxWindow
* page
,
155 const wxString
& caption
,
157 const wxBitmap
& bitmap
= wxNullBitmap
);
160 Removes a page, without deleting the window pointer.
162 bool RemovePage(size_t page
);
165 Sets the art provider to be used by the notebook.
167 void SetArtProvider(wxAuiTabArt
* art
);
170 Sets the font for drawing the tab labels, using a bold version of the font for
173 virtual bool SetFont(const wxFont
& font
);
176 Sets the font for measuring tab labels.
178 void SetMeasuringFont(const wxFont
& font
);
181 Sets the font for drawing unselected tab labels.
183 void SetNormalFont(const wxFont
& font
);
186 Sets the bitmap for the page. To remove a bitmap from the tab caption, pass
189 bool SetPageBitmap(size_t page
, const wxBitmap
& bitmap
);
192 Sets the tab label for the page.
194 bool SetPageText(size_t page
, const wxString
& text
);
197 Sets the font for drawing selected tab labels.
199 void SetSelectedFont(const wxFont
& font
);
202 Sets the page selection. Calling this method will generate a page change event.
204 size_t SetSelection(size_t new_page
);
207 Sets the tab height. By default, the tab control height is calculated
208 by measuring the text height and bitmap sizes on the tab captions. Calling this
209 method will override that calculation and set the tab control to the specified
210 height parameter. A call to this method will override any call to
211 SetUniformBitmapSize().
213 Specifying -1 as the height will return the control to its default auto-sizing
216 virtual void SetTabCtrlHeight(int height
);
220 Split performs a split operation programmatically. The argument @a page
221 indicates the page that will be split off. This page will also become the
222 active page after the split.
224 The @a direction argument specifies where the pane should go, it should be one
225 of the following: wxTOP, wxBOTTOM, wxLEFT, or wxRIGHT.
227 void SetUniformBitmapSize(const wxSize
& size
);
228 void Split(size_t page
, int direction
);
232 Shows the window menu for the active tab control associated with this notebook,
233 and returns @true if a selection was made.
235 bool ShowWindowMenu();
242 @headerfile auibook.h wx/aui/auibook.h
246 @todo BETTER DESCRIPTION NEEDED
260 Clones the art object.
262 virtual wxAuiTabArt
* Clone() = 0;
265 Draws a background on the given area.
267 virtual void DrawBackground(wxDC
& dc
, wxWindow
* wnd
, const wxRect
& rect
) = 0;
272 virtual void DrawButton(wxDC
& dc
, wxWindow
* wnd
, const wxRect
& in_rect
,
273 int bitmap_id
, int button_state
, int orientation
,
274 wxRect
* out_rect
) = 0;
279 virtual void DrawTab(wxDC
& dc
, wxWindow
* wnd
, const wxAuiNotebookPage
& page
,
280 const wxRect
& rect
, int close_button_state
,
281 wxRect
* out_tab_rect
, wxRect
* out_button_rect
, int* x_extent
) = 0;
284 Returns the tab control size.
286 virtual int GetBestTabCtrlSize(wxWindow
*, const wxAuiNotebookPageArray
&, const wxSize
&) = 0;
289 Returns the indent size.
291 virtual int GetIndentSize() = 0;
294 Returns the tab size for the given caption, bitmap and state.
296 virtual wxSize
GetTabSize(wxDC
& dc
, wxWindow
* wnd
, const wxString
& caption
,
297 const wxBitmap
& bitmap
, bool active
,
298 int close_button_state
, int* x_extent
) = 0;
303 virtual void SetFlags(unsigned int flags
) = 0;
306 Sets the font used for calculating measurements.
308 virtual void SetMeasuringFont(const wxFont
& font
) = 0;
311 Sets the normal font for drawing labels.
313 virtual void SetNormalFont(const wxFont
& font
) = 0;
316 Sets the font for drawing text for selected UI elements.
318 virtual void SetSelectedFont(const wxFont
& font
) = 0;
321 Sets sizing information.
323 virtual void SetSizingInfo(const wxSize
& tab_ctrl_size
, size_t tab_count
) = 0;