Create a full page text, rather than a button, in notebook sample
This is much more realistic and looks less weirdly. Also add the text directly as a page, without wrapping it in a panel, just to show that this is possible and works too. No real changes.
This commit is contained in:
@@ -122,21 +122,17 @@ wxPanel *CreateVetoPage(wxBookCtrlBase *parent)
|
|||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPanel *CreateBigButtonPage(wxBookCtrlBase *parent)
|
wxWindow *CreateFullPageText(wxBookCtrlBase *parent)
|
||||||
{
|
{
|
||||||
wxPanel *panel = new wxPanel(parent);
|
wxTextCtrl *text = new wxTextCtrl(parent, wxID_ANY, "Full page text",
|
||||||
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxTE_MULTILINE);
|
||||||
|
|
||||||
#if wxUSE_HELP
|
#if wxUSE_HELP
|
||||||
panel->SetHelpText("Panel with a maximized button");
|
text->SetHelpText("Page consisting of just a text control");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxButton *buttonBig = new wxButton(panel, wxID_ANY, "Maximized button");
|
return text;
|
||||||
|
|
||||||
wxBoxSizer *sizerPanel = new wxBoxSizer(wxVERTICAL);
|
|
||||||
sizerPanel->Add(buttonBig, 1, wxEXPAND);
|
|
||||||
panel->SetSizer(sizerPanel);
|
|
||||||
|
|
||||||
return panel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPanel *CreateInsertPage(wxBookCtrlBase *parent)
|
wxPanel *CreateInsertPage(wxBookCtrlBase *parent)
|
||||||
@@ -173,22 +169,22 @@ void CreateInitialPages(wxBookCtrlBase *parent)
|
|||||||
{
|
{
|
||||||
// Create and add some panels to the notebook
|
// Create and add some panels to the notebook
|
||||||
|
|
||||||
wxPanel *panel = CreateRadioButtonsPage(parent);
|
wxWindow *page = CreateRadioButtonsPage(parent);
|
||||||
parent->AddPage( panel, RADIOBUTTONS_PAGE_NAME, false, GetIconIndex(parent) );
|
parent->AddPage( page, RADIOBUTTONS_PAGE_NAME, false, GetIconIndex(parent) );
|
||||||
|
|
||||||
panel = CreateVetoPage(parent);
|
page = CreateVetoPage(parent);
|
||||||
parent->AddPage( panel, VETO_PAGE_NAME, false, GetIconIndex(parent) );
|
parent->AddPage( page, VETO_PAGE_NAME, false, GetIconIndex(parent) );
|
||||||
|
|
||||||
panel = CreateBigButtonPage(parent);
|
page = CreateFullPageText(parent);
|
||||||
parent->AddPage( panel, MAXIMIZED_BUTTON_PAGE_NAME, false, GetIconIndex(parent) );
|
parent->AddPage( page, TEXT_PAGE_NAME, false, GetIconIndex(parent) );
|
||||||
|
|
||||||
panel = CreateInsertPage(parent);
|
page = CreateInsertPage(parent);
|
||||||
parent->InsertPage( 0, panel, I_WAS_INSERTED_PAGE_NAME, false, GetIconIndex(parent) );
|
parent->InsertPage( 0, page, I_WAS_INSERTED_PAGE_NAME, false, GetIconIndex(parent) );
|
||||||
|
|
||||||
parent->SetSelection(1);
|
parent->SetSelection(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName)
|
wxWindow *CreatePage(wxBookCtrlBase *parent, const wxString&pageName)
|
||||||
{
|
{
|
||||||
if ( pageName.Contains(INSERTED_PAGE_NAME) ||
|
if ( pageName.Contains(INSERTED_PAGE_NAME) ||
|
||||||
pageName.Contains(ADDED_PAGE_NAME) ||
|
pageName.Contains(ADDED_PAGE_NAME) ||
|
||||||
@@ -205,8 +201,8 @@ wxPanel *CreatePage(wxBookCtrlBase *parent, const wxString&pageName)
|
|||||||
if ( pageName == RADIOBUTTONS_PAGE_NAME )
|
if ( pageName == RADIOBUTTONS_PAGE_NAME )
|
||||||
return CreateRadioButtonsPage(parent);
|
return CreateRadioButtonsPage(parent);
|
||||||
|
|
||||||
if ( pageName == MAXIMIZED_BUTTON_PAGE_NAME )
|
if ( pageName == TEXT_PAGE_NAME )
|
||||||
return CreateBigButtonPage(parent);
|
return CreateFullPageText(parent);
|
||||||
|
|
||||||
wxFAIL_MSG( "unknown page name" );
|
wxFAIL_MSG( "unknown page name" );
|
||||||
|
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ enum ID_COMMANDS
|
|||||||
#define I_WAS_INSERTED_PAGE_NAME "Inserted"
|
#define I_WAS_INSERTED_PAGE_NAME "Inserted"
|
||||||
#define RADIOBUTTONS_PAGE_NAME "Radiobuttons"
|
#define RADIOBUTTONS_PAGE_NAME "Radiobuttons"
|
||||||
#define VETO_PAGE_NAME "Veto"
|
#define VETO_PAGE_NAME "Veto"
|
||||||
#define MAXIMIZED_BUTTON_PAGE_NAME "Maximized button"
|
#define TEXT_PAGE_NAME "Text"
|
||||||
|
|
||||||
// Pages that can be added by the user
|
// Pages that can be added by the user
|
||||||
#define INSERTED_PAGE_NAME "Inserted "
|
#define INSERTED_PAGE_NAME "Inserted "
|
||||||
|
|||||||
Reference in New Issue
Block a user