2001-06-26 17:05:06 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2004-05-25 07:20:37 -04:00
|
|
|
// Program: wxWidgets Widgets Sample
|
2001-06-26 17:05:06 -04:00
|
|
|
// Name: notebook.cpp
|
2006-05-17 15:49:09 -04:00
|
|
|
// Purpose: Part of the widgets sample showing book controls
|
|
|
|
// Author: Vadim Zeitlin, Wlodzimierz ABX Skiba
|
2001-06-26 17:05:06 -04:00
|
|
|
// Created: 06.04.01
|
|
|
|
// Id: $Id$
|
2006-05-17 15:49:09 -04:00
|
|
|
// Copyright: (c) 2001 Vadim Zeitlin, 2006 Wlodzimierz Skiba
|
2001-06-26 17:05:06 -04:00
|
|
|
// License: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// declarations
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// for compilers that support precompilation, includes "wx/wx.h".
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
#if wxUSE_BOOKCTRL
|
2004-11-23 06:45:07 -05:00
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// for all others, include the necessary headers
|
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#include "wx/app.h"
|
|
|
|
#include "wx/log.h"
|
|
|
|
|
|
|
|
#include "wx/button.h"
|
|
|
|
#include "wx/checkbox.h"
|
|
|
|
#include "wx/combobox.h"
|
|
|
|
#include "wx/radiobox.h"
|
|
|
|
#include "wx/statbox.h"
|
|
|
|
#include "wx/textctrl.h"
|
|
|
|
|
|
|
|
#include "wx/dynarray.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/sizer.h"
|
2006-05-17 15:49:09 -04:00
|
|
|
#include "wx/bookctrl.h"
|
2002-03-23 19:21:26 -05:00
|
|
|
#include "wx/artprov.h"
|
2006-05-26 10:07:47 -04:00
|
|
|
#include "wx/imaglist.h"
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
#include "widgets.h"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// control ids
|
|
|
|
enum
|
|
|
|
{
|
2006-05-17 15:49:09 -04:00
|
|
|
BookPage_Reset = wxID_HIGHEST,
|
|
|
|
BookPage_SelectPage,
|
|
|
|
BookPage_AddPage,
|
|
|
|
BookPage_InsertPage,
|
|
|
|
BookPage_RemovePage,
|
|
|
|
BookPage_DeleteAll,
|
|
|
|
BookPage_InsertText,
|
|
|
|
BookPage_RemoveText,
|
|
|
|
BookPage_SelectText,
|
|
|
|
BookPage_NumPagesText,
|
|
|
|
BookPage_CurSelectText,
|
|
|
|
BookPage_Book
|
2001-06-26 17:05:06 -04:00
|
|
|
};
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
// book orientations
|
2001-06-26 17:05:06 -04:00
|
|
|
enum Orient
|
|
|
|
{
|
|
|
|
Orient_Top,
|
|
|
|
Orient_Bottom,
|
|
|
|
Orient_Left,
|
|
|
|
Orient_Right,
|
|
|
|
Orient_Max
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2006-05-17 15:49:09 -04:00
|
|
|
// BookWidgetsPage
|
2001-06-26 17:05:06 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
class BookWidgetsPage : public WidgetsPage
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
public:
|
2008-01-15 20:39:44 -05:00
|
|
|
BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, const char *const icon[]);
|
2006-05-17 15:49:09 -04:00
|
|
|
virtual ~BookWidgetsPage();
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
virtual wxControl *GetWidget() const { return m_book; }
|
|
|
|
virtual void RecreateWidget() { RecreateBook(); }
|
2004-11-19 14:03:04 -05:00
|
|
|
|
2006-06-06 10:10:06 -04:00
|
|
|
// lazy creation of the content
|
|
|
|
virtual void CreateContent();
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
protected:
|
|
|
|
// event handlers
|
|
|
|
void OnButtonReset(wxCommandEvent& event);
|
|
|
|
void OnButtonDeleteAll(wxCommandEvent& event);
|
|
|
|
void OnButtonSelectPage(wxCommandEvent& event);
|
|
|
|
void OnButtonAddPage(wxCommandEvent& event);
|
|
|
|
void OnButtonInsertPage(wxCommandEvent& event);
|
|
|
|
void OnButtonRemovePage(wxCommandEvent& event);
|
|
|
|
|
|
|
|
void OnCheckOrRadioBox(wxCommandEvent& event);
|
|
|
|
|
|
|
|
void OnUpdateUINumPagesText(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateUICurSelectText(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
void OnUpdateUISelectButton(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateUIInsertButton(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateUIRemoveButton(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
// reset book parameters
|
2001-06-26 17:05:06 -04:00
|
|
|
void Reset();
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
// (re)create book
|
|
|
|
void RecreateBook();
|
|
|
|
virtual wxBookCtrlBase *CreateBook(long flags) = 0;
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-26 20:03:27 -04:00
|
|
|
#if USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
// create or destroy the image list
|
|
|
|
void CreateImageList();
|
2006-05-26 20:03:27 -04:00
|
|
|
#endif // USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
// create a new page
|
|
|
|
wxWindow *CreateNewPage();
|
|
|
|
|
|
|
|
// get the image index for the new page
|
|
|
|
int GetIconIndex() const;
|
|
|
|
|
|
|
|
// get the numeric value of text ctrl
|
|
|
|
int GetTextValue(wxTextCtrl *text) const;
|
|
|
|
|
2002-12-27 10:02:48 -05:00
|
|
|
// is the value in range?
|
|
|
|
bool IsValidValue(int val) const
|
2006-05-17 15:49:09 -04:00
|
|
|
{ return (val >= 0) && (val < (int) m_book->GetPageCount()); }
|
2002-12-27 10:02:48 -05:00
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// the controls
|
|
|
|
// ------------
|
|
|
|
|
|
|
|
// the check/radio boxes for styles
|
|
|
|
wxCheckBox *m_chkImages;
|
|
|
|
wxRadioBox *m_radioOrient;
|
|
|
|
|
|
|
|
// the text controls containing input for various commands
|
|
|
|
wxTextCtrl *m_textInsert,
|
|
|
|
*m_textRemove,
|
|
|
|
*m_textSelect;
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
// the book itself and the sizer it is in
|
|
|
|
wxBookCtrlBase *m_book;
|
|
|
|
wxSizer *m_sizerBook;
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-26 20:03:27 -04:00
|
|
|
#if USE_ICONS_IN_BOOK
|
|
|
|
// the image list for our book
|
2001-06-26 17:05:06 -04:00
|
|
|
wxImageList *m_imageList;
|
2006-05-26 20:03:27 -04:00
|
|
|
#endif // USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
private:
|
2001-11-25 10:18:38 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2001-06-26 17:05:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// event tables
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
BEGIN_EVENT_TABLE(BookWidgetsPage, WidgetsPage)
|
|
|
|
EVT_BUTTON(BookPage_Reset, BookWidgetsPage::OnButtonReset)
|
|
|
|
EVT_BUTTON(BookPage_SelectPage, BookWidgetsPage::OnButtonSelectPage)
|
|
|
|
EVT_BUTTON(BookPage_AddPage, BookWidgetsPage::OnButtonAddPage)
|
|
|
|
EVT_BUTTON(BookPage_InsertPage, BookWidgetsPage::OnButtonInsertPage)
|
|
|
|
EVT_BUTTON(BookPage_RemovePage, BookWidgetsPage::OnButtonRemovePage)
|
|
|
|
EVT_BUTTON(BookPage_DeleteAll, BookWidgetsPage::OnButtonDeleteAll)
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
EVT_UPDATE_UI(BookPage_NumPagesText, BookWidgetsPage::OnUpdateUINumPagesText)
|
|
|
|
EVT_UPDATE_UI(BookPage_CurSelectText, BookWidgetsPage::OnUpdateUICurSelectText)
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
EVT_UPDATE_UI(BookPage_SelectPage, BookWidgetsPage::OnUpdateUISelectButton)
|
|
|
|
EVT_UPDATE_UI(BookPage_InsertPage, BookWidgetsPage::OnUpdateUIInsertButton)
|
|
|
|
EVT_UPDATE_UI(BookPage_RemovePage, BookWidgetsPage::OnUpdateUIRemoveButton)
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
EVT_CHECKBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
|
|
|
|
EVT_RADIOBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
|
2001-06-26 17:05:06 -04:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// implementation
|
|
|
|
// ============================================================================
|
|
|
|
|
2008-01-15 20:39:44 -05:00
|
|
|
BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, const char *const icon[])
|
2006-05-26 10:07:47 -04:00
|
|
|
:WidgetsPage(book, imaglist, icon)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
// init everything
|
|
|
|
m_chkImages = NULL;
|
2006-05-26 20:03:27 -04:00
|
|
|
#if USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
m_imageList = NULL;
|
2006-05-26 20:03:27 -04:00
|
|
|
#endif // USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
m_book = NULL;
|
2006-06-06 10:10:06 -04:00
|
|
|
m_radioOrient = NULL;
|
2006-05-17 15:49:09 -04:00
|
|
|
m_sizerBook = (wxSizer *)NULL;
|
2006-06-06 10:10:06 -04:00
|
|
|
}
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-06-06 10:10:06 -04:00
|
|
|
void BookWidgetsPage::CreateContent()
|
|
|
|
{
|
2001-06-26 17:05:06 -04:00
|
|
|
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
|
|
|
|
// left pane
|
2003-12-11 05:32:15 -05:00
|
|
|
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style"));
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
// must be in sync with Orient enum
|
2006-03-22 13:07:19 -05:00
|
|
|
wxArrayString orientations;
|
|
|
|
orientations.Add(_T("&top"));
|
|
|
|
orientations.Add(_T("&bottom"));
|
|
|
|
orientations.Add(_T("&left"));
|
|
|
|
orientations.Add(_T("&right"));
|
|
|
|
|
|
|
|
wxASSERT_MSG( orientations.GetCount() == Orient_Max,
|
2001-06-26 17:05:06 -04:00
|
|
|
_T("forgot to update something") );
|
|
|
|
|
2003-12-11 05:32:15 -05:00
|
|
|
m_chkImages = new wxCheckBox(this, wxID_ANY, _T("Show &images"));
|
|
|
|
m_radioOrient = new wxRadioBox(this, wxID_ANY, _T("&Tab orientation"),
|
2001-06-26 17:05:06 -04:00
|
|
|
wxDefaultPosition, wxDefaultSize,
|
2006-03-22 13:07:19 -05:00
|
|
|
orientations, 1, wxRA_SPECIFY_COLS);
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
|
|
|
|
|
|
|
|
sizerLeft->Add(m_chkImages, 0, wxALL, 5);
|
|
|
|
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
|
|
|
sizerLeft->Add(m_radioOrient, 0, wxALL, 5);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
wxButton *btn = new wxButton(this, BookPage_Reset, _T("&Reset"));
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
|
|
|
|
|
|
|
// middle pane
|
2003-12-11 05:32:15 -05:00
|
|
|
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Contents"));
|
2001-06-26 17:05:06 -04:00
|
|
|
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
|
|
|
|
|
|
|
|
wxTextCtrl *text;
|
|
|
|
wxSizer *sizerRow = CreateSizerWithTextAndLabel(_T("Number of pages: "),
|
2006-05-17 15:49:09 -04:00
|
|
|
BookPage_NumPagesText,
|
2001-06-26 17:05:06 -04:00
|
|
|
&text);
|
2003-12-11 05:32:15 -05:00
|
|
|
text->SetEditable(false);
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
|
|
|
sizerRow = CreateSizerWithTextAndLabel(_T("Current selection: "),
|
2006-05-17 15:49:09 -04:00
|
|
|
BookPage_CurSelectText,
|
2001-06-26 17:05:06 -04:00
|
|
|
&text);
|
2003-12-11 05:32:15 -05:00
|
|
|
text->SetEditable(false);
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
sizerRow = CreateSizerWithTextAndButton(BookPage_SelectPage,
|
2001-06-26 17:05:06 -04:00
|
|
|
_T("&Select page"),
|
2006-05-17 15:49:09 -04:00
|
|
|
BookPage_SelectText,
|
2001-06-26 17:05:06 -04:00
|
|
|
&m_textSelect);
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
btn = new wxButton(this, BookPage_AddPage, _T("&Add page"));
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
sizerRow = CreateSizerWithTextAndButton(BookPage_InsertPage,
|
2001-06-26 17:05:06 -04:00
|
|
|
_T("&Insert page at"),
|
2006-05-17 15:49:09 -04:00
|
|
|
BookPage_InsertText,
|
2001-06-26 17:05:06 -04:00
|
|
|
&m_textInsert);
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
sizerRow = CreateSizerWithTextAndButton(BookPage_RemovePage,
|
2001-06-26 17:05:06 -04:00
|
|
|
_T("&Remove page"),
|
2006-05-17 15:49:09 -04:00
|
|
|
BookPage_RemoveText,
|
2001-06-26 17:05:06 -04:00
|
|
|
&m_textRemove);
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
btn = new wxButton(this, BookPage_DeleteAll, _T("&Delete All"));
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
|
|
|
|
|
|
|
|
// right pane
|
2006-05-17 15:49:09 -04:00
|
|
|
m_sizerBook = new wxBoxSizer(wxHORIZONTAL);
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
// the 3 panes compose the window
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
|
|
|
sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
|
2006-05-17 15:49:09 -04:00
|
|
|
sizerTop->Add(m_sizerBook, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-07-11 08:40:38 -04:00
|
|
|
RecreateBook();
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// final initializations
|
|
|
|
Reset();
|
2006-05-26 20:03:27 -04:00
|
|
|
#if USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
CreateImageList();
|
2006-05-26 20:03:27 -04:00
|
|
|
#endif // USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
SetSizer(sizerTop);
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
BookWidgetsPage::~BookWidgetsPage()
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-05-26 20:03:27 -04:00
|
|
|
#if USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
delete m_imageList;
|
2006-05-26 20:03:27 -04:00
|
|
|
#endif // USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// operations
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::Reset()
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2003-12-11 05:32:15 -05:00
|
|
|
m_chkImages->SetValue(true);
|
2001-06-26 17:05:06 -04:00
|
|
|
m_radioOrient->SetSelection(Orient_Top);
|
|
|
|
}
|
|
|
|
|
2006-05-26 20:03:27 -04:00
|
|
|
#if USE_ICONS_IN_BOOK
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::CreateImageList()
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
if ( m_chkImages->GetValue() )
|
|
|
|
{
|
|
|
|
if ( !m_imageList )
|
|
|
|
{
|
|
|
|
// create a dummy image list with a few icons
|
|
|
|
m_imageList = new wxImageList(32, 32);
|
2002-03-23 19:21:26 -05:00
|
|
|
wxSize size(32, 32);
|
|
|
|
m_imageList->Add(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, size));
|
|
|
|
m_imageList->Add(wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, size));
|
|
|
|
m_imageList->Add(wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, size));
|
|
|
|
m_imageList->Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, size));
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
if ( m_book )
|
|
|
|
m_book->SetImageList(m_imageList);
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
else // no images
|
|
|
|
{
|
|
|
|
if ( m_imageList )
|
|
|
|
{
|
|
|
|
delete m_imageList;
|
|
|
|
m_imageList = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// because of the bug in wxMSW we can't use SetImageList(NULL) - although
|
2006-05-17 15:49:09 -04:00
|
|
|
// it would be logical if this removed the image list from book, under
|
|
|
|
// MSW it crashes instead - FIXME
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
2006-05-26 20:03:27 -04:00
|
|
|
#endif // USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::RecreateBook()
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-06-06 10:10:06 -04:00
|
|
|
// do not recreate anything in case page content was not prepared yet
|
|
|
|
if(!m_radioOrient)
|
|
|
|
return;
|
|
|
|
|
2006-04-16 19:39:11 -04:00
|
|
|
int flags = ms_defaultFlags;
|
2006-06-06 10:10:06 -04:00
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
switch ( m_radioOrient->GetSelection() )
|
|
|
|
{
|
|
|
|
default:
|
2006-05-17 15:49:09 -04:00
|
|
|
wxFAIL_MSG( _T("unknown orientation") );
|
2001-06-26 17:05:06 -04:00
|
|
|
// fall through
|
|
|
|
|
|
|
|
case Orient_Top:
|
2006-04-16 19:39:11 -04:00
|
|
|
flags |= wxBK_TOP;
|
2001-06-26 17:05:06 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Orient_Bottom:
|
2006-04-16 19:39:11 -04:00
|
|
|
flags |= wxBK_BOTTOM;
|
2001-06-26 17:05:06 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Orient_Left:
|
2006-04-16 19:39:11 -04:00
|
|
|
flags |= wxBK_LEFT;
|
2001-06-26 17:05:06 -04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case Orient_Right:
|
2006-04-16 19:39:11 -04:00
|
|
|
flags |= wxBK_RIGHT;
|
2001-06-26 17:05:06 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
wxBookCtrlBase *oldBook = m_book;
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
m_book = CreateBook(flags);
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-26 20:03:27 -04:00
|
|
|
#if USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
CreateImageList();
|
2006-05-26 20:03:27 -04:00
|
|
|
#endif // USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
if ( oldBook )
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-05-17 15:49:09 -04:00
|
|
|
const int sel = oldBook->GetSelection();
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
const int count = oldBook->GetPageCount();
|
2002-12-04 09:11:26 -05:00
|
|
|
|
|
|
|
// recreate the pages
|
2001-06-26 17:05:06 -04:00
|
|
|
for ( int n = 0; n < count; n++ )
|
|
|
|
{
|
2006-05-17 15:49:09 -04:00
|
|
|
m_book->AddPage(CreateNewPage(),
|
|
|
|
oldBook->GetPageText(n),
|
|
|
|
false,
|
|
|
|
m_chkImages->GetValue() ?
|
|
|
|
GetIconIndex() : -1);
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
m_sizerBook->Detach( oldBook );
|
|
|
|
delete oldBook;
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
// restore selection
|
|
|
|
if ( sel != -1 )
|
|
|
|
{
|
2006-05-17 15:49:09 -04:00
|
|
|
m_book->SetSelection(sel);
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
m_sizerBook->Add(m_book, 1, wxGROW | wxALL, 5);
|
|
|
|
m_sizerBook->SetMinSize(150, 0);
|
|
|
|
m_sizerBook->Layout();
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// helpers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
int BookWidgetsPage::GetTextValue(wxTextCtrl *text) const
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-06-06 10:10:06 -04:00
|
|
|
long pos = -1;
|
|
|
|
|
|
|
|
if ( !text || !text->GetValue().ToLong(&pos) )
|
2001-06-26 17:05:06 -04:00
|
|
|
pos = -1;
|
|
|
|
|
|
|
|
return (int)pos;
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
int BookWidgetsPage::GetIconIndex() const
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-05-26 20:03:27 -04:00
|
|
|
#if USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
if ( m_imageList )
|
|
|
|
{
|
|
|
|
int nImages = m_imageList->GetImageCount();
|
|
|
|
if ( nImages > 0 )
|
|
|
|
{
|
2006-05-17 15:49:09 -04:00
|
|
|
return m_book->GetPageCount() % nImages;
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
}
|
2006-05-26 20:03:27 -04:00
|
|
|
#endif // USE_ICONS_IN_BOOK
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
wxWindow *BookWidgetsPage::CreateNewPage()
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-05-17 15:49:09 -04:00
|
|
|
return new wxTextCtrl(m_book, wxID_ANY, _T("I'm a book page"));
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// event handlers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
RecreateBook();
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnButtonDeleteAll(wxCommandEvent& WXUNUSED(event))
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-05-17 15:49:09 -04:00
|
|
|
m_book->DeleteAllPages();
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event))
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
int pos = GetTextValue(m_textSelect);
|
2002-12-27 10:02:48 -05:00
|
|
|
wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
m_book->SetSelection(pos);
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event))
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-05-17 15:49:09 -04:00
|
|
|
m_book->AddPage(CreateNewPage(), _T("Added page"), false,
|
|
|
|
GetIconIndex());
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event))
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
int pos = GetTextValue(m_textInsert);
|
2002-12-27 10:02:48 -05:00
|
|
|
wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
m_book->InsertPage(pos, CreateNewPage(), _T("Inserted page"), false,
|
|
|
|
GetIconIndex());
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnButtonRemovePage(wxCommandEvent& WXUNUSED(event))
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
int pos = GetTextValue(m_textRemove);
|
2002-12-27 10:02:48 -05:00
|
|
|
wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
m_book->DeletePage(pos);
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnUpdateUISelectButton(wxUpdateUIEvent& event)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2002-12-27 10:02:48 -05:00
|
|
|
event.Enable( IsValidValue(GetTextValue(m_textSelect)) );
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnUpdateUIInsertButton(wxUpdateUIEvent& event)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2002-12-27 10:02:48 -05:00
|
|
|
event.Enable( IsValidValue(GetTextValue(m_textInsert)) );
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnUpdateUIRemoveButton(wxUpdateUIEvent& event)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2002-12-27 10:02:48 -05:00
|
|
|
event.Enable( IsValidValue(GetTextValue(m_textRemove)) );
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-06-06 10:10:06 -04:00
|
|
|
if(m_chkImages && m_radioOrient)
|
|
|
|
event.Enable( !m_chkImages->GetValue() ||
|
|
|
|
m_radioOrient->GetSelection() != wxBK_TOP );
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-06-06 10:10:06 -04:00
|
|
|
if(m_book)
|
2006-10-02 01:36:31 -04:00
|
|
|
event.SetText( wxString::Format(_T("%u"), unsigned(m_book->GetPageCount())) );
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-06-06 10:10:06 -04:00
|
|
|
if(m_book)
|
|
|
|
event.SetText( wxString::Format(_T("%d"), m_book->GetSelection()) );
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2006-05-17 15:49:09 -04:00
|
|
|
RecreateBook();
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
#if wxUSE_NOTEBOOK
|
|
|
|
|
|
|
|
#include "icons/notebook.xpm"
|
|
|
|
#include "wx/notebook.h"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// NotebookWidgetsPage
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class NotebookWidgetsPage : public BookWidgetsPage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NotebookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
|
2006-05-26 10:07:47 -04:00
|
|
|
: BookWidgetsPage(book, imaglist, notebook_xpm)
|
2006-05-17 15:49:09 -04:00
|
|
|
{
|
|
|
|
RecreateBook();
|
|
|
|
}
|
|
|
|
virtual ~NotebookWidgetsPage() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2006-05-22 06:39:40 -04:00
|
|
|
// event handlers
|
|
|
|
void OnPageChanging(wxNotebookEvent& event);
|
|
|
|
void OnPageChanged(wxNotebookEvent& event);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
// (re)create book
|
|
|
|
virtual wxBookCtrlBase *CreateBook(long flags)
|
|
|
|
{
|
|
|
|
return new wxNotebook(this, BookPage_Book,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_WIDGETS_PAGE(NotebookWidgetsPage)
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// event table
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(NotebookWidgetsPage, BookWidgetsPage)
|
2006-05-22 06:39:40 -04:00
|
|
|
EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, NotebookWidgetsPage::OnPageChanging)
|
|
|
|
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, NotebookWidgetsPage::OnPageChanged)
|
2006-05-17 15:49:09 -04:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2006-05-22 06:39:40 -04:00
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
|
|
|
#elif defined(__WXMOTIF__)
|
|
|
|
#define FAMILY_CTRLS GENERIC_CTRLS
|
|
|
|
#else
|
|
|
|
#define FAMILY_CTRLS NATIVE_CTRLS
|
|
|
|
#endif
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, _T("Notebook"),
|
2006-05-22 06:39:40 -04:00
|
|
|
FAMILY_CTRLS | BOOK_CTRLS
|
2006-05-17 15:49:09 -04:00
|
|
|
);
|
|
|
|
|
2006-05-22 06:39:40 -04:00
|
|
|
void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
|
|
|
|
{
|
|
|
|
wxLogMessage(_T("Notebook page changing from %d to %d (currently %d)."),
|
|
|
|
event.GetOldSelection(),
|
|
|
|
event.GetSelection(),
|
|
|
|
m_book->GetSelection());
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
|
|
|
|
{
|
|
|
|
wxLogMessage(_T("Notebook page changed from %d to %d (currently %d)."),
|
|
|
|
event.GetOldSelection(),
|
|
|
|
event.GetSelection(),
|
|
|
|
m_book->GetSelection());
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2004-11-23 06:45:07 -05:00
|
|
|
#endif // wxUSE_NOTEBOOK
|
2006-05-17 15:49:09 -04:00
|
|
|
|
|
|
|
#if wxUSE_LISTBOOK
|
|
|
|
|
|
|
|
#include "icons/listbook.xpm"
|
|
|
|
#include "wx/listbook.h"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// ListbookWidgetsPage
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class ListbookWidgetsPage : public BookWidgetsPage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ListbookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
|
2006-05-26 10:07:47 -04:00
|
|
|
: BookWidgetsPage(book, imaglist, listbook_xpm)
|
2006-05-17 15:49:09 -04:00
|
|
|
{
|
|
|
|
RecreateBook();
|
|
|
|
}
|
|
|
|
virtual ~ListbookWidgetsPage() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2006-05-22 06:39:40 -04:00
|
|
|
// event handlers
|
|
|
|
void OnPageChanging(wxListbookEvent& event);
|
|
|
|
void OnPageChanged(wxListbookEvent& event);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
// (re)create book
|
|
|
|
virtual wxBookCtrlBase *CreateBook(long flags)
|
|
|
|
{
|
|
|
|
return new wxListbook(this, BookPage_Book,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_WIDGETS_PAGE(ListbookWidgetsPage)
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// event table
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(ListbookWidgetsPage, BookWidgetsPage)
|
2006-05-22 06:39:40 -04:00
|
|
|
EVT_LISTBOOK_PAGE_CHANGING(wxID_ANY, ListbookWidgetsPage::OnPageChanging)
|
|
|
|
EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, ListbookWidgetsPage::OnPageChanged)
|
2006-05-17 15:49:09 -04:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, _T("Listbook"),
|
|
|
|
GENERIC_CTRLS | BOOK_CTRLS
|
|
|
|
);
|
|
|
|
|
2006-05-22 06:39:40 -04:00
|
|
|
void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event)
|
|
|
|
{
|
|
|
|
wxLogMessage(_T("Listbook page changing from %d to %d (currently %d)."),
|
|
|
|
event.GetOldSelection(),
|
|
|
|
event.GetSelection(),
|
|
|
|
m_book->GetSelection());
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ListbookWidgetsPage::OnPageChanged(wxListbookEvent& event)
|
|
|
|
{
|
|
|
|
wxLogMessage(_T("Listbook page changed from %d to %d (currently %d)."),
|
|
|
|
event.GetOldSelection(),
|
|
|
|
event.GetSelection(),
|
|
|
|
m_book->GetSelection());
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
#endif // wxUSE_LISTBOOK
|
|
|
|
|
|
|
|
#if wxUSE_CHOICEBOOK
|
|
|
|
|
|
|
|
#include "icons/choicebk.xpm"
|
|
|
|
#include "wx/choicebk.h"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// ChoicebookWidgetsPage
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class ChoicebookWidgetsPage : public BookWidgetsPage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ChoicebookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
|
2006-05-26 10:07:47 -04:00
|
|
|
: BookWidgetsPage(book, imaglist, choicebk_xpm)
|
2006-05-17 15:49:09 -04:00
|
|
|
{
|
|
|
|
RecreateBook();
|
|
|
|
}
|
|
|
|
virtual ~ChoicebookWidgetsPage() {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2006-05-22 06:39:40 -04:00
|
|
|
// event handlers
|
|
|
|
void OnPageChanging(wxChoicebookEvent& event);
|
|
|
|
void OnPageChanged(wxChoicebookEvent& event);
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
// (re)create book
|
|
|
|
virtual wxBookCtrlBase *CreateBook(long flags)
|
|
|
|
{
|
|
|
|
return new wxChoicebook(this, BookPage_Book,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_WIDGETS_PAGE(ChoicebookWidgetsPage)
|
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// event table
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(ChoicebookWidgetsPage, BookWidgetsPage)
|
2006-05-22 06:39:40 -04:00
|
|
|
EVT_CHOICEBOOK_PAGE_CHANGING(wxID_ANY, ChoicebookWidgetsPage::OnPageChanging)
|
|
|
|
EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, ChoicebookWidgetsPage::OnPageChanged)
|
2006-05-17 15:49:09 -04:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, _T("Choicebook"),
|
|
|
|
GENERIC_CTRLS | BOOK_CTRLS
|
|
|
|
);
|
|
|
|
|
2006-05-22 06:39:40 -04:00
|
|
|
void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event)
|
|
|
|
{
|
|
|
|
wxLogMessage(_T("Choicebook page changing from %d to %d (currently %d)."),
|
|
|
|
event.GetOldSelection(),
|
|
|
|
event.GetSelection(),
|
|
|
|
m_book->GetSelection());
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChoicebookWidgetsPage::OnPageChanged(wxChoicebookEvent& event)
|
|
|
|
{
|
|
|
|
wxLogMessage(_T("Choicebook page changed from %d to %d (currently %d)."),
|
|
|
|
event.GetOldSelection(),
|
|
|
|
event.GetSelection(),
|
|
|
|
m_book->GetSelection());
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
#endif // wxUSE_CHOICEBOOK
|
|
|
|
|
|
|
|
#endif // wxUSE_BOOKCTRL
|