wxChoicebook generic implementation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29148 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-09-16 11:29:15 +00:00
parent 13bcc34881
commit f5e0b4bc7c
15 changed files with 756 additions and 67 deletions

View File

@@ -452,6 +452,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/common/xpmdecod.cpp
src/generic/busyinfo.cpp
src/generic/choicdgg.cpp
src/generic/choicbkg.cpp
src/generic/dcpsg.cpp
src/generic/dirctrlg.cpp
src/generic/dragimgg.cpp
@@ -561,6 +562,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/bookctrl.h
wx/busyinfo.h
wx/caret.h
wx/choicebk.h
wx/clipbrd.h
wx/cmdproc.h
wx/colordlg.h

View File

@@ -227,6 +227,7 @@ All (GUI):
- added wxTopLevelWindow::RequestUserAttention()
- support for comma in contrib gizmo wxLEDNumberCtrl (Grant Likely)
- recursive wxSizer::Show for subsizer and return value if element was found
- added wxChoicebook control
Unix:
@@ -404,7 +405,6 @@ All:
All (GUI):
- added wxListBook control
- added 3-state checkboxes for MSW/Mac (Dimitri Schoolwerth)
- added some support for C++ exceptions in the library (do read the manual!)
- added wxListCtrl::GetViewRect()
@@ -545,7 +545,7 @@ wxBase:
All GUI ports:
- added wxVScrolledWindow, wxVListBox and wxHtmlLbox classes
- added wxListbook
- added wxListbook control
- added alpha channel support to wxImage
- added wxRenderer class allowing to customize the drawing of generic controls
- added wxCLOSE_BOX style for dialogs and frames

View File

@@ -42,6 +42,7 @@ The following are a variety of classes that are derived from wxWindow.
%\twocolitem{\helpref{wxTabbedPanel}{wxtabbedpanel}}{Tabbed panel (to be replaced with wxNotebook)}
\twocolitem{\helpref{wxNotebook}{wxnotebook}}{Notebook class}
\twocolitem{\helpref{wxListbook}{wxlistbook}}{Similar to notebook but using list control}
\twocolitem{\helpref{wxChoicebook}{wxchoicebook}}{Similar to notebook but using choice control}
\twocolitem{\helpref{wxPlotWindow}{wxplotwindow}}{A class to display data.}
\twocolitem{\helpref{wxSashWindow}{wxsashwindow}}{Window with four optional sashes that can be dragged}
\twocolitem{\helpref{wxSashLayoutWindow}{wxsashlayoutwindow}}{Window that can be involved in an IDE-like layout arrangement}

View File

@@ -0,0 +1,52 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Name: choicebk.tex
%% Purpose: wxChoicebook documentation
%% Author: Vadim Zeitlin
%% Modified by: Wlodzimierz ABX Skiba from listbook.tex
%% Created: 15.09.04
%% RCS-ID: $Id$
%% Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba
%% License: wxWidgets license
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{\class{wxChoicebook}}\label{wxchoicebook}
wxChoicebook is a class similar to \helpref{wxNotebook}{wxnotebook} but which
uses a \helpref{wxChoice}{wxchoice} to show the labels instead of the
tabs.
There is no documentation for this class yet but its usage is
identical to wxNotebook (except for the features clearly related to tabs
only), so please refer to that class documentation for now. You can also
use the \helpref{notebook sample}{samplenotebook} to see wxChoicebook in action.
\wxheading{Derived from}
\helpref{wxControl}{wxcontrol}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/choicebk.h>
\wxheading{Window styles}
\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxCHB\_DEFAULT}}{Choose the default location for the
labels depending on the current platform (left everywhere except Mac where
it is top).}
\twocolitem{\windowstyle{wxCHB\_TOP}}{Place labels above the page area.}
\twocolitem{\windowstyle{wxCHB\_LEFT}}{Place labels on the left side.}
\twocolitem{\windowstyle{wxCHB\_RIGHT}}{Place labels on the right side.}
\twocolitem{\windowstyle{wxCHB\_BOTTOM}}{Place labels below the page area.}
\end{twocollist}
\wxheading{See also}
\helpref{wxNotebook}{wxnotebook}, \helpref{notebook sample}{samplenotebook}

View File

@@ -30,6 +30,7 @@
\input checkbox.tex
\input checklst.tex
\input choice.tex
\input choicebk.tex
\input clasinfo.tex
\input ipcclint.tex
\input clientdc.tex

View File

@@ -346,9 +346,10 @@ The sample also provides some timings for adding/deleting/sorting a lot of
This samples shows two controls at once: although initially it was written to
demonstrate \helpref{wxNotebook}{wxnotebook} only, it can now be also used
to see \helpref{wxListbook}{wxlistbook} in action. To switch between the two
controls you need to manually change \texttt{TEST\_LISTBOOK} definition in the
file \texttt{notebook.h} and rebuild the sample.
to see \helpref{wxListbook}{wxlistbook} and \helpref{wxChoicebook}{wxchoicebook}
in action. To switch between the two controls you need to manually change
\texttt{TEST\_LISTBOOK} definition in the file \texttt{notebook.h} and rebuild
the sample.

View File

@@ -291,6 +291,14 @@
# endif
#endif /* !defined(wxUSE_CHOICE) */
#ifndef wxUSE_CHOICEBOOK
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CHOICEBOOK must be defined."
# else
# define wxUSE_CHOICEBOOK 0
# endif
#endif /* !defined(wxUSE_CHOICEBOOK) */
#ifndef wxUSE_CHOICEDLG
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_CHOICEDLG must be defined."
@@ -957,7 +965,7 @@
# endif
#endif /* wxUSE_BMPBUTTON */
#if wxUSE_NOTEBOOK || wxUSE_LISTBOOK
#if wxUSE_NOTEBOOK || wxUSE_LISTBOOK || wxUSE_CHOICEBOOK
# if defined(wxUSE_BOOKCTRL) && !wxUSE_BOOKCTRL
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_BOOKCTRL must be set."
@@ -982,6 +990,17 @@
# endif
#endif /* wxUSE_LISTBOOK */
#if wxUSE_CHOICEBOOK
# if !wxUSE_CHOICE
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxChoicebook requires wxChoice"
# else
# undef wxUSE_CHOICE
# define wxUSE_CHOICE 1
# endif
# endif
#endif /* wxUSE_CHOICEBOOK */
/* wxUniv-specific dependencies */
#if defined(__WXUNIVERSAL__)
# if (wxUSE_COMBOBOX || wxUSE_MENUS) && !wxUSE_POPUPWIN

170
include/wx/choicebk.h Normal file
View File

@@ -0,0 +1,170 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/choicebk.h
// Purpose: wxChoicebook: wxChoice and wxNotebook combination
// Author: Vadim Zeitlin
// Modified by: Wlodzimierz ABX Skiba from wx/listbook.h
// Created: 15.09.04
// RCS-ID: $Id$
// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CHOICEBOOK_H_
#define _WX_CHOICEBOOK_H_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "choicebook.h"
#endif
#include "wx/defs.h"
#if wxUSE_CHOICEBOOK
#include "wx/bookctrl.h"
class WXDLLEXPORT wxChoice;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// wxChoicebook styles
enum
{
// default alignment: top everywhere
wxCHB_DEFAULT = 0,
// put the choice control to the left/right/top/bottom of the page area
wxCHB_TOP = 0x1,
wxCHB_BOTTOM = 0x2,
wxCHB_LEFT = 0x4,
wxCHB_RIGHT = 0x8,
// the mask which can be used to extract the alignment from the style
wxCHB_ALIGN_MASK = 0xf
};
// ----------------------------------------------------------------------------
// wxChoicebook
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxChoicebook : public wxBookCtrl
{
public:
wxChoicebook()
{
Init();
}
wxChoicebook(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxEmptyString)
{
Init();
(void)Create(parent, id, pos, size, style, name);
}
// quasi ctor
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxEmptyString);
virtual int GetSelection() const;
virtual bool SetPageText(size_t n, const wxString& strText);
virtual wxString GetPageText(size_t n) const;
virtual int GetPageImage(size_t n) const;
virtual bool SetPageImage(size_t n, int imageId);
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const;
virtual bool InsertPage(size_t n,
wxWindow *page,
const wxString& text,
bool bSelect = false,
int imageId = -1);
virtual int SetSelection(size_t n);
virtual void SetImageList(wxImageList *imageList);
// returns true if we have wxCHB_TOP or wxCHB_BOTTOM style
bool IsVertical() const { return HasFlag(wxCHB_BOTTOM | wxCHB_TOP); }
virtual bool DeleteAllPages();
protected:
virtual wxWindow *DoRemovePage(size_t page);
private:
// common part of all constructors
void Init();
// get the size which the choice control should have
wxSize GetChoiceSize() const;
// get the page area
wxRect GetPageRect() const;
// event handlers
void OnSize(wxSizeEvent& event);
void OnChoiceSelected(wxCommandEvent& event);
// the choice control we use for showing the pages index
wxChoice *m_choice;
// the currently selected page or wxNOT_FOUND if none
int m_selection;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebook)
};
// ----------------------------------------------------------------------------
// choicebook event class and related stuff
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlEvent
{
public:
wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = -1, int nOldSel = -1)
: wxBookCtrlEvent(commandType, id, nSel, nOldSel)
{
}
private:
DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoicebookEvent)
};
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED;
extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING;
typedef void (wxEvtHandler::*wxChoicebookEventFunction)(wxChoicebookEvent&);
#define EVT_CHOICEBOOK_PAGE_CHANGED(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, \
id, \
-1, \
(wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxChoicebookEventFunction, &fn ), \
NULL \
),
#define EVT_CHOICEBOOK_PAGE_CHANGING(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, \
id, \
-1, \
(wxObjectEventFunction)(wxEventFunction) wxStaticCastEvent( wxChoicebookEventFunction, &fn ), \
NULL \
),
#endif // wxUSE_CHOICEBOOK
#endif // _WX_CHOICEBOOK_H_

View File

@@ -542,6 +542,14 @@
// Recommended setting: 1
#define wxUSE_LISTBOOK 1
// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of
// the tabs
//
// Default is 1.
//
// Recommended setting: 1
#define wxUSE_CHOICEBOOK 1
// wxTabDialog is a generic version of wxNotebook but it is incompatible with
// the new class. It shouldn't be used in new code.
//

View File

@@ -573,6 +573,14 @@
// Recommended setting: 1
#define wxUSE_LISTBOOK 1
// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of
// the tabs
//
// Default is 1.
//
// Recommended setting: 1
#define wxUSE_CHOICEBOOK 1
// wxTabDialog is a generic version of wxNotebook but it is incompatible with
// the new class. It shouldn't be used in new code.
//

View File

@@ -565,6 +565,14 @@
// Recommended setting: 1
#define wxUSE_LISTBOOK 1
// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of
// the tabs
//
// Default is 1.
//
// Recommended setting: 1
#define wxUSE_CHOICEBOOK 1
// wxTabDialog is a generic version of wxNotebook but it is incompatible with
// the new class. It shouldn't be used in new code.
//

View File

@@ -123,6 +123,7 @@
#define wxUSE_MSGDLG 1
#define wxUSE_NOTEBOOK 1
#define wxUSE_LISTBOOK 1
#define wxUSE_CHOICEBOOK 1
#define wxUSE_SPLITTER 1
#define wxUSE_STOPWATCH 1
#define wxUSE_TAB_DIALOG 1

View File

@@ -543,7 +543,7 @@ private:
#if wxUSE_BOOKCTRL
// this sizer works with wxNotebook/wxListbook/... and sizes the control to
// this sizer works with wxNotebook/wxListbook/wxChoicebook... and sizes the control to
// fit its pages
class WXDLLEXPORT wxBookCtrl;

View File

@@ -605,6 +605,14 @@
// Recommended setting: 1
#define wxUSE_LISTBOOK 1
// wxChoicebook control is similar to wxNotebook but uses wxChoice instead of
// the tabs
//
// Default is 1.
//
// Recommended setting: 1
#define wxUSE_CHOICEBOOK 1
// wxTabDialog is a generic version of wxNotebook but it is incompatible with
// the new class. It shouldn't be used in new code.
//

410
src/generic/choicbkg.cpp Normal file
View File

@@ -0,0 +1,410 @@
///////////////////////////////////////////////////////////////////////////////
// Name: generic/choicbkg.cpp
// Purpose: generic implementation of wxChoicebook
// Author: Vadim Zeitlin
// Modified by: Wlodzimierz ABX Skiba from generic/listbkg.cpp
// Created: 15.09.04
// RCS-ID: $Id$
// Copyright: (c) Vadim Zeitlin, Wlodzimierz Skiba
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "choicebook.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_CHOICEBOOK
#include "wx/choice.h"
#include "wx/choicebk.h"
#include "wx/imaglist.h"
#include "wx/settings.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// margin between the choice and the page
#if defined(__WXWINCE__)
const wxCoord MARGIN = 1;
#else
const wxCoord MARGIN = 5;
#endif
// ----------------------------------------------------------------------------
// various wxWidgets macros
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxChoicebook, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxChoicebookEvent, wxNotifyEvent)
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxNewEventType();
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxNewEventType();
const int wxID_CHOICEBOOKCHOICE = wxNewId();
BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrl)
EVT_SIZE(wxChoicebook::OnSize)
EVT_CHOICE(wxID_CHOICEBOOKCHOICE, wxChoicebook::OnChoiceSelected)
END_EVENT_TABLE()
// ============================================================================
// wxChoicebook implementation
// ============================================================================
// ----------------------------------------------------------------------------
// wxChoicebook creation
// ----------------------------------------------------------------------------
void wxChoicebook::Init()
{
m_choice = NULL;
m_selection = wxNOT_FOUND;
}
bool
wxChoicebook::Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
{
if ( (style & wxCHB_ALIGN_MASK) == wxCHB_DEFAULT )
{
style |= wxCHB_TOP;
}
// no border for this control, it doesn't look nice together with
// wxChoice border
style &= ~wxBORDER_MASK;
style |= wxBORDER_NONE;
if ( !wxControl::Create(parent, id, pos, size, style,
wxDefaultValidator, name) )
return false;
m_choice = new wxChoice
(
this,
wxID_CHOICEBOOKCHOICE,
wxDefaultPosition,
wxDefaultSize
);
return true;
}
// ----------------------------------------------------------------------------
// wxChoicebook geometry management
// ----------------------------------------------------------------------------
wxSize wxChoicebook::GetChoiceSize() const
{
const wxSize sizeClient = GetClientSize(),
sizeChoice = m_choice->GetBestSize();
wxSize size;
if ( IsVertical() )
{
size.x = sizeClient.x;
size.y = sizeChoice.y;
}
else // left/right aligned
{
size.x = sizeChoice.x;
size.y = sizeClient.y;
}
return size;
}
wxRect wxChoicebook::GetPageRect() const
{
const wxSize sizeChoice = m_choice->GetSize();
wxRect rectPage(wxPoint(0, 0), GetClientSize());
switch ( GetWindowStyle() & wxCHB_ALIGN_MASK )
{
default:
wxFAIL_MSG( _T("unexpected wxChoicebook alignment") );
// fall through
case wxCHB_TOP:
rectPage.y = sizeChoice.y + MARGIN;
// fall through
case wxCHB_BOTTOM:
rectPage.height -= sizeChoice.y + MARGIN;
break;
case wxCHB_LEFT:
rectPage.x = sizeChoice.x + MARGIN;
// fall through
case wxCHB_RIGHT:
rectPage.width -= sizeChoice.x + MARGIN;
break;
}
return rectPage;
}
void wxChoicebook::OnSize(wxSizeEvent& event)
{
event.Skip();
if ( !m_choice )
{
// we're not fully created yet
return;
}
// resize the choice control and the page area to fit inside our new size
const wxSize sizeClient = GetClientSize(),
sizeChoice = GetChoiceSize();
wxPoint posChoice;
switch ( GetWindowStyle() & wxCHB_ALIGN_MASK )
{
default:
wxFAIL_MSG( _T("unexpected wxChoicebook alignment") );
// fall through
case wxCHB_TOP:
case wxCHB_LEFT:
// posChoice is already ok
break;
case wxCHB_BOTTOM:
posChoice.y = sizeClient.y - sizeChoice.y;
break;
case wxCHB_RIGHT:
posChoice.x = sizeClient.x - sizeChoice.x;
break;
}
m_choice->Move(posChoice.x, posChoice.y);
m_choice->SetSize(sizeChoice.x, sizeChoice.y);
// we should always have some selection if possible
if ( m_selection == wxNOT_FOUND && GetPageCount() )
{
SetSelection(0);
}
if ( m_selection != wxNOT_FOUND )
{
wxWindow *page = m_pages[m_selection];
wxCHECK_RET( page, _T("NULL page in wxChoicebook?") );
page->SetSize(GetPageRect());
if ( !page->IsShown() )
{
page->Show();
}
}
}
wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const
{
// we need to add the size of the choice control and the margin
const wxSize sizeChoice = GetChoiceSize();
wxSize size = sizePage;
if ( IsVertical() )
{
size.y += sizeChoice.y + MARGIN;
}
else // left/right aligned
{
size.x += sizeChoice.x + MARGIN;
}
return size;
}
// ----------------------------------------------------------------------------
// accessing the pages
// ----------------------------------------------------------------------------
bool wxChoicebook::SetPageText(size_t n, const wxString& strText)
{
m_choice->SetString(n, strText);
return true;
}
wxString wxChoicebook::GetPageText(size_t n) const
{
return m_choice->GetString(n);
}
int wxChoicebook::GetPageImage(size_t WXUNUSED(n)) const
{
wxFAIL_MSG( _T("wxChoicebook::GetPageImage() not implemented") );
return -1;
}
bool wxChoicebook::SetPageImage(size_t WXUNUSED(n), int WXUNUSED(imageId))
{
wxFAIL_MSG( _T("wxChoicebook::SetPageImage() not implemented") );
return false;
}
// ----------------------------------------------------------------------------
// image list stuff
// ----------------------------------------------------------------------------
void wxChoicebook::SetImageList(wxImageList *imageList)
{
// TODO: can be implemented in form of static bitmap near choice control
wxBookCtrl::SetImageList(imageList);
}
// ----------------------------------------------------------------------------
// selection
// ----------------------------------------------------------------------------
int wxChoicebook::GetSelection() const
{
return m_selection;
}
int wxChoicebook::SetSelection(size_t n)
{
wxCHECK_MSG( n < GetPageCount(), wxNOT_FOUND,
_T("invalid page index in wxChoicebook::SetSelection()") );
int selOld = m_selection;
if ( (int)n != m_selection )
{
m_choice->Select(n);
// change m_selection only now, otherwise OnChoiceSelected() would ignore
// the selection change event
if ( m_selection != wxNOT_FOUND )
m_pages[m_selection]->Hide();
wxWindow *page = m_pages[m_selection = n];
page->SetSize(GetPageRect());
page->Show();
}
return selOld;
}
// ----------------------------------------------------------------------------
// adding/removing the pages
// ----------------------------------------------------------------------------
bool
wxChoicebook::InsertPage(size_t n,
wxWindow *page,
const wxString& text,
bool bSelect,
int imageId)
{
if ( !wxBookCtrl::InsertPage(n, page, text, bSelect, imageId) )
return false;
m_choice->Insert(text, n);
if ( bSelect )
{
m_choice->Select(n);
}
else // don't select this page
{
// it will be shown only when selected
page->Hide();
}
InvalidateBestSize();
return true;
}
wxWindow *wxChoicebook::DoRemovePage(size_t page)
{
wxWindow *win = wxBookCtrl::DoRemovePage(page);
if ( win )
{
m_choice->Delete(page);
}
return win;
}
bool wxChoicebook::DeleteAllPages()
{
m_choice->Clear();
return wxBookCtrl::DeleteAllPages();
}
// ----------------------------------------------------------------------------
// wxChoicebook events
// ----------------------------------------------------------------------------
void wxChoicebook::OnChoiceSelected(wxCommandEvent& eventChoice)
{
const int selNew = eventChoice.GetSelection();
if ( selNew == m_selection )
{
// this event can only come from our own Select(m_selection) below
// which we call when the page change is vetoed, so we should simply
// ignore it
return;
}
// first send "change in progress" event which may be vetoed by user
wxChoicebookEvent eventIng(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, GetId());
eventIng.SetEventObject(this);
eventIng.SetSelection(selNew);
eventIng.SetOldSelection(m_selection);
if ( GetEventHandler()->ProcessEvent(eventIng) && !eventIng.IsAllowed() )
{
m_choice->Select(m_selection);
return;
}
// change allowed: do change the page and notify the user about it
if ( m_selection != wxNOT_FOUND )
m_pages[m_selection]->Hide();
wxWindow *page = m_pages[m_selection = selNew];
page->SetSize(GetPageRect());
page->Show();
wxChoicebookEvent eventEd(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, GetId());
eventEd.SetEventObject(this);
eventEd.SetSelection(selNew);
eventEd.SetOldSelection(m_selection);
(void)GetEventHandler()->ProcessEvent(eventEd);
}
#endif // wxUSE_CHOICEBOOK