]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/aui/auibook.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxAuiNotebook
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
12 wxAuiNotebook is part of the wxAUI class framework.
13 See also @ref overview_aui.
15 wxAuiNotebook is a notebook control which implements many features common in
16 applications with dockable panes.
17 Specifically, wxAuiNotebook implements functionality which allows the user to
18 rearrange tab order via drag-and-drop, split the tab window into many different
19 splitter configurations, and toggle through different themes to customize
20 the control's look and feel.
22 An effort has been made to try to maintain an API as similar to that of
23 wxNotebook (note that wxAuiNotebook does not derive from wxNotebook!).
25 The default theme that is used is wxAuiDefaultTabArt, which provides a modern,
27 The theme can be changed by calling wxAuiNotebook::SetArtProvider.
30 @style{wxAUI_NB_DEFAULT_STYLE}
31 Defined as wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE |
32 wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB.
33 @style{wxAUI_NB_TAB_SPLIT}
34 Allows the tab control to be split by dragging a tab.
35 @style{wxAUI_NB_TAB_MOVE}
36 Allows a tab to be moved horizontally by dragging.
37 @style{wxAUI_NB_TAB_EXTERNAL_MOVE}
38 Allows a tab to be moved to another tab control.
39 @style{wxAUI_NB_TAB_FIXED_WIDTH}
40 With this style, all tabs have the same width.
41 @style{wxAUI_NB_SCROLL_BUTTONS}
42 With this style, left and right scroll buttons are displayed.
43 @style{wxAUI_NB_WINDOWLIST_BUTTON}
44 With this style, a drop-down list of windows is available.
45 @style{wxAUI_NB_CLOSE_BUTTON}
46 With this style, a close button is available on the tab bar.
47 @style{wxAUI_NB_CLOSE_ON_ACTIVE_TAB}
48 With this style, the close button is visible on the active tab.
49 @style{wxAUI_NB_CLOSE_ON_ALL_TABS}
50 With this style, the close button is visible on all tabs.
52 With this style, tabs are drawn along the top of the notebook.
53 @style{wxAUI_NB_BOTTOM}
54 With this style, tabs are drawn along the bottom of the notebook.
58 @beginEventEmissionTable{wxAuiNotebookEvent}
59 @event{EVT_AUINOTEBOOK_PAGE_CLOSE(id, func)}
61 @event{EVT_AUINOTEBOOK_PAGE_CHANGED(id, func)}
63 @event{EVT_AUINOTEBOOK_PAGE_CHANGING(id, func)}
65 @event{EVT_AUINOTEBOOK_BUTTON(id, func)}
67 @event{EVT_AUINOTEBOOK_BEGIN_DRAG(id, func)}
69 @event{EVT_AUINOTEBOOK_END_DRAG(id, func)}
71 @event{EVT_AUINOTEBOOK_DRAG_MOTION(id, func)}
73 @event{EVT_AUINOTEBOOK_ALLOW_DND(id, func)}
77 @todo provide description for the events above.
82 class wxAuiNotebook
: public wxControl
91 Constructor. Creates a wxAuiNotebok control.
93 wxAuiNotebook(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
94 const wxPoint
& pos
= wxDefaultPosition
,
95 const wxSize
& size
= wxDefaultSize
,
96 long style
= wxAUI_NB_DEFAULT_STYLE
);
100 If the @a select parameter is @true, calling this will generate a page change event.
102 bool AddPage(wxWindow
* page
, const wxString
& caption
,
104 const wxBitmap
& bitmap
= wxNullBitmap
);
107 Sets the selection to the next or previous page.
109 void AdvanceSelection(bool forward
= true);
112 Creates the notebook window.
114 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
115 const wxPoint
& pos
= wxDefaultPosition
,
116 const wxSize
& size
= wxDefaultSize
,
120 Deletes a page at the given index.
121 Calling this method will generate a page change event.
123 bool DeletePage(size_t page
);
126 Returns the associated art provider.
128 wxAuiTabArt
* GetArtProvider() const;
131 Returns the desired height of the notebook for the given page height.
132 Use this to fit the notebook to a given page size.
134 int GetHeightForPageHeight(int pageHeight
);
137 Returns the page specified by the given index.
139 wxWindow
* GetPage(size_t page_idx
) const;
142 Returns the tab bitmap for the page.
144 wxBitmap
GetPageBitmap(size_t page
) const;
147 Returns the number of pages in the notebook.
149 size_t GetPageCount() const;
152 Returns the page index for the specified window.
153 If the window is not found in the notebook, wxNOT_FOUND is returned.
155 int GetPageIndex(wxWindow
* page_wnd
) const;
158 Returns the tab label for the page.
160 wxString
GetPageText(size_t page
) const;
163 Returns the currently selected page.
165 int GetSelection() const;
168 Returns the height of the tab control.
170 int GetTabCtrlHeight() const;
173 InsertPage() is similar to AddPage, but allows the ability to specify the
175 If the @a select parameter is @true, calling this will generate a page change
178 bool InsertPage(size_t page_idx
, wxWindow
* page
,
179 const wxString
& caption
,
181 const wxBitmap
& bitmap
= wxNullBitmap
);
184 Removes a page, without deleting the window pointer.
186 bool RemovePage(size_t page
);
189 Sets the art provider to be used by the notebook.
191 void SetArtProvider(wxAuiTabArt
* art
);
194 Sets the font for drawing the tab labels, using a bold version of the font for
197 virtual bool SetFont(const wxFont
& font
);
200 Sets the font for measuring tab labels.
202 void SetMeasuringFont(const wxFont
& font
);
205 Sets the font for drawing unselected tab labels.
207 void SetNormalFont(const wxFont
& font
);
210 Sets the bitmap for the page. To remove a bitmap from the tab caption, pass
213 bool SetPageBitmap(size_t page
, const wxBitmap
& bitmap
);
216 Sets the tab label for the page.
218 bool SetPageText(size_t page
, const wxString
& text
);
221 Sets the font for drawing selected tab labels.
223 void SetSelectedFont(const wxFont
& font
);
226 Sets the page selection. Calling this method will generate a page change event.
228 size_t SetSelection(size_t new_page
);
231 Sets the tab height. By default, the tab control height is calculated
232 by measuring the text height and bitmap sizes on the tab captions. Calling this
233 method will override that calculation and set the tab control to the specified
234 height parameter. A call to this method will override any call to
235 SetUniformBitmapSize().
237 Specifying -1 as the height will return the control to its default auto-sizing
240 virtual void SetTabCtrlHeight(int height
);
244 Split performs a split operation programmatically. The argument @a page
245 indicates the page that will be split off. This page will also become the
246 active page after the split.
248 The @a direction argument specifies where the pane should go, it should be one
249 of the following: wxTOP, wxBOTTOM, wxLEFT, or wxRIGHT.
251 virtual void SetUniformBitmapSize(const wxSize
& size
);
252 virtual void Split(size_t page
, int direction
);
256 Shows the window menu for the active tab control associated with this notebook,
257 and returns @true if a selection was made.
259 bool ShowWindowMenu();
269 @todo BETTER DESCRIPTION NEEDED
283 Clones the art object.
285 virtual wxAuiTabArt
* Clone() = 0;
288 Draws a background on the given area.
290 virtual void DrawBackground(wxDC
& dc
, wxWindow
* wnd
, const wxRect
& rect
) = 0;
295 virtual void DrawButton(wxDC
& dc
, wxWindow
* wnd
, const wxRect
& in_rect
,
296 int bitmap_id
, int button_state
, int orientation
,
297 wxRect
* out_rect
) = 0;
302 virtual void DrawTab(wxDC
& dc
, wxWindow
* wnd
, const wxAuiNotebookPage
& page
,
303 const wxRect
& rect
, int close_button_state
,
304 wxRect
* out_tab_rect
, wxRect
* out_button_rect
, int* x_extent
) = 0;
307 Returns the tab control size.
309 virtual int GetBestTabCtrlSize(wxWindow
*, const wxAuiNotebookPageArray
&, const wxSize
&) = 0;
312 Returns the indent size.
314 virtual int GetIndentSize() = 0;
317 Returns the tab size for the given caption, bitmap and state.
319 virtual wxSize
GetTabSize(wxDC
& dc
, wxWindow
* wnd
, const wxString
& caption
,
320 const wxBitmap
& bitmap
, bool active
,
321 int close_button_state
, int* x_extent
) = 0;
326 virtual void SetFlags(unsigned int flags
) = 0;
329 Sets the font used for calculating measurements.
331 virtual void SetMeasuringFont(const wxFont
& font
) = 0;
334 Sets the normal font for drawing labels.
336 virtual void SetNormalFont(const wxFont
& font
) = 0;
339 Sets the font for drawing text for selected UI elements.
341 virtual void SetSelectedFont(const wxFont
& font
) = 0;
344 Sets sizing information.
346 virtual void SetSizingInfo(const wxSize
& tab_ctrl_size
, size_t tab_count
) = 0;