X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4e62c3fd3bd36ec5c46939c1e2150cc46ca13506..1c0f361be288df133c766e04cc857b3e4682b31a:/samples/notebook/notebook.cpp diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index ab4506cbd7..1328a8fe7b 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -33,7 +33,7 @@ bool MyApp::OnInit() // Problem with generic wxNotebook implementation whereby it doesn't size // properly unless you set the size again -#if defined(__WIN16__) || defined(__WXMOTIF__) +#if defined(__WXMOTIF__) int width, height; frame->GetSize(& width, & height); frame->SetSize(-1, -1, width, height); @@ -161,11 +161,9 @@ wxPanel *MyNotebook::CreateInsertPage() void MyNotebook::CreateInitialPages() { - wxPanel *panel = (wxPanel *) NULL; - // Create and add some panels to the notebook - panel = CreateRadioButtonsPage(); + wxPanel *panel = CreateRadioButtonsPage(); AddPage( panel, RADIOBUTTONS_PAGE_NAME, FALSE, GetIconIndex() ); panel = CreateVetoPage(); @@ -246,16 +244,20 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, wxT("Forgot to update something") ); m_radioOrient = new wxRadioBox - ( - m_panel, ID_RADIO_ORIENT, - wxT("&Tab orientation"), - wxDefaultPosition, wxDefaultSize, - WXSIZEOF(strOrientations), strOrientations, - 1, wxRA_SPECIFY_COLS - ); + ( + m_panel, ID_RADIO_ORIENT, + wxT("&Tab orientation"), + wxDefaultPosition, wxDefaultSize, + WXSIZEOF(strOrientations), strOrientations, + 1, wxRA_SPECIFY_COLS + ); m_chkShowImages = new wxCheckBox( m_panel, ID_CHK_SHOWIMAGES, wxT("&Show images") ); +#ifndef TEST_LISTBOOK + m_chkMultiLine = new wxCheckBox( m_panel, ID_CHK_MULTILINE, + wxT("&Multiple lines") ); +#endif // !TEST_LISTBOOK m_btnAddPage = new wxButton( m_panel, ID_BTN_ADD_PAGE, wxT("&Add page") ); @@ -285,22 +287,23 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, m_sizerTop = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *sizerLeft = new wxBoxSizer(wxVERTICAL); - { - sizerLeft->Add(m_radioOrient, 0, wxEXPAND); - sizerLeft->Add(m_chkShowImages, 0, wxEXPAND | wxTOP, 4); + sizerLeft->Add(m_radioOrient, 0, wxEXPAND); + sizerLeft->Add(m_chkShowImages, 0, wxEXPAND | wxTOP, 4); +#ifndef TEST_LISTBOOK + sizerLeft->Add(m_chkMultiLine, 0, wxEXPAND | wxTOP, 4); +#endif // !TEST_LISTBOOK - sizerLeft->Add(0, 0, 1); // Spacer + sizerLeft->Add(0, 0, 1); // Spacer - sizerLeft->Add(m_btnAddPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); - sizerLeft->Add(m_btnInsertPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); - sizerLeft->Add(m_btnDeleteCurPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); - sizerLeft->Add(m_btnDeleteLastPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); - sizerLeft->Add(m_btnNextPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); + sizerLeft->Add(m_btnAddPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); + sizerLeft->Add(m_btnInsertPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); + sizerLeft->Add(m_btnDeleteCurPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); + sizerLeft->Add(m_btnDeleteLastPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); + sizerLeft->Add(m_btnNextPage, 0, wxEXPAND | (wxTOP | wxBOTTOM), 4); - sizerLeft->Add(0, 0, 1); // Spacer + sizerLeft->Add(0, 0, 1); // Spacer - sizerLeft->Add(m_btnExit, 0, wxEXPAND); - } + sizerLeft->Add(m_btnExit, 0, wxEXPAND); m_sizerTop->Add(sizerLeft, 0, wxEXPAND | wxALL, 4); @@ -360,11 +363,16 @@ void MyFrame::ReInitNotebook() break; } +#ifndef TEST_LISTBOOK + if ( m_chkMultiLine->IsChecked() ) + flags |= wxNB_MULTILINE; +#endif // !TEST_LISTBOOK + MyNotebook *notebook = m_notebook; m_notebook = new MyNotebook(m_panel, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, - flags|wxCLIP_CHILDREN|wxNO_FULL_REPAINT_ON_RESIZE); + flags); if ( m_chkShowImages->IsChecked() ) { @@ -408,6 +416,9 @@ void MyFrame::ReInitNotebook() BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_RADIOBOX(ID_RADIO_ORIENT, MyFrame::OnCheckOrRadioBox) EVT_CHECKBOX(ID_CHK_SHOWIMAGES, MyFrame::OnCheckOrRadioBox) +#ifndef TEST_LISTBOOK + EVT_CHECKBOX(ID_CHK_MULTILINE, MyFrame::OnCheckOrRadioBox) +#endif // !TEST_LISTBOOK EVT_BUTTON(ID_BTN_ADD_PAGE, MyFrame::OnButtonAddPage) EVT_BUTTON(ID_BTN_INSERT_PAGE, MyFrame::OnButtonInsertPage) @@ -427,7 +438,7 @@ END_EVENT_TABLE() void MyFrame::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) { - ReInitNotebook(); + ReInitNotebook(); } void MyFrame::OnButtonAddPage( wxCommandEvent& WXUNUSED(event) )