X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..7447d53c35249d42128d6243c90998f03882859a:/interface/wx/aui/auibook.h diff --git a/interface/wx/aui/auibook.h b/interface/wx/aui/auibook.h index b4d933eab3..b95461b9ae 100644 --- a/interface/wx/aui/auibook.h +++ b/interface/wx/aui/auibook.h @@ -3,12 +3,11 @@ // Purpose: interface of wxAuiNotebook // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @class wxAuiNotebook - @headerfile auibook.h wx/aui/auibook.h wxAuiNotebook is part of the wxAUI class framework. See also @ref overview_aui. @@ -20,9 +19,6 @@ splitter configurations, and toggle through different themes to customize the control's look and feel. - An effort has been made to try to maintain an API as similar to that of - wxNotebook. - The default theme that is used is wxAuiDefaultTabArt, which provides a modern, glossy look and feel. The theme can be changed by calling wxAuiNotebook::SetArtProvider. @@ -30,7 +26,8 @@ @beginStyleTable @style{wxAUI_NB_DEFAULT_STYLE} Defined as wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | - wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB. + wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | + wxAUI_NB_MIDDLE_CLICK_CLOSE. @style{wxAUI_NB_TAB_SPLIT} Allows the tab control to be split by dragging a tab. @style{wxAUI_NB_TAB_MOVE} @@ -49,18 +46,56 @@ With this style, the close button is visible on the active tab. @style{wxAUI_NB_CLOSE_ON_ALL_TABS} With this style, the close button is visible on all tabs. + @style{wxAUI_NB_MIDDLE_CLICK_CLOSE} + With this style, middle click on a tab closes the tab. @style{wxAUI_NB_TOP} With this style, tabs are drawn along the top of the notebook. @style{wxAUI_NB_BOTTOM} With this style, tabs are drawn along the bottom of the notebook. @endStyleTable + @beginEventEmissionTable{wxAuiNotebookEvent} + @event{EVT_AUINOTEBOOK_PAGE_CLOSE(id, func)} + A page is about to be closed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE event. + @event{EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn)} + A page has been closed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED event. + @event{EVT_AUINOTEBOOK_PAGE_CHANGED(id, func)} + The page selection was changed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED event. + @event{EVT_AUINOTEBOOK_PAGE_CHANGING(id, func)} + The page selection is about to be changed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING event. This event can be vetoed. + @event{EVT_AUINOTEBOOK_BUTTON(id, func)} + The window list button has been pressed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BUTTON event. + @event{EVT_AUINOTEBOOK_BEGIN_DRAG(id, func)} + Dragging is about to begin. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG event. + @event{EVT_AUINOTEBOOK_END_DRAG(id, func)} + Dragging has ended. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_END_DRAG event. + @event{EVT_AUINOTEBOOK_DRAG_MOTION(id, func)} + Emitted during a drag and drop operation. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION event. + @event{EVT_AUINOTEBOOK_ALLOW_DND(id, func)} + Whether to allow a tab to be dropped. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND event. This event must be specially allowed. + @event{EVT_AUINOTEBOOK_DRAG_DONE(winid, fn)} + Notify that the tab has been dragged. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE event. + @event{EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn)} + The middle mouse button is pressed on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN event. + @event{EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn)} + The middle mouse button is released on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP event. + @event{EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn)} + The right mouse button is pressed on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN event. + @event{EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn)} + The right mouse button is released on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP event. + @event{EVT_AUINOTEBOOK_BG_DCLICK(winid, fn)} + Double clicked on the tabs background area. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK event. + @endEventTable + @library{wxaui} @category{aui} */ -class wxAuiNotebook : public wxControl +class wxAuiNotebook : public wxBookCtrlBase { public: + /** + Default ctor. + */ wxAuiNotebook(); /** @@ -79,11 +114,48 @@ public: bool select = false, const wxBitmap& bitmap = wxNullBitmap); + /** + Adds a new page. + + The page must have the book control itself as the parent and must not + have been added to this control previously. + + The call to this function may generate the page changing events. + + @param page + Specifies the new page. + @param text + Specifies the text for the new page. + @param select + Specifies whether the page should be selected. + @param imageId + Specifies the optional image index for the new page. + + @return @true if successful, @false otherwise. + + @remarks Do not delete the page, it will be deleted by the book control. + + @see InsertPage() + @since 2.9.3 + */ + virtual bool AddPage(wxWindow *page, const wxString &text, bool select, int imageId); + /** Sets the selection to the next or previous page. */ void AdvanceSelection(bool forward = true); + /** + Changes the selection for the given page, returning the previous selection. + + This function behaves as SetSelection() but does @em not generate the + page changing events. + + See @ref overview_events_prog for more information. + @since 2.9.3 + */ + virtual int ChangeSelection(size_t n); + /** Creates the notebook window. */ @@ -92,6 +164,12 @@ public: const wxSize& size = wxDefaultSize, long style = 0); + /** + Deletes all pages. + @since 2.9.3 + */ + virtual bool DeleteAllPages(); + /** Deletes a page at the given index. Calling this method will generate a page change event. @@ -103,6 +181,12 @@ public: */ wxAuiTabArt* GetArtProvider() const; + /** + Returns the currently selected page or @NULL. + @since 2.9.3 + */ + wxWindow* GetCurrentPage () const; + /** Returns the desired height of the notebook for the given page height. Use this to fit the notebook to a given page size. @@ -135,6 +219,13 @@ public: */ wxString GetPageText(size_t page) const; + /** + Returns the tooltip for the tab label of the page. + + @since 2.9.4 + */ + wxString GetPageToolTip(size_t pageIdx) const; + /** Returns the currently selected page. */ @@ -156,6 +247,30 @@ public: bool select = false, const wxBitmap& bitmap = wxNullBitmap); + /** + Inserts a new page at the specified position. + + @param index + Specifies the position for the new page. + @param page + Specifies the new page. + @param text + Specifies the text for the new page. + @param select + Specifies whether the page should be selected. + @param imageId + Specifies the optional image index for the new page. + + @return @true if successful, @false otherwise. + + @remarks Do not delete the page, it will be deleted by the book control. + + @see AddPage() + @since 2.9.3 + */ + virtual bool InsertPage(size_t index, wxWindow *page, const wxString &text, + bool select=false, int imageId=NO_IMAGE); + /** Removes a page, without deleting the window pointer. */ @@ -188,11 +303,29 @@ public: */ bool SetPageBitmap(size_t page, const wxBitmap& bitmap); + /** + Sets the image index for the given page. @a image is an index into + the image list which was set with SetImageList(). + @since 2.9.3 + */ + virtual bool SetPageImage(size_t n, int imageId); + /** Sets the tab label for the page. */ bool SetPageText(size_t page, const wxString& text); + /** + Sets the tooltip displayed when hovering over the tab label of the page. + + @return + @true if tooltip was updated, @false if it failed, e.g. because the + page index is invalid. + + @since 2.9.4 + */ + bool SetPageToolTip(size_t page, const wxString& text); + /** Sets the font for drawing selected tab labels. */ @@ -224,8 +357,8 @@ public: The @a direction argument specifies where the pane should go, it should be one of the following: wxTOP, wxBOTTOM, wxLEFT, or wxRIGHT. */ - void SetUniformBitmapSize(const wxSize& size); - void Split(size_t page, int direction); + virtual void SetUniformBitmapSize(const wxSize& size); + virtual void Split(size_t page, int direction); //@} /** @@ -239,7 +372,6 @@ public: /** @class wxAuiTabArt - @headerfile auibook.h wx/aui/auibook.h Tab art class. @@ -317,9 +449,77 @@ public: */ virtual void SetSelectedFont(const wxFont& font) = 0; + /** + Sets the colour of the inactive tabs. + + @since 2.9.2 + */ + virtual void SetColour(const wxColour& colour) = 0; + + /** + Sets the colour of the selected tab. + + @since 2.9.2 + */ + virtual void SetActiveColour(const wxColour& colour) = 0; + /** Sets sizing information. */ virtual void SetSizingInfo(const wxSize& tab_ctrl_size, size_t tab_count) = 0; }; +/** + @class wxAuiNotebookEvent + + This class is used by the events generated by wxAuiNotebook. + + @beginEventEmissionTable{wxAuiNotebookEvent} + @event{EVT_AUINOTEBOOK_PAGE_CLOSE(id, func)} + A page is about to be closed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE event. + @event{EVT_AUINOTEBOOK_PAGE_CLOSED(winid, fn)} + A page has been closed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED event. + @event{EVT_AUINOTEBOOK_PAGE_CHANGED(id, func)} + The page selection was changed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED event. + @event{EVT_AUINOTEBOOK_PAGE_CHANGING(id, func)} + The page selection is about to be changed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING event. This event can be vetoed. + @event{EVT_AUINOTEBOOK_BUTTON(id, func)} + The window list button has been pressed. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BUTTON event. + @event{EVT_AUINOTEBOOK_BEGIN_DRAG(id, func)} + Dragging is about to begin. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG event. + @event{EVT_AUINOTEBOOK_END_DRAG(id, func)} + Dragging has ended. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_END_DRAG event. + @event{EVT_AUINOTEBOOK_DRAG_MOTION(id, func)} + Emitted during a drag and drop operation. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION event. + @event{EVT_AUINOTEBOOK_ALLOW_DND(id, func)} + Whether to allow a tab to be dropped. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND event. This event must be specially allowed. + @event{EVT_AUINOTEBOOK_DRAG_DONE(winid, fn)} + Notify that the tab has been dragged. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE event. + @event{EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN(winid, fn)} + The middle mouse button is pressed on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN event. + @event{EVT_AUINOTEBOOK_TAB_MIDDLE_UP(winid, fn)} + The middle mouse button is released on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP event. + @event{EVT_AUINOTEBOOK_TAB_RIGHT_DOWN(winid, fn)} + The right mouse button is pressed on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_DOWN event. + @event{EVT_AUINOTEBOOK_TAB_RIGHT_UP(winid, fn)} + The right mouse button is released on a tab. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP event. + @event{EVT_AUINOTEBOOK_BG_DCLICK(winid, fn)} + Double clicked on the tabs background area. Processes a @c wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK event. + @endEventTable + + @library{wxaui} + @category{events,bookctrl} + + @see wxAuiNotebook, wxBookCtrlEvent +*/ +class wxAuiNotebookEvent : public wxBookCtrlEvent +{ +public: + /** + Constructor. + */ + wxAuiNotebookEvent(wxEventType command_type = wxEVT_NULL, int win_id = 0); + + wxEvent *Clone(); +}; +