Add wxToolbook::EnablePage()

Add functions to enable or disable pages inside wxToolbook.

Using the new functions you can present disabled icons so that the user
can expect more functionality and you do not need to add/remove pages in
different states.

Closes https://github.com/wxWidgets/wxWidgets/pull/1038
This commit is contained in:
Stefan Ziegler
2018-12-03 14:02:11 +01:00
committed by Vadim Zeitlin
parent 58f3dcf780
commit 974b7c0990
4 changed files with 71 additions and 2 deletions

View File

@@ -23,6 +23,9 @@ wxEventType wxEVT_TOOLBOOK_PAGE_CHANGING;
refer to that class documentation for now. You can also use the
@ref page_samples_notebook to see wxToolbook in action.
One feature of this class not supported by wxBookCtrlBase is the support
for disabling some of the pages, see EnablePage().
@beginStyleTable
@style{wxTBK_BUTTONBAR}
Use wxButtonToolBar-based implementation under OS X (ignored under
@@ -82,5 +85,44 @@ public:
Returns the wxToolBarBase associated with the control.
*/
wxToolBarBase* GetToolBar() const;
/**
Enables or disables the specified page.
Using this function, a page can be disabled when it can't be used, while
still remaining present to let the users know that more functionality is
available, even if currently inaccessible.
Icons for disabled pages are created by wxBitmap::ConvertToDisabled().
@param page
The index of the page.
@param enable
@true to enable the page and @false to disable it.
@return @true if successful, @false otherwise (currently only if the
index is invalid).
@since 3.1.2
*/
bool EnablePage(size_t page, bool enable);
/**
Enables or disables the specified page.
This is similar to the overload above, but finds the index of the
specified page.
@param page
Pointer of a page windows inside the book control.
@param enable
@true to enable the page and @false to disable it.
@return @true if successful, @false otherwise, e.g. if @a page is not
one of the pages of this control.
@since 3.1.2
*/
bool EnablePage(wxWindow *page, bool enable);
};