No more avoiding wxSizer::Fit in wxWinCE builds.
authorWłodzimierz Skiba <abx@abx.art.pl>
Sun, 30 Apr 2006 00:20:54 +0000 (00:20 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Sun, 30 Apr 2006 00:20:54 +0000 (00:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38954 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/wxmsw.tex
src/common/sizer.cpp
src/generic/choicdgg.cpp
src/generic/dirdlgg.cpp
src/generic/fdrepdlg.cpp
src/generic/filedlgg.cpp
src/generic/fontdlgg.cpp
src/generic/numdlgg.cpp
src/generic/textdlgg.cpp
src/generic/tipdlg.cpp
src/msw/toplevel.cpp

index 03726eedf282ade886dd777d985473a5e62e2353..2deb5254de6c0273b5c99fd8d53cf828478a1fba 100644 (file)
@@ -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
index d52151ef33c4d03f4449f48ed480ff52c857b83f..b59463514639771a5578fbe1906a7ea69316c1ff 100644 (file)
@@ -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 );
 
index 2a77c9692e4e83445175f5bc6e6ae7ad12dca334..5a8d6f2135ee7406ce26a8556ecb1f4c24c7149e 100644 (file)
@@ -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();
 
index 9419cbc73fbc290471edb9505f4627c614c3d1cf..5c5ca450872d4585b1ff634fe658135bee3f998f 100644 (file)
@@ -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))
index d4918e3c0c969543f6691f9f26e1b21720275a35..b65f21ffc4ab55e087ddd6655af5724f16f45dd0 100644 (file)
@@ -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
-
index 05c6a9ee31f9f8d4374e63d5aa438325332c6758..fe706a28208145aef7903abef0c589e7c65f81ea 100644 (file)
@@ -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;
index ee8264189043dbec585de7f3b421b3ec263a5b0d..425df815424f36514bbab2b542719a5bd9722ccc 100644 (file)
@@ -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;
index a719e7f16a238fa6c5ebf9f14dfbb4842bf58f71..70e9675de56c1c21240f4295f381fac208398d07 100644 (file)
@@ -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();
index 5abada8309e3f4776aea76a34f7372364a1ffdd8..2a9f132a23f155ca7cb6e44a3453010a606d4bf9 100644 (file)
@@ -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();
index f8b008b5f48f1ab18bc7883a445efdf05d9a99d8..213e7185dc69ea8e80d37d0e782f0b54a03d33b3 100644 (file)
@@ -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
-
index 914f6fe15d2d0ebc970b4151f4ac5fe9343b07da..40a506ca96e9201856471a162c542460fdb8d8fc 100644 (file)
@@ -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