wxBookCtrl->wxBookCtrlBase. wxBookCtrl is now most suitable book for given platform. Samples adjustement.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-11-23 11:45:07 +00:00
parent 13e175eafc
commit 61c083e781
27 changed files with 240 additions and 210 deletions

View File

@@ -101,8 +101,8 @@ wxURL has undergone some radical changes.
* Many accessors of wxURL - GetHostName, GetProtocolName, and GetPath,
have been replaced by its parent's (wxURI) counterparts - GetServer,
GetScheme, and GetPath, respectively.
* ConvertToValidURI has been replaced by wxURI. Do not use
* ConvertToValidURI has been replaced by wxURI. Do not use
ConvertToValidURI for future applications.
* ConvertFromURI has been replaced by wxURI::Unescape.
@@ -190,7 +190,7 @@ wxURL has undergone some radical changes.
\subsection{Depreciated changes since 2.4.x}
- wxURL::GetInputStream() and similar functionality has been depreciated in
- wxURL::GetInputStream() and similar functionality has been depreciated in
favor of other ways of connecting, such as though sockets or wxFileSystem.
- wxDocManager::GetNoHistoryFiles() renamed to GetHistoryFilesCount()

View File

@@ -344,7 +344,7 @@ The sample also provides some timings for adding/deleting/sorting a lot of
\subsection{Mediaplayer sample}\label{samplemediaplayer}
This sample demonstrates how to use all the features of
\helpref{wxMediaCtrl}{wxmediactrl} and play various types of sound, video,
\helpref{wxMediaCtrl}{wxmediactrl} and play various types of sound, video,
and other files.
@@ -352,7 +352,7 @@ It replaces the old dynamic sample.
\subsection{Notebook sample}\label{samplenotebook}
This samples shows family of controls which derive from wxBookCtrl base class.
This samples shows family of controls which derive from wxBookCtrlBase base class.
Although initially it was written to demonstrate \helpref{wxNotebook}{wxnotebook}
only, it can now be also used to see \helpref{wxListbook}{wxlistbook} and
\helpref{wxChoicebook}{wxchoicebook} in action. Test each of the controls, their

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/bookctrl.h
// Purpose: wxBookCtrl: common base class for wxList/Tree/Notebook
// Purpose: wxBookCtrlBase: common base class for wxList/Tree/Notebook
// Author: Vadim Zeitlin
// Modified by:
// Created: 19.08.03
@@ -32,26 +32,26 @@ WX_DEFINE_EXPORTED_ARRAY_PTR(wxWindow *, wxArrayPages);
class WXDLLEXPORT wxImageList;
// ----------------------------------------------------------------------------
// wxBookCtrl
// wxBookCtrlBase
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBookCtrl : public wxControl
class WXDLLEXPORT wxBookCtrlBase : public wxControl
{
public:
// construction
// ------------
wxBookCtrl()
wxBookCtrlBase()
{
Init();
}
wxBookCtrl(wxWindow *parent,
wxWindowID winid,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxEmptyString)
wxBookCtrlBase(wxWindow *parent,
wxWindowID winid,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxEmptyString)
{
Init();
@@ -67,7 +67,7 @@ public:
const wxString& name = wxEmptyString);
// dtor
virtual ~wxBookCtrl();
virtual ~wxBookCtrlBase();
// accessors
@@ -84,7 +84,7 @@ public:
{
int n = GetSelection();
return n == wxNOT_FOUND ? NULL
: wx_const_cast(wxBookCtrl *, this)->GetPage(n);
: wx_const_cast(wxBookCtrlBase *, this)->GetPage(n);
}
// get the currently selected page or wxNOT_FOUND if none
@@ -208,18 +208,18 @@ protected:
bool m_ownsImageList;
DECLARE_NO_COPY_CLASS(wxBookCtrl)
DECLARE_NO_COPY_CLASS(wxBookCtrlBase)
};
// ----------------------------------------------------------------------------
// wxBookCtrlEvent: page changing events generated by derived classes
// wxBookCtrlBaseEvent: page changing events generated by derived classes
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxBookCtrlEvent : public wxNotifyEvent
class WXDLLEXPORT wxBookCtrlBaseEvent : public wxNotifyEvent
{
public:
wxBookCtrlEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
int nSel = -1, int nOldSel = -1)
wxBookCtrlBaseEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
int nSel = -1, int nOldSel = -1)
: wxNotifyEvent(commandType, winid)
{
m_nSel = nSel;
@@ -239,6 +239,35 @@ private:
m_nOldSel; // previously selected page
};
// make a default book control for given platform
#if defined(__WXMSW__) && defined(__SMARTPHONE__)
#include "wx\choicebook.h"
#define wxBookCtrl wxChoicebook
#define wxBookCtrlEvent wxChoicebookEvent
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING
#define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_CHOICEBOOK_PAGE_CHANGED(id, fn)
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_CHOICEBOOK_PAGE_CHANGING(id, fn)
#define wxBC_TOP wxNB_TOP
#define wxBC_BOTTOM wxNB_BOTTOM
#define wxBC_LEFT wxNB_LEFT
#define wxBC_RIGHT wxNB_RIGHT
#define wxBC_DEFAULT wxNB_DEFAULT
#else
#include "wx\notebook.h"
#define wxBookCtrl wxNotebook
#define wxBookCtrlEvent wxNotebookEvent
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGED wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
#define wxEVT_COMMAND_BOOKCTRL_PAGE_CHANGING wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
#define EVT_BOOKCTRL_PAGE_CHANGED(id, fn) EVT_NOTEBOOK_PAGE_CHANGED(id, fn)
#define EVT_BOOKCTRL_PAGE_CHANGING(id, fn) EVT_NOTEBOOK_PAGE_CHANGING(id, fn)
#define wxBC_TOP wxCHB_TOP
#define wxBC_BOTTOM wxCHB_BOTTOM
#define wxBC_LEFT wxCHB_LEFT
#define wxBC_RIGHT wxCHB_RIGHT
#define wxBC_DEFAULT wxCHB_DEFAULT
#endif
#endif // wxUSE_BOOKCTRL
#endif // _WX_BOOKCTRL_H_

View File

@@ -28,7 +28,7 @@ class WXDLLEXPORT wxChoice;
// wxChoicebook
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxChoicebook : public wxBookCtrl
class WXDLLEXPORT wxChoicebook : public wxBookCtrlBase
{
public:
wxChoicebook()
@@ -107,12 +107,12 @@ private:
// choicebook event class and related stuff
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlEvent
class WXDLLEXPORT wxChoicebookEvent : public wxBookCtrlBaseEvent
{
public:
wxChoicebookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = -1, int nOldSel = -1)
: wxBookCtrlEvent(commandType, id, nSel, nOldSel)
: wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
{
}

View File

@@ -43,7 +43,7 @@ class WXDLLEXPORT wxStaticLine;
// wxListbook
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxListbook : public wxBookCtrl
class WXDLLEXPORT wxListbook : public wxBookCtrlBase
{
public:
wxListbook()
@@ -129,12 +129,12 @@ private:
// listbook event class and related stuff
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxListbookEvent : public wxBookCtrlEvent
class WXDLLEXPORT wxListbookEvent : public wxBookCtrlBaseEvent
{
public:
wxListbookEvent(wxEventType commandType = wxEVT_NULL, int id = 0,
int nSel = wxNOT_FOUND, int nOldSel = wxNOT_FOUND)
: wxBookCtrlEvent(commandType, id, nSel, nOldSel)
: wxBookCtrlBaseEvent(commandType, id, nSel, nOldSel)
{
}

View File

@@ -47,7 +47,7 @@ typedef wxWindow wxNotebookPage; // so far, any window can be a page
// wxNotebookBase: define wxNotebook interface
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxNotebookBase : public wxBookCtrl
class WXDLLEXPORT wxNotebookBase : public wxBookCtrlBase
{
public:
// ctors
@@ -62,8 +62,8 @@ public:
long style = 0,
const wxString& name = wxNOTEBOOK_NAME) ;
// wxNotebook-specific additions to wxBookCtrl interface
// -----------------------------------------------------
// wxNotebook-specific additions to wxBookCtrlBase interface
// ---------------------------------------------------------
// get the number of rows for a control with wxNB_MULTILINE style (not all
// versions support it - they will always return 1 then)
@@ -95,12 +95,12 @@ protected:
// notebook event class and related stuff
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxNotebookEvent : public wxBookCtrlEvent
class WXDLLEXPORT wxNotebookEvent : public wxBookCtrlBaseEvent
{
public:
wxNotebookEvent(wxEventType commandType = wxEVT_NULL, int winid = 0,
int nSel = -1, int nOldSel = -1)
: wxBookCtrlEvent(commandType, winid, nSel, nOldSel)
: wxBookCtrlBaseEvent(commandType, winid, nSel, nOldSel)
{
}

View File

@@ -644,7 +644,7 @@ private:
#if WXWIN_COMPATIBILITY_2_4
// NB: wxBookCtrlSizer and wxNotebookSizer are deprecated, they
// don't do anything. wxBookCtrl::DoGetBestSize does the job now.
// don't do anything. wxBookCtrlBase::DoGetBestSize does the job now.
// ----------------------------------------------------------------------------
// wxBookCtrlSizer
@@ -654,14 +654,14 @@ private:
// this sizer works with wxNotebook/wxListbook/... and sizes the control to
// fit its pages
class WXDLLEXPORT wxBookCtrl;
class WXDLLEXPORT wxBookCtrlBase;
class WXDLLEXPORT wxBookCtrlSizer : public wxSizer
{
public:
wxDEPRECATED( wxBookCtrlSizer(wxBookCtrl *bookctrl) );
wxDEPRECATED( wxBookCtrlSizer(wxBookCtrlBase *bookctrl) );
wxBookCtrl *GetControl() const { return m_bookctrl; }
wxBookCtrlBase *GetControl() const { return m_bookctrl; }
virtual void RecalcSizes();
virtual wxSize CalcMin();
@@ -671,7 +671,7 @@ protected:
// and still have warning-free build of the library itself:
wxBookCtrlSizer() {}
wxBookCtrl *m_bookctrl;
wxBookCtrlBase *m_bookctrl;
private:
DECLARE_CLASS(wxBookCtrlSizer)
@@ -681,7 +681,7 @@ private:
#if wxUSE_NOTEBOOK
// before wxBookCtrl we only had wxNotebookSizer, keep it for backwards
// before wxBookCtrlBase we only had wxNotebookSizer, keep it for backwards
// compatibility
class WXDLLEXPORT wxNotebook;

View File

@@ -23,7 +23,7 @@
#include "wx/spinbutt.h"
#endif
#include "wx/tglbtn.h"
#include "wx/notebook.h"
#include "wx/bookctrl.h"
#include "wx/imaglist.h"
#include "wx/artprov.h"
@@ -88,8 +88,8 @@ public:
void OnRadioButton1( wxCommandEvent &event );
void OnRadioButton2( wxCommandEvent &event );
void OnSetFont( wxCommandEvent &event );
void OnPageChanged( wxNotebookEvent &event );
void OnPageChanging( wxNotebookEvent &event );
void OnPageChanged( wxBookCtrlEvent &event );
void OnPageChanging( wxBookCtrlEvent &event );
void OnSliderUpdate( wxCommandEvent &event );
void OnUpdateLabel( wxCommandEvent &event );
#if wxUSE_SPINBTN
@@ -142,7 +142,7 @@ public:
wxCheckBox *m_checkbox;
wxTextCtrl *m_text;
wxNotebook *m_notebook;
wxBookCtrl *m_book;
wxStaticText *m_label;
@@ -355,7 +355,7 @@ bool MyApp::OnInit()
// MyPanel
//----------------------------------------------------------------------
const int ID_NOTEBOOK = 1000;
const int ID_BOOK = 1000;
const int ID_LISTBOX = 130;
const int ID_LISTBOX_SEL_NUM = 131;
@@ -420,8 +420,8 @@ const int ID_SIZER_CHECKBIG = 206;
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
EVT_SIZE ( MyPanel::OnSize)
EVT_NOTEBOOK_PAGE_CHANGING(ID_NOTEBOOK, MyPanel::OnPageChanging)
EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, MyPanel::OnPageChanged)
EVT_BOOKCTRL_PAGE_CHANGING(ID_BOOK, MyPanel::OnPageChanging)
EVT_BOOKCTRL_PAGE_CHANGED(ID_BOOK, MyPanel::OnPageChanged)
EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox)
EVT_LISTBOX (ID_LISTBOX_SORTED, MyPanel::OnListBox)
EVT_LISTBOX_DCLICK(ID_LISTBOX, MyPanel::OnListBoxDoubleClick)
@@ -542,7 +542,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_spintext = NULL;
m_checkbox = NULL;
m_text = NULL;
m_notebook = NULL;
m_book = NULL;
m_label = NULL;
m_text = new wxTextCtrl(this, wxID_ANY, _T("This is the log window.\n"),
@@ -551,7 +551,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_logTargetOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_text));
m_notebook = new wxNotebook(this, ID_NOTEBOOK);
m_book = new wxBookCtrl(this, ID_BOOK);
wxString choices[] =
{
@@ -580,7 +580,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
imagelist-> Add( wxBitmap( text_xpm ));
imagelist-> Add( wxBitmap( radio_xpm ));
imagelist-> Add( wxBitmap( gauge_xpm ));
m_notebook->SetImageList(imagelist);
m_book->SetImageList(imagelist);
#elif defined(__WXMSW__)
// load images from resources
enum
@@ -600,12 +600,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
wxBitmap bmp(s_iconNames[n]);
if ( !bmp.Ok() || (imagelist->Add(bmp) == -1) )
{
wxLogWarning(wxT("Couldn't load the image '%s' for the notebook page %d."),
wxLogWarning(wxT("Couldn't load the image '%s' for the book control page %d."),
s_iconNames[n], n);
}
}
m_notebook->SetImageList(imagelist);
m_book->SetImageList(imagelist);
#else
// No images for now
@@ -619,7 +619,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
#endif
wxPanel *panel = new wxPanel(m_notebook);
wxPanel *panel = new wxPanel(m_book);
m_listbox = new wxListBox( panel, ID_LISTBOX,
wxPoint(10,10), wxSize(120,70),
5, choices, wxLB_ALWAYS_SB );
@@ -658,10 +658,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
(void)new wxCheckBox( panel, ID_CHANGE_COLOUR, _T("&Toggle colour"),
wxPoint(110,170) );
panel->SetCursor(wxCursor(wxCURSOR_HAND));
m_notebook->AddPage(panel, _T("wxListBox"), true, Image_List);
m_book->AddPage(panel, _T("wxListBox"), true, Image_List);
#if wxUSE_CHOICE
panel = new wxPanel(m_notebook);
panel = new wxPanel(m_book);
m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,wxDefaultCoord), 5, choices );
m_choiceSorted = new wxChoice( panel, ID_CHOICE_SORTED, wxPoint(10,70), wxSize(120,wxDefaultCoord),
5, choices, wxCB_SORT );
@@ -679,10 +679,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
(void)new wxButton( panel, ID_CHOICE_FONT, _T("Set &Italic font"), wxPoint(340,130), wxSize(140,30) );
(void)new wxCheckBox( panel, ID_CHOICE_ENABLE, _T("&Disable"), wxPoint(20,130), wxSize(140,30) );
m_notebook->AddPage(panel, _T("wxChoice"), false, Image_Choice);
m_book->AddPage(panel, _T("wxChoice"), false, Image_Choice);
#endif // wxUSE_CHOICE
panel = new wxPanel(m_notebook);
panel = new wxPanel(m_book);
(void)new wxStaticBox( panel, wxID_ANY, _T("&Box around combobox"),
wxPoint(5, 5), wxSize(150, 100));
m_combo = new MyComboBox( panel, ID_COMBO, _T("This"),
@@ -698,7 +698,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
(void)new wxButton( panel, ID_COMBO_DELETE, _T("D&elete selected item"), wxPoint(180,130), wxSize(140,30) );
(void)new wxButton( panel, ID_COMBO_FONT, _T("Set &Italic font"), wxPoint(340,130), wxSize(140,30) );
(void)new wxCheckBox( panel, ID_COMBO_ENABLE, _T("&Disable"), wxPoint(20,130), wxSize(140,30) );
m_notebook->AddPage(panel, _T("wxComboBox"), false, Image_Combo);
m_book->AddPage(panel, _T("wxComboBox"), false, Image_Combo);
wxString choices2[] =
{
@@ -708,7 +708,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
"Seventh", "Eighth", "Nineth", "Tenth" */
};
panel = new wxPanel(m_notebook);
panel = new wxPanel(m_book);
(void)new MyRadioBox( panel, ID_RADIOBOX, _T("&That"), wxPoint(10,160), wxDefaultSize, WXSIZEOF(choices2), choices2, 1, wxRA_SPECIFY_ROWS );
m_radio = new wxRadioBox( panel, ID_RADIOBOX, _T("T&his"), wxPoint(10,10), wxDefaultSize, WXSIZEOF(choices), choices, 1, wxRA_SPECIFY_COLS );
m_radio->SetForegroundColour(*wxRED);
@@ -726,9 +726,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
wxRadioButton *rb = new wxRadioButton( panel, ID_RADIOBUTTON_1, _T("Radiobutton1"), wxPoint(210,170), wxDefaultSize, wxRB_GROUP );
rb->SetValue( false );
(void)new wxRadioButton( panel, ID_RADIOBUTTON_2, _T("&Radiobutton2"), wxPoint(340,170), wxDefaultSize );
m_notebook->AddPage(panel, _T("wxRadioBox"), false, Image_Radio);
m_book->AddPage(panel, _T("wxRadioBox"), false, Image_Radio);
panel = new wxPanel(m_notebook);
panel = new wxPanel(m_book);
(void)new wxStaticBox( panel, wxID_ANY, _T("&wxGauge and wxSlider"), wxPoint(10,10), wxSize(222,130) );
m_gauge = new wxGauge( panel, wxID_ANY, 200, wxPoint(18,50), wxSize(155, 30), wxGA_HORIZONTAL|wxNO_BORDER );
m_gauge->SetBackgroundColour(*wxGREEN);
@@ -785,9 +785,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_spinctrl->SetValue(15);
#endif // wxUSE_SPINCTRL
m_notebook->AddPage(panel, _T("wxGauge"), false, Image_Gauge);
m_book->AddPage(panel, _T("wxGauge"), false, Image_Gauge);
panel = new wxPanel(m_notebook);
panel = new wxPanel(m_book);
#if !defined(__WXMOTIF__) // wxStaticBitmap not working under Motif yet.
wxIcon icon = wxArtProvider::GetIcon(wxART_INFORMATION);
@@ -846,18 +846,18 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/);
m_label->SetForegroundColour( *wxBLUE );
m_notebook->AddPage(panel, _T("wxBitmapXXX"));
m_book->AddPage(panel, _T("wxBitmapXXX"));
// sizer
panel = new wxPanel(m_notebook);
panel = new wxPanel(m_book);
panel->SetAutoLayout( true );
wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer *csizer =
new wxStaticBoxSizer (new wxStaticBox (panel, wxID_ANY, _T("Show Buttons")), wxHORIZONTAL );
wxCheckBox *check1, *check2, *check3, *check4, *check14, *checkBig;
check1 = new wxCheckBox (panel, ID_SIZER_CHECK1, _T("1"));
check1->SetValue (true);
@@ -877,13 +877,13 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
checkBig = new wxCheckBox (panel, ID_SIZER_CHECKBIG, _T("Big"));
checkBig->SetValue (true);
csizer->Add (checkBig);
sizer->Add (csizer);
m_hsizer = new wxBoxSizer( wxHORIZONTAL );
m_buttonSizer = new wxBoxSizer (wxVERTICAL);
m_sizerBtn1 = new wxButton(panel, wxID_ANY, _T("Test Button &1 (tab order 1)") );
m_buttonSizer->Add( m_sizerBtn1, 0, wxALL, 10 );
m_sizerBtn2 = new wxButton(panel, wxID_ANY, _T("Test Button &2 (tab order 3)") );
@@ -904,7 +904,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
panel->SetSizer( sizer );
m_notebook->AddPage(panel, _T("wxSizer"));
m_book->AddPage(panel, _T("wxSizer"));
}
void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
@@ -913,11 +913,11 @@ void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
int y = 0;
GetClientSize( &x, &y );
if (m_notebook) m_notebook->SetSize( 2, 2, x-4, y*2/3-4 );
if (m_book) m_book->SetSize( 2, 2, x-4, y*2/3-4 );
if (m_text) m_text->SetSize( 2, y*2/3+2, x-4, y/3-4 );
}
void MyPanel::OnPageChanging( wxNotebookEvent &event )
void MyPanel::OnPageChanging( wxBookCtrlEvent &event )
{
int selOld = event.GetOldSelection();
if ( selOld == 2 )
@@ -934,16 +934,16 @@ void MyPanel::OnPageChanging( wxNotebookEvent &event )
}
}
*m_text << _T("Notebook selection is being changed from ") << selOld
*m_text << _T("Book selection is being changed from ") << selOld
<< _T(" to ") << event.GetSelection()
<< _T(" (current page from notebook is ")
<< m_notebook->GetSelection() << _T(")\n");
<< _T(" (current page from book is ")
<< m_book->GetSelection() << _T(")\n");
}
void MyPanel::OnPageChanged( wxNotebookEvent &event )
void MyPanel::OnPageChanged( wxBookCtrlEvent &event )
{
*m_text << _T("Notebook selection is now ") << event.GetSelection()
<< _T(" (from notebook: ") << m_notebook->GetSelection()
*m_text << _T("Book selection is now ") << event.GetSelection()
<< _T(" (from book: ") << m_book->GetSelection()
<< _T(")\n");
}
@@ -1418,13 +1418,13 @@ void MyPanel::OnUpdateShowProgress( wxUpdateUIEvent& event )
void MyPanel::OnShowProgress( wxCommandEvent& WXUNUSED(event) )
{
int max = m_spinbutton->GetValue();
if ( max <= 0 )
{
wxLogError(_T("You must set positive range!"));
return;
}
wxProgressDialog dialog(_T("Progress dialog example"),
_T("An informative message"),
max, // range
@@ -1503,7 +1503,7 @@ MyPanel::~MyPanel()
//wxLog::RemoveTraceMask(_T("focus"));
delete wxLog::SetActiveTarget(m_logTargetOld);
delete m_notebook->GetImageList();
delete m_book->GetImageList();
}
//----------------------------------------------------------------------

View File

@@ -44,7 +44,7 @@ bool MyApp::OnInit()
return true;
}
wxPanel *CreateUserCreatedPage(wxBookCtrl *parent)
wxPanel *CreateUserCreatedPage(wxBookCtrlBase *parent)
{
wxPanel *panel = new wxPanel(parent);
@@ -54,7 +54,7 @@ wxPanel *CreateUserCreatedPage(wxBookCtrl *parent)
return panel;
}
wxPanel *CreateRadioButtonsPage(wxBookCtrl *parent)
wxPanel *CreateRadioButtonsPage(wxBookCtrlBase *parent)
{
wxPanel *panel = new wxPanel(parent);
@@ -79,7 +79,7 @@ wxPanel *CreateRadioButtonsPage(wxBookCtrl *parent)
return panel;
}
wxPanel *CreateVetoPage(wxBookCtrl *parent)
wxPanel *CreateVetoPage(wxBookCtrlBase *parent)
{
wxPanel *panel = new wxPanel(parent);
@@ -89,7 +89,7 @@ wxPanel *CreateVetoPage(wxBookCtrl *parent)
return panel;
}
wxPanel *CreateBigButtonPage(wxBookCtrl *parent)
wxPanel *CreateBigButtonPage(wxBookCtrlBase *parent)
{
wxPanel *panel = new wxPanel(parent);
@@ -103,7 +103,7 @@ wxPanel *CreateBigButtonPage(wxBookCtrl *parent)
}
wxPanel *CreateInsertPage(wxBookCtrl *parent)
wxPanel *CreateInsertPage(wxBookCtrlBase *parent)
{
wxPanel *panel = new wxPanel(parent);
@@ -114,7 +114,7 @@ wxPanel *CreateInsertPage(wxBookCtrl *parent)
return panel;
}
int GetIconIndex(wxBookCtrl* bookCtrl)
int GetIconIndex(wxBookCtrlBase* bookCtrl)
{
if (bookCtrl && bookCtrl->GetImageList())
{
@@ -128,7 +128,7 @@ int GetIconIndex(wxBookCtrl* bookCtrl)
return -1;
}
void CreateInitialPages(wxBookCtrl *parent)
void CreateInitialPages(wxBookCtrlBase *parent)
{
// Create and add some panels to the notebook
@@ -147,7 +147,7 @@ void CreateInitialPages(wxBookCtrl *parent)
parent->SetSelection(1);
}
wxPanel *CreatePage(wxBookCtrl *parent, const wxString&pageName)
wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName)
{
if
(
@@ -413,7 +413,7 @@ void MyFrame::RecreateBooks()
ShowCurrentBook();
}
wxBookCtrl *MyFrame::GetCurrentBook()
wxBookCtrlBase *MyFrame::GetCurrentBook()
{
switch (m_type)
{
@@ -483,7 +483,7 @@ END_EVENT_TABLE()
void MyFrame::OnType(wxCommandEvent& event)
{
wxBookCtrl *currBook = GetCurrentBook();
wxBookCtrlBase *currBook = GetCurrentBook();
m_type = event.GetId();
@@ -524,7 +524,7 @@ void MyFrame::OnAddPage(wxCommandEvent& WXUNUSED(event))
{
static unsigned s_pageAdded = 0;
wxBookCtrl *currBook = GetCurrentBook();
wxBookCtrlBase *currBook = GetCurrentBook();
if ( currBook )
{
@@ -543,7 +543,7 @@ void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event))
{
static unsigned s_pageIns = 0;
wxBookCtrl *currBook = GetCurrentBook();
wxBookCtrlBase *currBook = GetCurrentBook();
if ( currBook )
{
@@ -559,7 +559,7 @@ void MyFrame::OnInsertPage(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnDeleteCurPage(wxCommandEvent& WXUNUSED(event))
{
wxBookCtrl *currBook = GetCurrentBook();
wxBookCtrlBase *currBook = GetCurrentBook();
if ( currBook )
{
@@ -574,7 +574,7 @@ void MyFrame::OnDeleteCurPage(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnDeleteLastPage(wxCommandEvent& WXUNUSED(event))
{
wxBookCtrl *currBook = GetCurrentBook();
wxBookCtrlBase *currBook = GetCurrentBook();
if ( currBook )
{
@@ -589,7 +589,7 @@ void MyFrame::OnDeleteLastPage(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnNextPage(wxCommandEvent& WXUNUSED(event))
{
wxBookCtrl *currBook = GetCurrentBook();
wxBookCtrlBase *currBook = GetCurrentBook();
if ( currBook )
{
@@ -601,9 +601,9 @@ void MyFrame::OnIdle( wxIdleEvent& WXUNUSED(event) )
{
static int s_nPages = wxNOT_FOUND;
static int s_nSel = wxNOT_FOUND;
static wxBookCtrl *s_currBook = NULL;
static wxBookCtrlBase *s_currBook = NULL;
wxBookCtrl *currBook = GetCurrentBook();
wxBookCtrlBase *currBook = GetCurrentBook();
int nPages = currBook ? currBook->GetPageCount() : 0;
int nSel = currBook ? currBook->GetSelection() : wxNOT_FOUND;
@@ -643,7 +643,7 @@ void MyFrame::OnBook(wxBookEvent& event)
else if (eventType == wxEVT_PAGE_CHANGING) \
{ \
int idx = event.GetOldSelection(); \
wxBookCtrl *book = (wxBookCtrl *)event.GetEventObject(); \
wxBookCtrlBase *book = (wxBookCtrlBase *)event.GetEventObject(); \
if ( idx != wxNOT_FOUND && book && book->GetPageText(idx) == VETO_PAGE_NAME ) \
{ \
if \

View File

@@ -60,7 +60,7 @@ public:
void OnIdle(wxIdleEvent& event);
wxBookCtrl *GetCurrentBook();
wxBookCtrlBase *GetCurrentBook();
private:
wxLog *m_logTargetOld;

View File

@@ -77,7 +77,7 @@ enum
class ButtonWidgetsPage : public WidgetsPage
{
public:
ButtonWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
ButtonWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual ~ButtonWidgetsPage(){};
virtual wxControl *GetWidget() const { return m_button; }
@@ -139,9 +139,9 @@ END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"));
ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook,
wxImageList *imaglist)
: WidgetsPage(notebook)
ButtonWidgetsPage::ButtonWidgetsPage(wxBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
{
imaglist->Add(wxBitmap(button_xpm));

View File

@@ -73,7 +73,7 @@ enum
class CheckBoxWidgetsPage : public WidgetsPage
{
public:
CheckBoxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
CheckBoxWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual ~CheckBoxWidgetsPage(){};
virtual wxControl *GetWidget() const { return m_checkbox; }
@@ -149,9 +149,9 @@ END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"));
CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxNotebook *notebook,
wxImageList *imaglist)
: WidgetsPage(notebook)
CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
{
imaglist->Add(wxBitmap(checkbox_xpm));

View File

@@ -84,7 +84,7 @@ enum
class ComboboxWidgetsPage : public WidgetsPage
{
public:
ComboboxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
ComboboxWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual wxControl *GetWidget() const { return m_combobox; }
@@ -190,9 +190,9 @@ END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, _T("Combobox"));
ComboboxWidgetsPage::ComboboxWidgetsPage(wxNotebook *notebook,
wxImageList *imaglist)
: WidgetsPage(notebook)
ComboboxWidgetsPage::ComboboxWidgetsPage(wxBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
{
// init everything
m_chkSort =

View File

@@ -71,7 +71,7 @@ enum
class GaugeWidgetsPage : public WidgetsPage
{
public:
GaugeWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
GaugeWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual ~GaugeWidgetsPage();
virtual wxControl *GetWidget() const { return m_gauge; }
@@ -158,9 +158,9 @@ END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, _T("Gauge"));
GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook,
wxImageList *imaglist)
: WidgetsPage(notebook)
GaugeWidgetsPage::GaugeWidgetsPage(wxBookCtrl *book,
wxImageList *imaglist)
:WidgetsPage(book)
{
imaglist->Add(wxBitmap(gauge_xpm));

View File

@@ -76,7 +76,7 @@ enum
class ListboxWidgetsPage : public WidgetsPage
{
public:
ListboxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
ListboxWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual wxControl *GetWidget() const { return m_lbox; }
@@ -193,9 +193,9 @@ END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, _T("Listbox"));
ListboxWidgetsPage::ListboxWidgetsPage(wxNotebook *notebook,
ListboxWidgetsPage::ListboxWidgetsPage(wxBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(notebook)
: WidgetsPage(book)
{
imaglist->Add(wxBitmap(listbox_xpm));

View File

@@ -24,6 +24,8 @@
#pragma hdrstop
#endif
#if wxUSE_NOTEBOOK
// for all others, include the necessary headers
#ifndef WX_PRECOMP
#include "wx/app.h"
@@ -44,7 +46,6 @@
#include "wx/artprov.h"
#include "widgets.h"
#if 1
#include "icons/notebook.xpm"
// ----------------------------------------------------------------------------
@@ -78,11 +79,6 @@ enum Orient
Orient_Max
};
// old versions of wxWidgets don't define this style
#ifndef wxNB_TOP
#define wxNB_TOP (0)
#endif
// ----------------------------------------------------------------------------
// NotebookWidgetsPage
// ----------------------------------------------------------------------------
@@ -395,7 +391,7 @@ void NotebookWidgetsPage::CreateNotebook()
m_notebook->AddPage(CreateNewPage(),
old_note->GetPageText(n),
false,
m_chkImages->GetValue() ?
m_chkImages->GetValue() ?
GetIconIndex() : -1);
}
@@ -548,4 +544,4 @@ void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
event.Skip();
}
#endif
#endif // wxUSE_NOTEBOOK

View File

@@ -24,6 +24,8 @@
#pragma hdrstop
#endif
#if wxUSE_RADIOBOX
// for all others, include the necessary headers
#ifndef WX_PRECOMP
#include "wx/log.h"
@@ -39,7 +41,7 @@
#include "wx/sizer.h"
#include "widgets.h"
#if 1
#include "icons/radiobox.xpm"
// ----------------------------------------------------------------------------
@@ -76,7 +78,7 @@ static const unsigned int DEFAULT_MAJOR_DIM = 3;
class RadioWidgetsPage : public WidgetsPage
{
public:
RadioWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
RadioWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual ~RadioWidgetsPage(){};
virtual wxControl *GetWidget() const { return m_radio; }
@@ -154,9 +156,9 @@ END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, _T("Radio"));
RadioWidgetsPage::RadioWidgetsPage(wxNotebook *notebook,
wxImageList *imaglist)
: WidgetsPage(notebook)
RadioWidgetsPage::RadioWidgetsPage(wxBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
{
imaglist->Add(wxBitmap(radio_xpm));
@@ -455,4 +457,4 @@ void RadioWidgetsPage::OnUpdateUIReset(wxUpdateUIEvent& event)
event.Enable(enable);
}
#endif
#endif // wxUSE_RADIOBOX

View File

@@ -24,6 +24,8 @@
#pragma hdrstop
#endif
#if wxUSE_SLIDER
// for all others, include the necessary headers
#ifndef WX_PRECOMP
#include "wx/log.h"
@@ -44,7 +46,7 @@
#include "wx/sizer.h"
#include "widgets.h"
#if wxUSE_SLIDER
#include "icons/slider.xpm"
// ----------------------------------------------------------------------------
@@ -87,7 +89,7 @@ enum
class SliderWidgetsPage : public WidgetsPage
{
public:
SliderWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
SliderWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual ~SliderWidgetsPage(){};
virtual wxControl *GetWidget() const { return m_slider; }
@@ -197,9 +199,9 @@ END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, _T("Slider"));
SliderWidgetsPage::SliderWidgetsPage(wxNotebook *notebook,
wxImageList *imaglist)
: WidgetsPage(notebook)
SliderWidgetsPage::SliderWidgetsPage(wxBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
{
imaglist->Add(wxBitmap(slider_xpm));
@@ -600,5 +602,4 @@ void SliderWidgetsPage::OnSlider(wxScrollEvent& event)
event.GetPosition());
}
#endif
// wxUSE_SLIDER
#endif // wxUSE_SLIDER

View File

@@ -24,6 +24,8 @@
#pragma hdrstop
#endif
#if wxUSE_SPINBTN
// for all others, include the necessary headers
#ifndef WX_PRECOMP
#include "wx/log.h"
@@ -42,7 +44,7 @@
#include "wx/sizer.h"
#include "widgets.h"
#if wxUSE_SPINBTN
#include "icons/spinbtn.xpm"
// ----------------------------------------------------------------------------
@@ -71,7 +73,7 @@ enum
class SpinBtnWidgetsPage : public WidgetsPage
{
public:
SpinBtnWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
SpinBtnWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual ~SpinBtnWidgetsPage(){};
virtual wxControl *GetWidget() const { return m_spinbtn; }
@@ -164,9 +166,9 @@ END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, _T("Spin"));
SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook,
SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(notebook)
: WidgetsPage(book)
{
m_chkVert = NULL;
m_chkWrap = NULL;

View File

@@ -139,7 +139,7 @@ END_EVENT_TABLE()
class StaticWidgetsPage : public WidgetsPage
{
public:
StaticWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
StaticWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual ~StaticWidgetsPage(){};
virtual wxControl *GetWidget() const { return m_statText; }
@@ -205,9 +205,9 @@ END_EVENT_TABLE()
IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, _T("Static"));
StaticWidgetsPage::StaticWidgetsPage(wxNotebook *notebook,
wxImageList *imaglist)
: WidgetsPage(notebook)
StaticWidgetsPage::StaticWidgetsPage(wxBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
{
imaglist->Add(wxBitmap(statbox_xpm));

View File

@@ -113,7 +113,7 @@ class TextWidgetsPage : public WidgetsPage
{
public:
// ctor(s) and dtor
TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
TextWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
virtual ~TextWidgetsPage(){};
virtual wxControl *GetWidget() const { return m_text; }
@@ -310,8 +310,8 @@ IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, _T("Text"));
// TextWidgetsPage creation
// ----------------------------------------------------------------------------
TextWidgetsPage::TextWidgetsPage(wxNotebook *notebook, wxImageList *imaglist)
: WidgetsPage(notebook)
TextWidgetsPage::TextWidgetsPage(wxBookCtrl *book, wxImageList *imaglist)
: WidgetsPage(book)
{
imaglist->Add(wxBitmap(text_xpm));

View File

@@ -39,7 +39,7 @@
#include "wx/textctrl.h"
#endif
#include "wx/notebook.h"
#include "wx/bookctrl.h"
#include "wx/sizer.h"
#include "wx/colordlg.h"
@@ -94,8 +94,8 @@ protected:
void OnSetBgCol(wxCommandEvent& event);
#endif // wxUSE_MENUS
// initialize the notebook: add all pages to it
void InitNotebook();
// initialize the book: add all pages to it
void InitBook();
private:
// the panel containing everything
@@ -109,8 +109,8 @@ private:
wxLog *m_logTarget;
#endif // wxUSE_LOG
// the notebook containing the test pages
wxNotebook *m_notebook;
// the book containing the test pages
wxBookCtrl *m_book;
// and the image list for it
wxImageList *m_imaglist;
@@ -267,7 +267,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
m_lboxLog = (wxListBox *)NULL;
m_logTarget = (wxLog *)NULL;
#endif // wxUSE_LOG
m_notebook = (wxNotebook *)NULL;
m_book = (wxBookCtrl *)NULL;
m_imaglist = (wxImageList *)NULL;
#if wxUSE_MENUS
@@ -288,12 +288,12 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
// we have 2 panes: notebook which pages demonstrating the controls in the
// we have 2 panes: book which pages demonstrating the controls in the
// upper one and the log window with some buttons in the lower
m_notebook = new wxNotebook(m_panel, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
InitNotebook();
m_book = new wxBookCtrl(m_panel, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN|wxBC_DEFAULT);
InitBook();
// the lower one only has the log listbox and a button to clear it
#if wxUSE_LOG
@@ -320,7 +320,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
sizerDown->Add(sizerBtns, 0, wxALL | wxALIGN_RIGHT, 5);
// put everything together
sizerTop->Add(m_notebook, 1, wxGROW | (wxALL & ~(wxTOP | wxBOTTOM)), 10);
sizerTop->Add(m_book, 1, wxGROW | (wxALL & ~(wxTOP | wxBOTTOM)), 10);
sizerTop->Add(0, 5, 0, wxGROW); // spacer in between
sizerTop->Add(sizerDown, 0, wxGROW | (wxALL & ~wxTOP), 10);
@@ -338,19 +338,19 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
#endif
}
void WidgetsFrame::InitNotebook()
void WidgetsFrame::InitBook()
{
m_imaglist = new wxImageList(32, 32);
ArrayWidgetsPage pages;
wxArrayString labels;
// we need to first create all pages and only then add them to the notebook
// we need to first create all pages and only then add them to the book
// as we need the image list first
WidgetsPageInfo *info = WidgetsPage::ms_widgetPages;
while ( info )
{
WidgetsPage *page = (*info->GetCtor())(m_notebook, m_imaglist);
WidgetsPage *page = (*info->GetCtor())(m_book, m_imaglist);
pages.Add(page);
labels.Add(info->GetLabel());
@@ -358,18 +358,18 @@ void WidgetsFrame::InitNotebook()
info = info->GetNext();
}
m_notebook->SetImageList(m_imaglist);
m_book->SetImageList(m_imaglist);
// now do add them
size_t count = pages.GetCount();
for ( size_t n = 0; n < count; n++ )
{
m_notebook->AddPage(
pages[n],
labels[n],
false, // don't select
n // image id
);
m_book->AddPage(
pages[n],
labels[n],
false, // don't select
n // image id
);
}
}
@@ -407,7 +407,7 @@ void WidgetsFrame::OnSetFgCol(wxCommandEvent& WXUNUSED(event))
m_colFg = col;
WidgetsPage *page = wxStaticCast(m_notebook->GetCurrentPage(), WidgetsPage);
WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage);
page->GetWidget()->SetForegroundColour(m_colFg);
page->GetWidget()->Refresh();
}
@@ -420,7 +420,7 @@ void WidgetsFrame::OnSetBgCol(wxCommandEvent& WXUNUSED(event))
m_colBg = col;
WidgetsPage *page = wxStaticCast(m_notebook->GetCurrentPage(), WidgetsPage);
WidgetsPage *page = wxStaticCast(m_book->GetCurrentPage(), WidgetsPage);
page->GetWidget()->SetBackgroundColour(m_colBg);
page->GetWidget()->Refresh();
}
@@ -492,8 +492,8 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxChar *label)
// WidgetsPage
// ----------------------------------------------------------------------------
WidgetsPage::WidgetsPage(wxNotebook *notebook)
: wxPanel(notebook, wxID_ANY,
WidgetsPage::WidgetsPage(wxBookCtrl *book)
: wxPanel(book, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxNO_FULL_REPAINT_ON_RESIZE |
wxCLIP_CHILDREN |

View File

@@ -13,7 +13,7 @@
#define _WX_SAMPLE_WIDGETS_H_
class WXDLLEXPORT wxCheckBox;
class WXDLLEXPORT wxNotebook;
class WXDLLEXPORT wxBookCtrl;
class WXDLLEXPORT wxSizer;
class WXDLLEXPORT wxTextCtrl;
@@ -25,13 +25,13 @@ class WidgetsPageInfo;
#include "wx/imaglist.h"
// ----------------------------------------------------------------------------
// WidgetsPage: a notebook page demonstrating some widget
// WidgetsPage: a book page demonstrating some widget
// ----------------------------------------------------------------------------
class WidgetsPage : public wxPanel
{
public:
WidgetsPage(wxNotebook *notebook);
WidgetsPage(wxBookCtrl *book);
// return the control shown by this page
virtual wxControl *GetWidget() const = 0;
@@ -74,7 +74,7 @@ public:
class WidgetsPageInfo
{
public:
typedef WidgetsPage *(*Constructor)(wxNotebook *notebook,
typedef WidgetsPage *(*Constructor)(wxBookCtrl *book,
wxImageList *imaglist);
// our ctor
@@ -108,9 +108,9 @@ private:
// and this one must be inserted somewhere in the source file
#define IMPLEMENT_WIDGETS_PAGE(classname, label) \
WidgetsPage *wxCtorFor##classname(wxNotebook *notebook, \
WidgetsPage *wxCtorFor##classname(wxBookCtrl *book, \
wxImageList *imaglist) \
{ return new classname(notebook, imaglist); } \
{ return new classname(book, imaglist); } \
WidgetsPageInfo classname:: \
ms_info##classname(wxCtorFor##classname, label)

View File

@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////////
// Name: common/bookctrl.cpp
// Purpose: wxBookCtrl implementation
// Purpose: wxBookCtrlBase implementation
// Author: Vadim Zeitlin
// Modified by:
// Created: 19.08.03
@@ -42,14 +42,14 @@
// constructors and destructors
// ----------------------------------------------------------------------------
void wxBookCtrl::Init()
void wxBookCtrlBase::Init()
{
m_imageList = NULL;
m_ownsImageList = false;
}
bool
wxBookCtrl::Create(wxWindow *parent,
wxBookCtrlBase::Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos,
const wxSize& size,
@@ -68,7 +68,7 @@ wxBookCtrl::Create(wxWindow *parent,
);
}
wxBookCtrl::~wxBookCtrl()
wxBookCtrlBase::~wxBookCtrlBase()
{
if ( m_ownsImageList )
{
@@ -81,7 +81,7 @@ wxBookCtrl::~wxBookCtrl()
// image list
// ----------------------------------------------------------------------------
void wxBookCtrl::SetImageList(wxImageList *imageList)
void wxBookCtrlBase::SetImageList(wxImageList *imageList)
{
if ( m_ownsImageList )
{
@@ -94,7 +94,7 @@ void wxBookCtrl::SetImageList(wxImageList *imageList)
m_imageList = imageList;
}
void wxBookCtrl::AssignImageList(wxImageList* imageList)
void wxBookCtrlBase::AssignImageList(wxImageList* imageList)
{
SetImageList(imageList);
@@ -105,12 +105,12 @@ void wxBookCtrl::AssignImageList(wxImageList* imageList)
// geometry
// ----------------------------------------------------------------------------
void wxBookCtrl::SetPageSize(const wxSize& size)
void wxBookCtrlBase::SetPageSize(const wxSize& size)
{
SetClientSize(CalcSizeFromPage(size));
}
wxSize wxBookCtrl::DoGetBestSize() const
wxSize wxBookCtrlBase::DoGetBestSize() const
{
wxSize bestSize;
@@ -140,15 +140,15 @@ wxSize wxBookCtrl::DoGetBestSize() const
// ----------------------------------------------------------------------------
bool
wxBookCtrl::InsertPage(size_t nPage,
wxWindow *page,
const wxString& WXUNUSED(text),
bool WXUNUSED(bSelect),
int WXUNUSED(imageId))
wxBookCtrlBase::InsertPage(size_t nPage,
wxWindow *page,
const wxString& WXUNUSED(text),
bool WXUNUSED(bSelect),
int WXUNUSED(imageId))
{
wxCHECK_MSG( page, false, _T("NULL page in wxBookCtrl::InsertPage()") );
wxCHECK_MSG( page, false, _T("NULL page in wxBookCtrlBase::InsertPage()") );
wxCHECK_MSG( nPage <= m_pages.size(), false,
_T("invalid page index in wxBookCtrl::InsertPage()") );
_T("invalid page index in wxBookCtrlBase::InsertPage()") );
m_pages.Insert(page, nPage);
InvalidateBestSize();
@@ -156,7 +156,7 @@ wxBookCtrl::InsertPage(size_t nPage,
return true;
}
bool wxBookCtrl::DeletePage(size_t nPage)
bool wxBookCtrlBase::DeletePage(size_t nPage)
{
wxWindow *page = DoRemovePage(nPage);
if ( !page )
@@ -167,10 +167,10 @@ bool wxBookCtrl::DeletePage(size_t nPage)
return true;
}
wxWindow *wxBookCtrl::DoRemovePage(size_t nPage)
wxWindow *wxBookCtrlBase::DoRemovePage(size_t nPage)
{
wxCHECK_MSG( nPage < m_pages.size(), NULL,
_T("invalid page index in wxBookCtrl::DoRemovePage()") );
_T("invalid page index in wxBookCtrlBase::DoRemovePage()") );
wxWindow *pageRemoved = m_pages[nPage];
m_pages.RemoveAt(nPage);
@@ -179,7 +179,7 @@ wxWindow *wxBookCtrl::DoRemovePage(size_t nPage)
return pageRemoved;
}
int wxBookCtrl::GetNextPage(bool forward) const
int wxBookCtrlBase::GetNextPage(bool forward) const
{
int nPage;

View File

@@ -1655,7 +1655,7 @@ IMPLEMENT_CLASS(wxNotebookSizer, wxBookCtrlSizer)
#if wxUSE_BOOKCTRL
wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrl *bookctrl)
wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase *bookctrl)
: m_bookctrl(bookctrl)
{
wxASSERT_MSG( bookctrl, wxT("wxBookCtrlSizer needs a control") );

View File

@@ -64,7 +64,7 @@ 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)
BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrlBase)
EVT_SIZE(wxChoicebook::OnSize)
EVT_CHOICE(wxID_CHOICEBOOKCHOICE, wxChoicebook::OnChoiceSelected)
END_EVENT_TABLE()
@@ -276,7 +276,7 @@ void wxChoicebook::SetImageList(wxImageList *imageList)
{
// TODO: can be implemented in form of static bitmap near choice control
wxBookCtrl::SetImageList(imageList);
wxBookCtrlBase::SetImageList(imageList);
}
// ----------------------------------------------------------------------------
@@ -334,7 +334,7 @@ wxChoicebook::InsertPage(size_t n,
bool bSelect,
int imageId)
{
if ( !wxBookCtrl::InsertPage(n, page, text, bSelect, imageId) )
if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) )
return false;
m_choice->Insert(text, n);
@@ -369,7 +369,7 @@ wxChoicebook::InsertPage(size_t n,
wxWindow *wxChoicebook::DoRemovePage(size_t page)
{
const int page_count = GetPageCount();
wxWindow *win = wxBookCtrl::DoRemovePage(page);
wxWindow *win = wxBookCtrlBase::DoRemovePage(page);
if ( win )
{
@@ -399,7 +399,7 @@ wxWindow *wxChoicebook::DoRemovePage(size_t page)
bool wxChoicebook::DeleteAllPages()
{
m_choice->Clear();
return wxBookCtrl::DeleteAllPages();
return wxBookCtrlBase::DeleteAllPages();
}
// ----------------------------------------------------------------------------

View File

@@ -62,7 +62,7 @@ const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType();
const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxNewEventType();
const int wxID_LISTBOOKLISTVIEW = wxNewId();
BEGIN_EVENT_TABLE(wxListbook, wxBookCtrl)
BEGIN_EVENT_TABLE(wxListbook, wxBookCtrlBase)
EVT_SIZE(wxListbook::OnSize)
EVT_LIST_ITEM_SELECTED(wxID_LISTBOOKLISTVIEW, wxListbook::OnListSelected)
END_EVENT_TABLE()
@@ -334,7 +334,7 @@ void wxListbook::SetImageList(wxImageList *imageList)
{
m_list->SetImageList(imageList, wxIMAGE_LIST_NORMAL);
wxBookCtrl::SetImageList(imageList);
wxBookCtrlBase::SetImageList(imageList);
}
// ----------------------------------------------------------------------------
@@ -393,7 +393,7 @@ wxListbook::InsertPage(size_t n,
bool bSelect,
int imageId)
{
if ( !wxBookCtrl::InsertPage(n, page, text, bSelect, imageId) )
if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) )
return false;
m_list->InsertItem(n, text, imageId);
@@ -429,7 +429,7 @@ wxListbook::InsertPage(size_t n,
wxWindow *wxListbook::DoRemovePage(size_t page)
{
const int page_count = GetPageCount();
wxWindow *win = wxBookCtrl::DoRemovePage(page);
wxWindow *win = wxBookCtrlBase::DoRemovePage(page);
if ( win )
{
@@ -459,7 +459,7 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
bool wxListbook::DeleteAllPages()
{
m_list->DeleteAllItems();
return wxBookCtrl::DeleteAllPages();
return wxBookCtrlBase::DeleteAllPages();
}
// ----------------------------------------------------------------------------