X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/12f5e1e78fe906050ff2fee9529476db332633f0..575821fad84c6f60602ffce6f8f6e727247ce651:/interface/wx/aui/auibook.h diff --git a/interface/wx/aui/auibook.h b/interface/wx/aui/auibook.h index 55d8064bbf..9f58a60a0b 100644 --- a/interface/wx/aui/auibook.h +++ b/interface/wx/aui/auibook.h @@ -3,7 +3,7 @@ // Purpose: interface of wxAuiNotebook // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -19,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. @@ -29,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} @@ -48,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(); /** @@ -78,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. */ @@ -91,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. @@ -102,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. @@ -155,6 +240,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. */ @@ -187,6 +296,13 @@ 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. */ @@ -223,8 +339,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); //@} /** @@ -315,9 +431,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(); +}; +