From f43255e83836c1a023ea7f9c1fe1b3439e58c516 Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Sun, 30 Apr 2006 00:20:54 +0000 Subject: [PATCH] No more avoiding wxSizer::Fit in wxWinCE builds. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/wxmsw.tex | 8 ++------ src/common/sizer.cpp | 9 +++++++++ src/generic/choicdgg.cpp | 7 ------- src/generic/dirdlgg.cpp | 2 -- src/generic/fdrepdlg.cpp | 12 +++--------- src/generic/filedlgg.cpp | 5 +---- src/generic/fontdlgg.cpp | 2 -- src/generic/numdlgg.cpp | 2 -- src/generic/textdlgg.cpp | 2 -- src/generic/tipdlg.cpp | 10 ++-------- src/msw/toplevel.cpp | 4 ++++ 11 files changed, 21 insertions(+), 42 deletions(-) diff --git a/docs/latex/wx/wxmsw.tex b/docs/latex/wx/wxmsw.tex index 03726eedf2..2deb5254de 100644 --- a/docs/latex/wx/wxmsw.tex +++ b/docs/latex/wx/wxmsw.tex @@ -108,12 +108,8 @@ wxGetOsVersion will return these values: \subsubsection{Window sizing in wxWinCE} -When creating frames and dialogs, create them with wxDefaultPosition and -wxDefaultSize, which will tell WinCE to create them full-screen. - -Don't call Fit() and Centre(), so the content sizes to -the window rather than fitting the window to the content. (We really need a single API call -that will do the right thing on each platform.) +Top level windows (dialogs, frames) are created always full-screen. Fit() of sizers will not rescale top +level windows but instead will scale window content. If the screen orientation changes, the windows will automatically be resized so no further action needs to be taken (unless you want to change the layout diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index d52151ef33..b594635146 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -732,6 +732,15 @@ wxSize wxSizer::GetMinWindowSize( wxWindow *window ) // Return a window size that will fit within the screens dimensions wxSize wxSizer::FitSize( wxWindow *window ) { + if ( window->IsTopLevel() ) + { + wxTopLevelWindow *tlw = wxDynamicCast(window, wxTopLevelWindow); + if ( tlw && tlw->IsAlwaysMaximized() ) + { + return tlw->GetClientSize(); + } + } + wxSize size = GetMinWindowSize( window ); wxSize sizeMax = GetMaxWindowSize( window ); diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 2a77c9692e..5a8d6f2135 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -255,11 +255,6 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, const wxPoint& pos, long styleLbox) { -#if defined(__SMARTPHONE__) || defined(__POCKETPC__) - styleDlg &= ~wxBORDER_MASK; - styleDlg &= ~wxRESIZE_BORDER; - styleDlg &= ~wxCAPTION; -#endif #ifdef __WXMAC__ if ( !wxDialog::Create(parent, wxID_ANY, caption, pos, wxDefaultSize, styleDlg & (~wxCANCEL) ) ) return false; @@ -299,13 +294,11 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, SetSizer( topsizer ); -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) topsizer->SetSizeHints( this ); topsizer->Fit( this ); if ( styleDlg & wxCENTRE ) Centre(wxBOTH); -#endif m_listbox->SetFocus(); diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index 9419cbc73f..5c5ca45087 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -193,12 +193,10 @@ wxGenericDirDialog::wxGenericDirDialog(wxWindow* parent, const wxString& title, SetAutoLayout( true ); SetSizer( topsizer ); -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) topsizer->SetSizeHints( this ); topsizer->Fit( this ); Centre( wxBOTH ); -#endif } void wxGenericDirDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) diff --git a/src/generic/fdrepdlg.cpp b/src/generic/fdrepdlg.cpp index d4918e3c0c..b65f21ffc4 100644 --- a/src/generic/fdrepdlg.cpp +++ b/src/generic/fdrepdlg.cpp @@ -89,10 +89,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent, { if ( !wxDialog::Create(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, - wxDEFAULT_DIALOG_STYLE -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) - | wxRESIZE_BORDER -#endif + wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | style) ) { return false; @@ -104,7 +101,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent, _T("can't create dialog without data") ); bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA); - + wxBoxSizer *leftsizer = new wxBoxSizer( wxVERTICAL ); // 3 columns because there is a spacer in the middle @@ -158,7 +155,7 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent, rbStyle = wxRA_SPECIFY_ROWS; else rbStyle = wxRA_SPECIFY_COLS; - + m_radioDir = new wxRadioBox(this, wxID_ANY, _("Search direction"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(searchDirections), searchDirections, @@ -212,12 +209,10 @@ bool wxGenericFindReplaceDialog::Create(wxWindow *parent, SetAutoLayout( true ); SetSizer( topsizer ); -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) topsizer->SetSizeHints( this ); topsizer->Fit( this ); Centre( wxBOTH ); -#endif m_textFind->SetFocus(); @@ -294,4 +289,3 @@ void wxGenericFindReplaceDialog::OnCloseWindow(wxCloseEvent &) } #endif // wxUSE_FINDREPLDLG - diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 05c6a9ee31..fe706a2820 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -1002,10 +1002,7 @@ bool wxGenericFileDialog::Create( wxWindow *parent, return true; if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize, - wxDEFAULT_DIALOG_STYLE -#if !(defined(__PDA__) || defined(__SMARTPHONE__)) - | wxRESIZE_BORDER -#endif + wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )) { return false; diff --git a/src/generic/fontdlgg.cpp b/src/generic/fontdlgg.cpp index ee82641890..425df81542 100644 --- a/src/generic/fontdlgg.cpp +++ b/src/generic/fontdlgg.cpp @@ -430,13 +430,11 @@ void wxGenericFontDialog::CreateWidgets() m_pointSizeChoice->SetSelection(m_dialogFont.GetPointSize()-1); #endif -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) GetSizer()->SetItemMinSize(m_previewer, is_pda ? 100 : 430, is_pda ? 40 : 100); GetSizer()->SetSizeHints(this); GetSizer()->Fit(this); Centre(wxBOTH); -#endif delete[] families; delete[] styles; diff --git a/src/generic/numdlgg.cpp b/src/generic/numdlgg.cpp index a719e7f16a..70e9675de5 100644 --- a/src/generic/numdlgg.cpp +++ b/src/generic/numdlgg.cpp @@ -141,12 +141,10 @@ wxNumberEntryDialog::wxNumberEntryDialog(wxWindow *parent, SetSizer( topsizer ); SetAutoLayout( true ); -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) topsizer->SetSizeHints( this ); topsizer->Fit( this ); Centre( wxBOTH ); -#endif m_spinctrl->SetSelection(-1, -1); m_spinctrl->SetFocus(); diff --git a/src/generic/textdlgg.cpp b/src/generic/textdlgg.cpp index 5abada8309..2a9f132a23 100644 --- a/src/generic/textdlgg.cpp +++ b/src/generic/textdlgg.cpp @@ -124,13 +124,11 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, SetAutoLayout( true ); SetSizer( topsizer ); -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) topsizer->SetSizeHints( this ); topsizer->Fit( this ); if ( style & wxCENTRE ) Centre( wxBOTH ); -#endif m_textctrl->SetSelection(-1, -1); m_textctrl->SetFocus(); diff --git a/src/generic/tipdlg.cpp b/src/generic/tipdlg.cpp index f8b008b5f4..213e7185dc 100644 --- a/src/generic/tipdlg.cpp +++ b/src/generic/tipdlg.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: tipdlg.cpp +// Name: src/generic/tipdlg.cpp // Purpose: implementation of wxTipDialog // Author: Vadim Zeitlin // Modified by: @@ -218,10 +218,7 @@ wxTipDialog::wxTipDialog(wxWindow *parent, bool showAtStartup) : wxDialog(parent, wxID_ANY, _("Tip of the Day"), wxDefaultPosition, wxDefaultSize, - wxDEFAULT_DIALOG_STYLE -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) - | wxRESIZE_BORDER -#endif + wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ) { m_tipProvider = tipProvider; @@ -319,12 +316,10 @@ wxTipDialog::wxTipDialog(wxWindow *parent, SetSizer( topsizer ); -#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__) topsizer->SetSizeHints( this ); topsizer->Fit( this ); Centre(wxBOTH | wxCENTER_FRAME); -#endif } // ---------------------------------------------------------------------------- @@ -348,4 +343,3 @@ bool wxShowTip(wxWindow *parent, } #endif // wxUSE_STARTUP_TIPS - diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 914f6fe15d..40a506ca96 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -593,10 +593,14 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent, MSWUpdateUIState(UIS_INITIALIZE); } + // Note: if we include PocketPC in this test, dialogs can fail to show up, + // for example the text entry dialog in the dialogs sample. Problem with Maximise()? +#if defined(__WXWINCE__) && (defined(__SMARTPHONE__) || defined(__WINCE_STANDARDSDK__)) if ( ( style & wxMAXIMIZE ) || IsAlwaysMaximized() ) { this->Maximize(); } +#endif #if defined(__SMARTPHONE__) && defined(__WXWINCE__) SetRightMenu(); // to nothing for initialization -- 2.47.2