wx/rawbmp.h \
wx/region.h \
wx/scopeguard.h \
+ wx/simplebook.h \
wx/spinbutt.h \
wx/spinctrl.h \
wx/splitter.h \
wx/rawbmp.h
wx/region.h
wx/scopeguard.h
+ wx/simplebook.h
wx/spinbutt.h
wx/spinctrl.h
wx/splitter.h
# End Source File\r
# Begin Source File\r
\r
+SOURCE=..\..\include\wx\simplebook.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\wx\sizer.h\r
# End Source File\r
# Begin Source File\r
<File\r
RelativePath="..\..\include\wx\settings.h">\r
</File>\r
+ <File\r
+ RelativePath="..\..\include\wx\simplebook.h">\r
+ </File>\r
<File\r
RelativePath="..\..\include\wx\sizer.h">\r
</File>\r
RelativePath="..\..\include\wx\settings.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\include\wx\simplebook.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\include\wx\sizer.h"\r
>\r
RelativePath="..\..\include\wx\settings.h"\r
>\r
</File>\r
+ <File\r
+ RelativePath="..\..\include\wx\simplebook.h"\r
+ >\r
+ </File>\r
<File\r
RelativePath="..\..\include\wx\sizer.h"\r
>\r
All (GUI):
-- Add support for searching in wxWebView for MSW and GTK (Allonii).
+- Add new wxSimplebook class.
- Respect window max size in wxBoxSizer (Nathan Ridge).
+- Add support for searching in wxWebView for MSW and GTK (Allonii).
- Add possibility to hide and show again wxRibbonBar pages (wxBen).
- Add wxRibbonBar pages highlighting (wxBen).
- Add expand/collapse button to wxRibbonBar (rakeshthp).
@li wxSashWindow: Window with four optional sashes that can be dragged
@li wxSashLayoutWindow: Window that can be involved in an IDE-like layout
arrangement
+@li wxSimplebook: Another book control but one allowing only the program, not
+ the user, to change its current page.
@li wxWizardPage: A base class for the page in wizard dialog.
@li wxWizardPageSimple: A page in wizard dialog.
@li wxCustomBackgroundWindow: A window allowing to set a custom bitmap.
@li wxChoicebook
@li wxListbook
@li wxNotebook
+@li wxSimplebook
@li wxTreebook
@li wxToolbook
@li wxChoicebook: controlled by a wxChoice
@li wxListbook: controlled by a wxListCtrl
@li wxNotebook: uses a row of tabs
+@li wxSimplebook: doesn't allow the user to change the page at all.
@li wxTreebook: controlled by a wxTreeCtrl
@li wxToolbook: controlled by a wxToolBar
See the @ref page_samples_notebook for an example of wxBookCtrl usage.
+Notice that wxSimplebook is special in that it only allows the program to
+change the selection, thus it's usually used in slightly different
+circumstances than the other variants.
@section overview_bookctrl_bestbookctrl Best Book
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/simplebook.h
+// Purpose: wxBookCtrlBase-derived class without any controller.
+// Author: Vadim Zeitlin
+// Created: 2012-08-21
+// RCS-ID: $Id$
+// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_SIMPLEBOOK_H_
+#define _WX_SIMPLEBOOK_H_
+
+#include "wx/bookctrl.h"
+
+#if wxUSE_BOOKCTRL
+
+#include "wx/vector.h"
+
+// ----------------------------------------------------------------------------
+// wxSimplebook: a book control without any user-actionable controller.
+// ----------------------------------------------------------------------------
+
+// NB: This class doesn't use DLL export declaration as it's fully inline.
+
+class wxSimplebook : public wxBookCtrlBase
+{
+public:
+ wxSimplebook()
+ {
+ Init();
+ }
+
+ wxSimplebook(wxWindow *parent,
+ wxWindowID winid = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString)
+ : wxBookCtrlBase(parent, winid, pos, size, style | wxBK_TOP, name)
+ {
+ Init();
+ }
+
+
+ // Methods specific to this class.
+
+ // A method allowing to add a new page without any label (which is unused
+ // by this control) and show it immediately.
+ bool ShowNewPage(wxWindow* page)
+ {
+ return AddPage(page, wxString(), true /* select it */);
+ }
+
+
+ // Set effect to use for showing/hiding pages.
+ void SetEffects(wxShowEffect showEffect, wxShowEffect hideEffect)
+ {
+ m_showEffect = showEffect;
+ m_hideEffect = hideEffect;
+ }
+
+ // Or the same effect for both of them.
+ void SetEffect(wxShowEffect effect)
+ {
+ SetEffects(effect, effect);
+ }
+
+ // And the same for time outs.
+ void SetEffectsTimeouts(unsigned showTimeout, unsigned hideTimeout)
+ {
+ m_showTimeout = showTimeout;
+ m_hideTimeout = hideTimeout;
+ }
+
+ void SetEffectTimeout(unsigned timeout)
+ {
+ SetEffectsTimeouts(timeout, timeout);
+ }
+
+
+ // Implement base class pure virtual methods.
+
+ // Page management
+ virtual bool InsertPage(size_t n,
+ wxWindow *page,
+ const wxString& text,
+ bool bSelect = false,
+ int imageId = NO_IMAGE)
+ {
+ if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) )
+ return false;
+
+ m_pageTexts.insert(m_pageTexts.begin() + n, text);
+
+ if ( !DoSetSelectionAfterInsertion(n, bSelect) )
+ page->Hide();
+
+ return true;
+ }
+
+ virtual int SetSelection(size_t n)
+ {
+ return DoSetSelection(n, SetSelection_SendEvent);
+ }
+
+ virtual int ChangeSelection(size_t n)
+ {
+ return DoSetSelection(n);
+ }
+
+ // Neither labels nor images are supported but we still store the labels
+ // just in case the user code attaches some importance to them.
+ virtual bool SetPageText(size_t n, const wxString& strText)
+ {
+ wxCHECK_MSG( n < GetPageCount(), false, wxS("Invalid page") );
+
+ m_pageTexts[n] = strText;
+
+ return true;
+ }
+
+ virtual wxString GetPageText(size_t n) const
+ {
+ wxCHECK_MSG( n < GetPageCount(), wxString(), wxS("Invalid page") );
+
+ return m_pageTexts[n];
+ }
+
+ virtual bool SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId))
+ {
+ return false;
+ }
+
+ virtual int GetPageImage(size_t WXUNUSED(n)) const
+ {
+ return NO_IMAGE;
+ }
+
+protected:
+ virtual void UpdateSelectedPage(size_t newsel)
+ {
+ m_selection = newsel;
+ }
+
+ virtual wxBookCtrlEvent* CreatePageChangingEvent() const
+ {
+ return new wxBookCtrlEvent(wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING,
+ GetId());
+ }
+
+ virtual void MakeChangedEvent(wxBookCtrlEvent& event)
+ {
+ event.SetEventType(wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED);
+ }
+
+ virtual wxWindow *DoRemovePage(size_t page)
+ {
+ m_pageTexts.erase(m_pageTexts.begin() + page);
+ return wxBookCtrlBase::DoRemovePage(page);
+ }
+
+ virtual void DoSize()
+ {
+ wxWindow* const page = GetCurrentPage();
+ if ( page )
+ page->SetSize(GetPageRect());
+ }
+
+ virtual void DoShowPage(wxWindow* page, bool show)
+ {
+ if ( show )
+ page->ShowWithEffect(m_showEffect, m_showTimeout);
+ else
+ page->HideWithEffect(m_hideEffect, m_hideTimeout);
+ }
+
+private:
+ void Init()
+ {
+ // We don't need any border as we don't have anything to separate the
+ // page contents from.
+ SetInternalBorder(0);
+
+ // No effects by default.
+ m_showEffect =
+ m_hideEffect = wxSHOW_EFFECT_NONE;
+
+ m_showTimeout =
+ m_hideTimeout = 0;
+ }
+
+ wxVector<wxString> m_pageTexts;
+
+ wxShowEffect m_showEffect,
+ m_hideEffect;
+
+ unsigned m_showTimeout,
+ m_hideTimeout;
+
+ wxDECLARE_NO_COPY_CLASS(wxSimplebook);
+};
+
+#endif // wxUSE_BOOKCTRL
+
+#endif // _WX_SIMPLEBOOK_H_
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/simplebook.h
+// Purpose: wxSimplebook public API documentation.
+// Author: wxWidgets team
+// RCS-ID: $Id$
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+/**
+ @class wxSimplebook
+
+ wxSimplebook is a control showing exactly one of its several pages.
+
+ It implements wxBookCtrlBase class interface but doesn't allow the user to
+ change the page being displayed, unlike all the other book control classes,
+ only the program can do it.
+
+ This class is created in the same manner as any other wxBookCtrl but then
+ the program will typically call ChangeSelection() to show different pages.
+ See the @ref page_samples_notebook for an example of wxSimplebook in
+ action.
+
+ Notice that is often convenient to use ShowNewPage() instead of the base
+ class AddPage().
+
+ There are no special styles defined for this class as it has no visual
+ appearance of its own.
+
+ There are also no special events, this class reuses
+ @c wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING and @c
+ wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED events for the events it generates if
+ the program calls SetSelection().
+
+ @library{none}
+ @category{bookctrl}
+
+ @see wxBookCtrl, wxNotebook, @ref page_samples_notebook
+
+ @since 2.9.5
+*/
+class wxSimplebook : public wxBookCtrlBase
+{
+public:
+ /**
+ Default constructor.
+
+ Use Create() (inherited from the base class) later to really create the
+ control.
+ */
+ wxSimplebook();
+
+ /**
+ Constructs a simple book control.
+ */
+ wxSimplebook(wxWindow* parent,
+ wxWindowID id = wxID_ANY,
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ long style = 0,
+ const wxString& name = wxEmptyString);
+
+
+ /**
+ Set the effects to use for showing and hiding the pages.
+
+ This method allows to specify the effects passed to
+ wxWindow::ShowWithEffect() and wxWindow::HideWithEffect() respectively
+ when the pages need to be shown or hidden.
+
+ By default, no effects are used, but as the pages are only changed
+ by the program and not the user himself, it may be useful to use some
+ visual effects to make the changes more noticeable.
+
+ @param showEffect
+ The effect to use for showing the newly selected page.
+ @param hideEffect
+ The effect to use for hiding the previously selected page.
+
+ @see SetEffectsTimeouts()
+ */
+ void SetEffects(wxShowEffect showEffect, wxShowEffect hideEffect);
+
+ /**
+ Set the same effect to use for both showing and hiding the pages.
+
+ This is the same as <code>SetEffects(effect, effect)</code>.
+
+ @see SetEffectTimeout()
+ */
+ void SetEffect(wxShowEffect effect);
+
+ /**
+ Set the effect timeout to use for showing and hiding the pages.
+
+ This method allows to configure the timeout arguments passed to
+ wxWindow::ShowWithEffect() and wxWindow::HideWithEffect() if a
+ non-default effect is used.
+
+ If this method is not called, default, system-dependent timeout is
+ used.
+
+ @param showTimeout
+ Timeout of the show effect, in milliseconds.
+ @param hideTimeout
+ Timeout of the hide effect, in milliseconds.
+
+ @see SetEffects()
+ */
+ void SetEffectsTimeouts(unsigned showTimeout, unsigned hideTimeout);
+
+ /**
+ Set the same effect timeout to use for both showing and hiding the
+ pages.
+
+ This is the same as <code>SetEffectsTimeouts(timeout, timeout)</code>.
+
+ @see SetEffect()
+ */
+ void SetEffectTimeout(unsigned timeout);
+
+ /**
+ Add a new page and show it immediately.
+
+ This is simply a thin wrapper around the base class
+ wxBookCtrlBase::AddPage() method using empty label (which is unused by
+ this class anyhow) and selecting the new page immediately.
+ */
+ bool ShowNewPage(wxWindow* page);
+};
#elif wxUSE_AUI
m_type = Type_Aui;
#else
- #error "Don't use Notebook sample without any book enabled in wxWidgets build!"
+ m_type = Type_Simplebook;
#endif
m_orient = ID_ORIENT_DEFAULT;
#if wxUSE_AUI
menuType->AppendRadioItem(ID_BOOK_AUINOTEBOOK, wxT("&AuiNotebook\tCtrl-6"));
#endif
+ menuType->AppendRadioItem(ID_BOOK_SIMPLEBOOK, "&Simple book\tCtrl-7");
menuType->Check(ID_BOOK_NOTEBOOK + m_type, true);
#define CASE_AUINOTEBOOK(x)
#endif
-#define DISPATCH_ON_TYPE(before, nb, lb, cb, tb, toolb, aui, after) \
+#define CASE_SIMPLEBOOK(x) case Type_Simplebook: x; break;
+
+#define DISPATCH_ON_TYPE(before, nb, lb, cb, tb, toolb, aui, sb, after) \
switch ( m_type ) \
{ \
CASE_NOTEBOOK(before nb after) \
CASE_TREEBOOK(before tb after) \
CASE_TOOLBOOK(before toolb after) \
CASE_AUINOTEBOOK(before aui after) \
+ CASE_SIMPLEBOOK(before sb after) \
\
default: \
- wxFAIL_MSG( wxT("unknown book control type") ); \
+ wxFAIL_MSG( wxT("unknown book control type") ); \
}
void MyFrame::RecreateBook()
wxTreebook,
wxToolbook,
wxAuiNotebook,
+ wxSimplebook,
(m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, flags));
if ( !m_bookCtrl )
#include "wx/listbook.h"
#include "wx/treebook.h"
#include "wx/notebook.h"
+#include "wx/simplebook.h"
#include "wx/toolbook.h"
#include "wx/aui/auibook.h"
Type_Treebook,
Type_Toolbook,
Type_AuiNotebook,
+ Type_Simplebook,
Type_Max
} m_type;
int m_orient;
ID_BOOK_TREEBOOK,
ID_BOOK_TOOLBOOK,
ID_BOOK_AUINOTEBOOK,
+ ID_BOOK_SIMPLEBOOK,
ID_BOOK_MAX,
ID_ORIENT_DEFAULT,