Rearranged widgets sample to show more and categorized widgets.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39190 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2006-05-17 19:49:09 +00:00
parent 689f42f4b4
commit f2fdc4d56e
27 changed files with 1059 additions and 299 deletions

View File

@@ -1,11 +1,11 @@
/////////////////////////////////////////////////////////////////////////////
// Program: wxWidgets Widgets Sample
// Name: notebook.cpp
// Purpose: Part of the widgets sample showing wxNotebook
// Author: Vadim Zeitlin
// Purpose: Part of the widgets sample showing book controls
// Author: Vadim Zeitlin, Wlodzimierz ABX Skiba
// Created: 06.04.01
// Id: $Id$
// Copyright: (c) 2001 Vadim Zeitlin
// Copyright: (c) 2001 Vadim Zeitlin, 2006 Wlodzimierz Skiba
// License: wxWindows license
/////////////////////////////////////////////////////////////////////////////
@@ -24,7 +24,7 @@
#pragma hdrstop
#endif
#if wxUSE_NOTEBOOK
#if wxUSE_BOOKCTRL
// for all others, include the necessary headers
#ifndef WX_PRECOMP
@@ -42,11 +42,10 @@
#endif
#include "wx/sizer.h"
#include "wx/notebook.h"
#include "wx/bookctrl.h"
#include "wx/artprov.h"
#include "widgets.h"
#include "icons/notebook.xpm"
// ----------------------------------------------------------------------------
// constants
@@ -55,21 +54,21 @@
// control ids
enum
{
NotebookPage_Reset = 100,
NotebookPage_SelectPage,
NotebookPage_AddPage,
NotebookPage_InsertPage,
NotebookPage_RemovePage,
NotebookPage_DeleteAll,
NotebookPage_InsertText,
NotebookPage_RemoveText,
NotebookPage_SelectText,
NotebookPage_NumPagesText,
NotebookPage_CurSelectText,
NotebookPage_Notebook
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
};
// notebook orientations
// book orientations
enum Orient
{
Orient_Top,
@@ -80,22 +79,24 @@ enum Orient
};
// ----------------------------------------------------------------------------
// NotebookWidgetsPage
// BookWidgetsPage
// ----------------------------------------------------------------------------
class NotebookWidgetsPage : public WidgetsPage
class BookWidgetsPage : public WidgetsPage
{
public:
NotebookWidgetsPage(wxBookCtrlBase *book, wxImageList *imaglist);
virtual ~NotebookWidgetsPage();
BookWidgetsPage(WidgetsBookCtrl *book);
virtual ~BookWidgetsPage();
virtual wxControl *GetWidget() const { return m_notebook; }
virtual void RecreateWidget() { CreateNotebook(); }
virtual wxControl *GetWidget() const { return m_book; }
virtual void RecreateWidget() { RecreateBook(); }
protected:
// event handlers
#ifdef ABX
void OnPageChanging(wxNotebookEvent& event);
void OnPageChanged(wxNotebookEvent& event);
#endif
void OnButtonReset(wxCommandEvent& event);
void OnButtonDeleteAll(wxCommandEvent& event);
@@ -115,11 +116,12 @@ protected:
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
// reset the wxNotebook parameters
// reset book parameters
void Reset();
// (re)create the wxNotebook
void CreateNotebook();
// (re)create book
void RecreateBook();
virtual wxBookCtrlBase *CreateBook(long flags) = 0;
// create or destroy the image list
void CreateImageList();
@@ -135,7 +137,7 @@ protected:
// is the value in range?
bool IsValidValue(int val) const
{ return (val >= 0) && (val < (int) m_notebook->GetPageCount()); }
{ return (val >= 0) && (val < (int) m_book->GetPageCount()); }
// the controls
// ------------
@@ -149,62 +151,58 @@ protected:
*m_textRemove,
*m_textSelect;
// the notebook itself and the sizer it is in
wxNotebook *m_notebook;
wxSizer *m_sizerNotebook;
// the book itself and the sizer it is in
wxBookCtrlBase *m_book;
wxSizer *m_sizerBook;
// thei mage list for our notebook
// thei mage list for our book
wxImageList *m_imageList;
private:
DECLARE_EVENT_TABLE()
DECLARE_WIDGETS_PAGE(NotebookWidgetsPage)
};
// ----------------------------------------------------------------------------
// event tables
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(NotebookWidgetsPage, WidgetsPage)
EVT_BUTTON(NotebookPage_Reset, NotebookWidgetsPage::OnButtonReset)
EVT_BUTTON(NotebookPage_SelectPage, NotebookWidgetsPage::OnButtonSelectPage)
EVT_BUTTON(NotebookPage_AddPage, NotebookWidgetsPage::OnButtonAddPage)
EVT_BUTTON(NotebookPage_InsertPage, NotebookWidgetsPage::OnButtonInsertPage)
EVT_BUTTON(NotebookPage_RemovePage, NotebookWidgetsPage::OnButtonRemovePage)
EVT_BUTTON(NotebookPage_DeleteAll, NotebookWidgetsPage::OnButtonDeleteAll)
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)
EVT_UPDATE_UI(NotebookPage_NumPagesText, NotebookWidgetsPage::OnUpdateUINumPagesText)
EVT_UPDATE_UI(NotebookPage_CurSelectText, NotebookWidgetsPage::OnUpdateUICurSelectText)
EVT_UPDATE_UI(BookPage_NumPagesText, BookWidgetsPage::OnUpdateUINumPagesText)
EVT_UPDATE_UI(BookPage_CurSelectText, BookWidgetsPage::OnUpdateUICurSelectText)
EVT_UPDATE_UI(NotebookPage_SelectPage, NotebookWidgetsPage::OnUpdateUISelectButton)
EVT_UPDATE_UI(NotebookPage_InsertPage, NotebookWidgetsPage::OnUpdateUIInsertButton)
EVT_UPDATE_UI(NotebookPage_RemovePage, NotebookWidgetsPage::OnUpdateUIRemoveButton)
EVT_UPDATE_UI(BookPage_SelectPage, BookWidgetsPage::OnUpdateUISelectButton)
EVT_UPDATE_UI(BookPage_InsertPage, BookWidgetsPage::OnUpdateUIInsertButton)
EVT_UPDATE_UI(BookPage_RemovePage, BookWidgetsPage::OnUpdateUIRemoveButton)
EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, NotebookWidgetsPage::OnPageChanging)
#ifdef ABX
EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, BookWidgetsPage::OnPageChanging)
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, NotebookWidgetsPage::OnPageChanged)
#endif
EVT_CHECKBOX(wxID_ANY, NotebookWidgetsPage::OnCheckOrRadioBox)
EVT_RADIOBOX(wxID_ANY, NotebookWidgetsPage::OnCheckOrRadioBox)
EVT_CHECKBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
EVT_RADIOBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
END_EVENT_TABLE()
// ============================================================================
// implementation
// ============================================================================
IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, _T("Notebook"));
NotebookWidgetsPage::NotebookWidgetsPage(wxBookCtrlBase *book,
wxImageList *imaglist)
: WidgetsPage(book)
BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book)
:WidgetsPage(book)
{
imaglist->Add(wxBitmap(notebook_xpm));
// init everything
m_chkImages = NULL;
m_imageList = NULL;
m_notebook = (wxNotebook *)NULL;
m_sizerNotebook = (wxSizer *)NULL;
m_book = NULL;
m_sizerBook = (wxSizer *)NULL;
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
@@ -232,7 +230,7 @@ NotebookWidgetsPage::NotebookWidgetsPage(wxBookCtrlBase *book,
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
sizerLeft->Add(m_radioOrient, 0, wxALL, 5);
wxButton *btn = new wxButton(this, NotebookPage_Reset, _T("&Reset"));
wxButton *btn = new wxButton(this, BookPage_Reset, _T("&Reset"));
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
// middle pane
@@ -241,52 +239,48 @@ NotebookWidgetsPage::NotebookWidgetsPage(wxBookCtrlBase *book,
wxTextCtrl *text;
wxSizer *sizerRow = CreateSizerWithTextAndLabel(_T("Number of pages: "),
NotebookPage_NumPagesText,
BookPage_NumPagesText,
&text);
text->SetEditable(false);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndLabel(_T("Current selection: "),
NotebookPage_CurSelectText,
BookPage_CurSelectText,
&text);
text->SetEditable(false);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(NotebookPage_SelectPage,
sizerRow = CreateSizerWithTextAndButton(BookPage_SelectPage,
_T("&Select page"),
NotebookPage_SelectText,
BookPage_SelectText,
&m_textSelect);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, NotebookPage_AddPage, _T("&Add page"));
btn = new wxButton(this, BookPage_AddPage, _T("&Add page"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(NotebookPage_InsertPage,
sizerRow = CreateSizerWithTextAndButton(BookPage_InsertPage,
_T("&Insert page at"),
NotebookPage_InsertText,
BookPage_InsertText,
&m_textInsert);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
sizerRow = CreateSizerWithTextAndButton(NotebookPage_RemovePage,
sizerRow = CreateSizerWithTextAndButton(BookPage_RemovePage,
_T("&Remove page"),
NotebookPage_RemoveText,
BookPage_RemoveText,
&m_textRemove);
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
btn = new wxButton(this, NotebookPage_DeleteAll, _T("&Delete All"));
btn = new wxButton(this, BookPage_DeleteAll, _T("&Delete All"));
sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
// right pane
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
m_notebook = new wxNotebook(this, NotebookPage_Notebook);
sizerRight->Add(m_notebook, 1, wxGROW | wxALL, 5);
sizerRight->SetMinSize(150, 0);
m_sizerNotebook = sizerRight; // save it to modify it later
m_sizerBook = new wxBoxSizer(wxHORIZONTAL);
// the 3 panes panes compose the window
// the 3 panes compose the window
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
sizerTop->Add(m_sizerBook, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
// final initializations
Reset();
@@ -297,7 +291,7 @@ NotebookWidgetsPage::NotebookWidgetsPage(wxBookCtrlBase *book,
sizerTop->Fit(this);
}
NotebookWidgetsPage::~NotebookWidgetsPage()
BookWidgetsPage::~BookWidgetsPage()
{
delete m_imageList;
}
@@ -306,13 +300,13 @@ NotebookWidgetsPage::~NotebookWidgetsPage()
// operations
// ----------------------------------------------------------------------------
void NotebookWidgetsPage::Reset()
void BookWidgetsPage::Reset()
{
m_chkImages->SetValue(true);
m_radioOrient->SetSelection(Orient_Top);
}
void NotebookWidgetsPage::CreateImageList()
void BookWidgetsPage::CreateImageList()
{
if ( m_chkImages->GetValue() )
{
@@ -327,7 +321,8 @@ void NotebookWidgetsPage::CreateImageList()
m_imageList->Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, size));
}
m_notebook->SetImageList(m_imageList);
if ( m_book )
m_book->SetImageList(m_imageList);
}
else // no images
{
@@ -339,17 +334,17 @@ void NotebookWidgetsPage::CreateImageList()
}
// because of the bug in wxMSW we can't use SetImageList(NULL) - although
// it would be logical if this removed the image list from notebook, under
// MSW it crashes instead
// it would be logical if this removed the image list from book, under
// MSW it crashes instead - FIXME
}
void NotebookWidgetsPage::CreateNotebook()
void BookWidgetsPage::RecreateBook()
{
int flags = ms_defaultFlags;
switch ( m_radioOrient->GetSelection() )
{
default:
wxFAIL_MSG( _T("unknown notebook orientation") );
wxFAIL_MSG( _T("unknown orientation") );
// fall through
case Orient_Top:
@@ -369,49 +364,48 @@ void NotebookWidgetsPage::CreateNotebook()
break;
}
wxNotebook *old_note = m_notebook;
wxBookCtrlBase *oldBook = m_book;
m_notebook = new wxNotebook(this, NotebookPage_Notebook,
wxDefaultPosition, wxDefaultSize,
flags);
m_book = CreateBook(flags);
CreateImageList();
if ( old_note )
if ( oldBook )
{
const int sel = old_note->GetSelection();
const int sel = oldBook->GetSelection();
const int count = old_note->GetPageCount();
const int count = oldBook->GetPageCount();
// recreate the pages
for ( int n = 0; n < count; n++ )
{
m_notebook->AddPage(CreateNewPage(),
old_note->GetPageText(n),
false,
m_chkImages->GetValue() ?
GetIconIndex() : -1);
m_book->AddPage(CreateNewPage(),
oldBook->GetPageText(n),
false,
m_chkImages->GetValue() ?
GetIconIndex() : -1);
}
m_sizerNotebook->Detach( old_note );
delete old_note;
m_sizerBook->Detach( oldBook );
delete oldBook;
// restore selection
if ( sel != -1 )
{
m_notebook->SetSelection(sel);
m_book->SetSelection(sel);
}
}
m_sizerNotebook->Add(m_notebook, 1, wxGROW | wxALL, 5);
m_sizerNotebook->Layout();
m_sizerBook->Add(m_book, 1, wxGROW | wxALL, 5);
m_sizerBook->SetMinSize(150, 0);
m_sizerBook->Layout();
}
// ----------------------------------------------------------------------------
// helpers
// ----------------------------------------------------------------------------
int NotebookWidgetsPage::GetTextValue(wxTextCtrl *text) const
int BookWidgetsPage::GetTextValue(wxTextCtrl *text) const
{
long pos;
if ( !text->GetValue().ToLong(&pos) )
@@ -420,109 +414,110 @@ int NotebookWidgetsPage::GetTextValue(wxTextCtrl *text) const
return (int)pos;
}
int NotebookWidgetsPage::GetIconIndex() const
int BookWidgetsPage::GetIconIndex() const
{
if ( m_imageList )
{
int nImages = m_imageList->GetImageCount();
if ( nImages > 0 )
{
return m_notebook->GetPageCount() % nImages;
return m_book->GetPageCount() % nImages;
}
}
return -1;
}
wxWindow *NotebookWidgetsPage::CreateNewPage()
wxWindow *BookWidgetsPage::CreateNewPage()
{
return new wxTextCtrl(m_notebook, wxID_ANY, _T("I'm a notebook page"));
return new wxTextCtrl(m_book, wxID_ANY, _T("I'm a book page"));
}
// ----------------------------------------------------------------------------
// event handlers
// ----------------------------------------------------------------------------
void NotebookWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
void BookWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
{
Reset();
CreateNotebook();
RecreateBook();
}
void NotebookWidgetsPage::OnButtonDeleteAll(wxCommandEvent& WXUNUSED(event))
void BookWidgetsPage::OnButtonDeleteAll(wxCommandEvent& WXUNUSED(event))
{
m_notebook->DeleteAllPages();
m_book->DeleteAllPages();
}
void NotebookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event))
void BookWidgetsPage::OnButtonSelectPage(wxCommandEvent& WXUNUSED(event))
{
int pos = GetTextValue(m_textSelect);
wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
m_notebook->SetSelection(pos);
m_book->SetSelection(pos);
}
void NotebookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event))
void BookWidgetsPage::OnButtonAddPage(wxCommandEvent& WXUNUSED(event))
{
m_notebook->AddPage(CreateNewPage(), _T("Added page"), false,
GetIconIndex());
m_book->AddPage(CreateNewPage(), _T("Added page"), false,
GetIconIndex());
}
void NotebookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event))
void BookWidgetsPage::OnButtonInsertPage(wxCommandEvent& WXUNUSED(event))
{
int pos = GetTextValue(m_textInsert);
wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
m_notebook->InsertPage(pos, CreateNewPage(), _T("Inserted page"), false,
GetIconIndex());
m_book->InsertPage(pos, CreateNewPage(), _T("Inserted page"), false,
GetIconIndex());
}
void NotebookWidgetsPage::OnButtonRemovePage(wxCommandEvent& WXUNUSED(event))
void BookWidgetsPage::OnButtonRemovePage(wxCommandEvent& WXUNUSED(event))
{
int pos = GetTextValue(m_textRemove);
wxCHECK_RET( IsValidValue(pos), _T("button should be disabled") );
m_notebook->DeletePage(pos);
m_book->DeletePage(pos);
}
void NotebookWidgetsPage::OnUpdateUISelectButton(wxUpdateUIEvent& event)
void BookWidgetsPage::OnUpdateUISelectButton(wxUpdateUIEvent& event)
{
event.Enable( IsValidValue(GetTextValue(m_textSelect)) );
}
void NotebookWidgetsPage::OnUpdateUIInsertButton(wxUpdateUIEvent& event)
void BookWidgetsPage::OnUpdateUIInsertButton(wxUpdateUIEvent& event)
{
event.Enable( IsValidValue(GetTextValue(m_textInsert)) );
}
void NotebookWidgetsPage::OnUpdateUIRemoveButton(wxUpdateUIEvent& event)
void BookWidgetsPage::OnUpdateUIRemoveButton(wxUpdateUIEvent& event)
{
event.Enable( IsValidValue(GetTextValue(m_textRemove)) );
}
void NotebookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
void BookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
{
event.Enable( !m_chkImages->GetValue() ||
m_radioOrient->GetSelection() != wxBK_TOP );
}
void NotebookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event)
void BookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event)
{
event.SetText( wxString::Format(_T("%d"), m_notebook->GetPageCount()) );
event.SetText( wxString::Format(_T("%d"), m_book->GetPageCount()) );
}
void NotebookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event)
void BookWidgetsPage::OnUpdateUICurSelectText(wxUpdateUIEvent& event)
{
event.SetText( wxString::Format(_T("%d"), m_notebook->GetSelection()) );
event.SetText( wxString::Format(_T("%d"), m_book->GetSelection()) );
}
void NotebookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
{
CreateNotebook();
RecreateBook();
}
void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
#ifdef ABX
void BookWidgetsPage::OnPageChanging(wxBookEvent& event)
{
wxLogMessage(_T("Notebook page changing from %d to %d (currently %d)."),
event.GetOldSelection(),
@@ -542,4 +537,155 @@ void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
event.Skip();
}
#endif
#if wxUSE_NOTEBOOK
#include "icons/notebook.xpm"
#include "wx/notebook.h"
// ----------------------------------------------------------------------------
// NotebookWidgetsPage
// ----------------------------------------------------------------------------
class NotebookWidgetsPage : public BookWidgetsPage
{
public:
NotebookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
: BookWidgetsPage(book)
{
imaglist->Add(wxBitmap(notebook_xpm));
RecreateBook();
}
virtual ~NotebookWidgetsPage() {}
protected:
// (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)
END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, _T("Notebook"),
(int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
.ElseIf(wxGTK,NATIVE_CTRLS)
| BOOK_CTRLS
);
#endif // wxUSE_NOTEBOOK
#if wxUSE_LISTBOOK
#include "icons/listbook.xpm"
#include "wx/listbook.h"
// ----------------------------------------------------------------------------
// ListbookWidgetsPage
// ----------------------------------------------------------------------------
class ListbookWidgetsPage : public BookWidgetsPage
{
public:
ListbookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
: BookWidgetsPage(book)
{
imaglist->Add(wxBitmap(listbook_xpm));
RecreateBook();
}
virtual ~ListbookWidgetsPage() {}
protected:
// (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)
END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, _T("Listbook"),
GENERIC_CTRLS | BOOK_CTRLS
);
#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)
: BookWidgetsPage(book)
{
imaglist->Add(wxBitmap(choicebk_xpm));
RecreateBook();
}
virtual ~ChoicebookWidgetsPage() {}
protected:
// (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)
END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, _T("Choicebook"),
GENERIC_CTRLS | BOOK_CTRLS
);
#endif // wxUSE_CHOICEBOOK
#endif // wxUSE_BOOKCTRL