]> git.saurik.com Git - wxWidgets.git/commitdiff
Add maximum width for sample's frame
authorJaakko Salli <jaakko.salli@dnainternet.net>
Thu, 16 Oct 2008 17:31:46 +0000 (17:31 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Thu, 16 Oct 2008 17:31:46 +0000 (17:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56365 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/propgrid/propgrid.cpp
samples/propgrid/propgrid.h

index 6a045c3ac1a0e3e0f9c48c77fe2b5d1b5865b4cc..6387831ea1669ff98dc461f8a8f5cef6a1a9b866 100644 (file)
@@ -1949,13 +1949,7 @@ void FormMain::FinalizePanel( bool wasCreated )
     panelSizer->SetSizeHints( this );
 
     if ( wasCreated )
     panelSizer->SetSizeHints( this );
 
     if ( wasCreated )
-    {
-        SetSize(
-            (wxSystemSettings::GetMetric(wxSYS_SCREEN_X)/10)*4,
-            (wxSystemSettings::GetMetric(wxSYS_SCREEN_Y)/10)*8
-            );
-        Centre();
-    }
+        FinalizeFramePosition();
 }
 
 void FormMain::PopulateGrid()
 }
 
 void FormMain::PopulateGrid()
@@ -2209,15 +2203,19 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
     SetStatusText(wxEmptyString);
 #endif // wxUSE_STATUSBAR
 
     SetStatusText(wxEmptyString);
 #endif // wxUSE_STATUSBAR
 
+    FinalizeFramePosition();
+}
 
 
-    //
-    // Finalize
-    //
+void FormMain::FinalizeFramePosition()
+{
+    wxSize frameSize((wxSystemSettings::GetMetric(wxSYS_SCREEN_X)/10)*4,
+                     (wxSystemSettings::GetMetric(wxSYS_SCREEN_Y)/10)*8);
+
+    if ( frameSize.x > 500 )
+        frameSize.x = 500;
+
+    SetSize(frameSize);
 
 
-    SetSize(
-        (wxSystemSettings::GetMetric(wxSYS_SCREEN_X)/10)*4,
-        (wxSystemSettings::GetMetric(wxSYS_SCREEN_Y)/10)*8
-        );
     Centre();
 }
 
     Centre();
 }
 
@@ -2867,11 +2865,7 @@ void FormMain::OnSelectStyle( wxCommandEvent& WXUNUSED(event) )
 
     CreateGrid( style, extraStyle );
 
 
     CreateGrid( style, extraStyle );
 
-    SetSize(
-        (wxSystemSettings::GetMetric(wxSYS_SCREEN_X)/10)*4,
-        (wxSystemSettings::GetMetric(wxSYS_SCREEN_Y)/10)*8
-        );
-    Centre();
+    FinalizeFramePosition();
 }
 
 // -----------------------------------------------------------------------
 }
 
 // -----------------------------------------------------------------------
index bec86c7991eee529ef367cfd29b71d8163648fe4..a5e3b8910b3dc70fd4d2fa0f3971ad5dd796b143 100644 (file)
@@ -150,6 +150,7 @@ public:
 
 
     void CreateGrid( int style, int extraStyle );
 
 
     void CreateGrid( int style, int extraStyle );
+    void FinalizeFramePosition();
 
     // These are used in CreateGrid(), and in tests to compose
     // grids for testing purposes.
 
     // These are used in CreateGrid(), and in tests to compose
     // grids for testing purposes.