From be16b85933283014930eb4973ab65706f75c94d8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 Dec 2006 13:43:44 +0000 Subject: [PATCH] fix initial layout of the widgets pages: avoid calling Fit() on them git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/widgets/bmpcombobox.cpp | 2 -- samples/widgets/button.cpp | 2 -- samples/widgets/checkbox.cpp | 2 -- samples/widgets/clrpicker.cpp | 2 +- samples/widgets/combobox.cpp | 2 -- samples/widgets/datepick.cpp | 2 -- samples/widgets/dirctrl.cpp | 2 -- samples/widgets/dirpicker.cpp | 2 +- samples/widgets/filepicker.cpp | 2 +- samples/widgets/fontpicker.cpp | 2 +- samples/widgets/gauge.cpp | 2 -- samples/widgets/hyperlnk.cpp | 2 -- samples/widgets/listbox.cpp | 2 -- samples/widgets/notebook.cpp | 2 -- samples/widgets/odcombobox.cpp | 2 -- samples/widgets/radiobox.cpp | 2 -- samples/widgets/slider.cpp | 2 -- samples/widgets/spinbtn.cpp | 2 -- samples/widgets/static.cpp | 2 -- samples/widgets/textctrl.cpp | 2 -- samples/widgets/toggle.cpp | 2 -- samples/widgets/widgets.cpp | 6 +++++- 22 files changed, 9 insertions(+), 39 deletions(-) diff --git a/samples/widgets/bmpcombobox.cpp b/samples/widgets/bmpcombobox.cpp index ca8ffd6cd4..5cd72b3e28 100644 --- a/samples/widgets/bmpcombobox.cpp +++ b/samples/widgets/bmpcombobox.cpp @@ -370,8 +370,6 @@ void BitmapComboBoxWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index c06a28bf69..914fa1a08b 100644 --- a/samples/widgets/button.cpp +++ b/samples/widgets/button.cpp @@ -275,8 +275,6 @@ void ButtonWidgetsPage::CreateContent() CreateButton(); SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/checkbox.cpp b/samples/widgets/checkbox.cpp index 65a5c1ea4e..6ecbfd872a 100644 --- a/samples/widgets/checkbox.cpp +++ b/samples/widgets/checkbox.cpp @@ -233,8 +233,6 @@ void CheckBoxWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } void CheckBoxWidgetsPage::Reset() diff --git a/samples/widgets/clrpicker.cpp b/samples/widgets/clrpicker.cpp index 45b297b238..346a5ce263 100644 --- a/samples/widgets/clrpicker.cpp +++ b/samples/widgets/clrpicker.cpp @@ -168,7 +168,7 @@ void ColourPickerWidgetsPage::CreateContent() sz->Add(boxleft, 0, wxGROW|wxALL, 5); sz->Add(m_sizer, 1, wxGROW|wxALL, 5); - SetSizerAndFit(sz); + SetSizer(sz); } void ColourPickerWidgetsPage::CreatePicker() diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp index 5485a1b09f..933864004c 100644 --- a/samples/widgets/combobox.cpp +++ b/samples/widgets/combobox.cpp @@ -335,8 +335,6 @@ void ComboboxWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/datepick.cpp b/samples/widgets/datepick.cpp index f72112cf8b..04ebb2e20e 100644 --- a/samples/widgets/datepick.cpp +++ b/samples/widgets/datepick.cpp @@ -178,8 +178,6 @@ void DatePickerWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } void DatePickerWidgetsPage::Reset() diff --git a/samples/widgets/dirctrl.cpp b/samples/widgets/dirctrl.cpp index 19e2a3531b..472416f3ed 100644 --- a/samples/widgets/dirctrl.cpp +++ b/samples/widgets/dirctrl.cpp @@ -216,8 +216,6 @@ void DirCtrlWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } void DirCtrlWidgetsPage::Reset() diff --git a/samples/widgets/dirpicker.cpp b/samples/widgets/dirpicker.cpp index 949be6c803..d9b97c967b 100644 --- a/samples/widgets/dirpicker.cpp +++ b/samples/widgets/dirpicker.cpp @@ -170,7 +170,7 @@ void DirPickerWidgetsPage::CreateContent() sz->Add(boxleft, 0, wxGROW|wxALL, 5); sz->Add(m_sizer, 1, wxGROW|wxALL, 5); - SetSizerAndFit(sz); + SetSizer(sz); } void DirPickerWidgetsPage::CreatePicker() diff --git a/samples/widgets/filepicker.cpp b/samples/widgets/filepicker.cpp index e9629fb02e..1246f2a5c5 100644 --- a/samples/widgets/filepicker.cpp +++ b/samples/widgets/filepicker.cpp @@ -191,7 +191,7 @@ void FilePickerWidgetsPage::CreateContent() sz->Add(boxleft, 0, wxGROW|wxALL, 5); sz->Add(m_sizer, 1, wxGROW|wxALL, 5); - SetSizerAndFit(sz); + SetSizer(sz); } void FilePickerWidgetsPage::CreatePicker() diff --git a/samples/widgets/fontpicker.cpp b/samples/widgets/fontpicker.cpp index 3ea6f75e5e..d26fac62dc 100644 --- a/samples/widgets/fontpicker.cpp +++ b/samples/widgets/fontpicker.cpp @@ -170,7 +170,7 @@ void FontPickerWidgetsPage::CreateContent() sz->Add(boxleft, 0, wxGROW|wxALL, 5); sz->Add(m_sizer, 1, wxGROW|wxALL, 5); - SetSizerAndFit(sz); + SetSizer(sz); } void FontPickerWidgetsPage::CreatePicker() diff --git a/samples/widgets/gauge.cpp b/samples/widgets/gauge.cpp index 3584330e82..8ff34d47d2 100644 --- a/samples/widgets/gauge.cpp +++ b/samples/widgets/gauge.cpp @@ -261,8 +261,6 @@ void GaugeWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } GaugeWidgetsPage::~GaugeWidgetsPage() diff --git a/samples/widgets/hyperlnk.cpp b/samples/widgets/hyperlnk.cpp index f1331d10c9..f93cc97acd 100644 --- a/samples/widgets/hyperlnk.cpp +++ b/samples/widgets/hyperlnk.cpp @@ -223,8 +223,6 @@ void HyperlinkWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } void HyperlinkWidgetsPage::Reset() diff --git a/samples/widgets/listbox.cpp b/samples/widgets/listbox.cpp index b189d3b22b..a766ef441f 100644 --- a/samples/widgets/listbox.cpp +++ b/samples/widgets/listbox.cpp @@ -334,8 +334,6 @@ void ListboxWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/notebook.cpp b/samples/widgets/notebook.cpp index 74ef9c3e69..116ee5d91b 100644 --- a/samples/widgets/notebook.cpp +++ b/samples/widgets/notebook.cpp @@ -295,8 +295,6 @@ void BookWidgetsPage::CreateContent() #endif // USE_ICONS_IN_BOOK SetSizer(sizerTop); - - sizerTop->Fit(this); } BookWidgetsPage::~BookWidgetsPage() diff --git a/samples/widgets/odcombobox.cpp b/samples/widgets/odcombobox.cpp index ee531cfa94..a20d439a43 100644 --- a/samples/widgets/odcombobox.cpp +++ b/samples/widgets/odcombobox.cpp @@ -464,8 +464,6 @@ void ODComboboxWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/radiobox.cpp b/samples/widgets/radiobox.cpp index a4e73f24cc..d0729c6f10 100644 --- a/samples/widgets/radiobox.cpp +++ b/samples/widgets/radiobox.cpp @@ -302,8 +302,6 @@ void RadioWidgetsPage::CreateContent() // final initializations SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/slider.cpp b/samples/widgets/slider.cpp index 214be60ae1..cf2af01598 100644 --- a/samples/widgets/slider.cpp +++ b/samples/widgets/slider.cpp @@ -360,8 +360,6 @@ void SliderWidgetsPage::CreateContent() // final initializations SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index f7e793ac8c..63f8e9c353 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -266,8 +266,6 @@ void SpinBtnWidgetsPage::CreateContent() // final initializations SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp index fe33e6667c..c40d3bccc0 100644 --- a/samples/widgets/static.cpp +++ b/samples/widgets/static.cpp @@ -307,8 +307,6 @@ void StaticWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/textctrl.cpp b/samples/widgets/textctrl.cpp index c1e6afb816..e3f6c7845e 100644 --- a/samples/widgets/textctrl.cpp +++ b/samples/widgets/textctrl.cpp @@ -559,8 +559,6 @@ void TextWidgetsPage::CreateContent() sizerTop->Add(m_sizerText, 1, wxGROW | (wxALL & ~wxRIGHT), 10); SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- diff --git a/samples/widgets/toggle.cpp b/samples/widgets/toggle.cpp index 6c4734d7ab..a44b1ff900 100644 --- a/samples/widgets/toggle.cpp +++ b/samples/widgets/toggle.cpp @@ -163,8 +163,6 @@ void ToggleWidgetsPage::CreateContent() Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } void ToggleWidgetsPage::Reset() diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index 510cdbc658..fde4f53272 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -653,12 +653,16 @@ void WidgetsFrame::OnPageChanged(WidgetsBookCtrlEvent& event) GetMenuBar()->Check(Widgets_BusyCursor, false); - // lazy creation of the pages + // create the pages on demand, otherwise the sample startup is too slow as + // it creates hundreds of controls WidgetsPage *page = CurrentPage(); if ( page->GetChildren().empty() ) { wxWindowUpdateLocker noUpdates(page); page->CreateContent(); + //page->Layout(); + page->GetSizer()->Fit(page); + WidgetsBookCtrl *book = wxStaticCast(page->GetParent(), WidgetsBookCtrl); wxSize size; for ( size_t i = 0; i < book->GetPageCount(); ++i ) -- 2.45.2