diff --git a/Makefile.in b/Makefile.in
index 2186b07fb2..c42923b822 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -4214,6 +4214,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
wx/rawbmp.h \
wx/region.h \
wx/scopeguard.h \
+ wx/simplebook.h \
wx/spinbutt.h \
wx/spinctrl.h \
wx/splitter.h \
diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl
index 2743fc28ad..68b17dfa2f 100644
--- a/build/bakefiles/files.bkl
+++ b/build/bakefiles/files.bkl
@@ -988,6 +988,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/rawbmp.h
wx/region.h
wx/scopeguard.h
+ wx/simplebook.h
wx/spinbutt.h
wx/spinctrl.h
wx/splitter.h
diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp
index fcb212d7dd..0081ea8084 100644
--- a/build/msw/wx_core.dsp
+++ b/build/msw/wx_core.dsp
@@ -6867,6 +6867,10 @@ SOURCE=..\..\include\wx\settings.h
# End Source File
# Begin Source File
+SOURCE=..\..\include\wx\simplebook.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\wx\sizer.h
# End Source File
# Begin Source File
diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj
index 8a487e1b3f..3830b5e547 100644
--- a/build/msw/wx_vc7_core.vcproj
+++ b/build/msw/wx_vc7_core.vcproj
@@ -5714,6 +5714,9 @@
+
+
diff --git a/build/msw/wx_vc8_core.vcproj b/build/msw/wx_vc8_core.vcproj
index effbc7b4e0..065ed13c3e 100644
--- a/build/msw/wx_vc8_core.vcproj
+++ b/build/msw/wx_vc8_core.vcproj
@@ -7639,6 +7639,10 @@
RelativePath="..\..\include\wx\settings.h"
>
+
+
diff --git a/build/msw/wx_vc9_core.vcproj b/build/msw/wx_vc9_core.vcproj
index fcd0fbf4ae..26126cba07 100644
--- a/build/msw/wx_vc9_core.vcproj
+++ b/build/msw/wx_vc9_core.vcproj
@@ -7635,6 +7635,10 @@
RelativePath="..\..\include\wx\settings.h"
>
+
+
diff --git a/docs/changes.txt b/docs/changes.txt
index 119b685d34..3d6053886d 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -535,8 +535,9 @@ All:
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).
diff --git a/docs/doxygen/mainpages/cat_classes.h b/docs/doxygen/mainpages/cat_classes.h
index fd4c127f37..539ea9b10f 100644
--- a/docs/doxygen/mainpages/cat_classes.h
+++ b/docs/doxygen/mainpages/cat_classes.h
@@ -254,6 +254,8 @@ The following are a variety of classes that are derived from wxWindow.
@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.
diff --git a/docs/doxygen/overviews/bookctrl.h b/docs/doxygen/overviews/bookctrl.h
index f71f172757..9b4677e4ee 100644
--- a/docs/doxygen/overviews/bookctrl.h
+++ b/docs/doxygen/overviews/bookctrl.h
@@ -15,6 +15,7 @@ Classes:
@li wxChoicebook
@li wxListbook
@li wxNotebook
+@li wxSimplebook
@li wxTreebook
@li wxToolbook
@@ -35,11 +36,15 @@ displayed one page at a time. wxWidgets has five variants of this control:
@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
diff --git a/include/wx/simplebook.h b/include/wx/simplebook.h
new file mode 100644
index 0000000000..e99f44d370
--- /dev/null
+++ b/include/wx/simplebook.h
@@ -0,0 +1,206 @@
+///////////////////////////////////////////////////////////////////////////////
+// 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
+// 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 m_pageTexts;
+
+ wxShowEffect m_showEffect,
+ m_hideEffect;
+
+ unsigned m_showTimeout,
+ m_hideTimeout;
+
+ wxDECLARE_NO_COPY_CLASS(wxSimplebook);
+};
+
+#endif // wxUSE_BOOKCTRL
+
+#endif // _WX_SIMPLEBOOK_H_
diff --git a/interface/wx/simplebook.h b/interface/wx/simplebook.h
new file mode 100644
index 0000000000..2fe9c5f67c
--- /dev/null
+++ b/interface/wx/simplebook.h
@@ -0,0 +1,129 @@
+/////////////////////////////////////////////////////////////////////////////
+// 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 SetEffects(effect, effect)
.
+
+ @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 SetEffectsTimeouts(timeout, timeout)
.
+
+ @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);
+};
diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp
index 1ddbfbbe17..46da69e90f 100644
--- a/samples/notebook/notebook.cpp
+++ b/samples/notebook/notebook.cpp
@@ -302,7 +302,7 @@ MyFrame::MyFrame()
#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;
@@ -335,6 +335,7 @@ MyFrame::MyFrame()
#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);
@@ -489,7 +490,9 @@ MyFrame::~MyFrame()
#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) \
@@ -498,9 +501,10 @@ MyFrame::~MyFrame()
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()
@@ -554,6 +558,7 @@ void MyFrame::RecreateBook()
wxTreebook,
wxToolbook,
wxAuiNotebook,
+ wxSimplebook,
(m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, flags));
if ( !m_bookCtrl )
diff --git a/samples/notebook/notebook.h b/samples/notebook/notebook.h
index 914535986e..416e31918c 100644
--- a/samples/notebook/notebook.h
+++ b/samples/notebook/notebook.h
@@ -13,6 +13,7 @@
#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"
@@ -108,6 +109,7 @@ private:
Type_Treebook,
Type_Toolbook,
Type_AuiNotebook,
+ Type_Simplebook,
Type_Max
} m_type;
int m_orient;
@@ -144,6 +146,7 @@ enum ID_COMMANDS
ID_BOOK_TREEBOOK,
ID_BOOK_TOOLBOOK,
ID_BOOK_AUINOTEBOOK,
+ ID_BOOK_SIMPLEBOOK,
ID_BOOK_MAX,
ID_ORIENT_DEFAULT,