]> git.saurik.com Git - wxWidgets.git/commitdiff
applied patch #428104 (SetSizeHints() for wxMDIChildFrame)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 16 Jun 2001 01:36:35 +0000 (01:36 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 16 Jun 2001 01:36:35 +0000 (01:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10598 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/mdi.h
samples/mdi/mdi.cpp
src/msw/mdi.cpp

index 891aaff8c54a152b3977bce5816d640e686ebf22..afc3847ecbddb1e68a4786b64e4d7a038803efc0 100644 (file)
@@ -159,6 +159,7 @@ public:
     bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
     bool HandleWindowPosChanging(void *lpPos);
     bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
+    bool HandleGetMinMaxInfo(void *mmInfo);
 
     virtual long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
     virtual long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
index 6e84cdb231e7ebfdd15dc0f6684ced229a0ff0f0..f3077f4ade76753d6385dc99b3d168b4a15145f0 100644 (file)
@@ -163,7 +163,8 @@ MyFrame::MyFrame(wxWindow *parent,
                  const wxPoint& pos,
                  const wxSize& size,
                  const long style)
-       : wxMDIParentFrame(parent, id, title, pos, size, style)
+       : wxMDIParentFrame(parent, id, title, pos, size,
+                          style | wxNO_FULL_REPAINT_ON_RESIZE)
 {
     textWindow = new wxTextCtrl(this, -1, "A help window",
                                 wxDefaultPosition, wxDefaultSize,
@@ -345,7 +346,9 @@ void MyFrame::InitToolBar(wxToolBar* toolBar)
 // Define a constructor for my canvas
 MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size)
         : wxScrolledWindow(parent, -1, pos, size,
-                           wxSUNKEN_BORDER|wxVSCROLL|wxHSCROLL)
+                           wxSUNKEN_BORDER |
+                           wxNO_FULL_REPAINT_ON_RESIZE |
+                           wxVSCROLL | wxHSCROLL)
 {
     SetBackgroundColour(wxColour("WHITE"));
 
@@ -408,10 +411,14 @@ void MyCanvas::OnEvent(wxMouseEvent& event)
 MyChild::MyChild(wxMDIParentFrame *parent, const wxString& title,
                  const wxPoint& pos, const wxSize& size,
                  const long style)
-       : wxMDIChildFrame(parent, -1, title, pos, size, style)
+       : wxMDIChildFrame(parent, -1, title, pos, size,
+                         style | wxNO_FULL_REPAINT_ON_RESIZE)
 {
     canvas = (MyCanvas *) NULL;
     my_children.Append(this);
+
+    // this should work for MDI frames as well as for normal ones
+    SetSizeHints(100, 100);
 }
 
 MyChild::~MyChild()
index e2d239595af5897a4f8963d1a3c2650af241f19c..a8c09a69523d81f53f400df6e96f00952c84a61b 100644 (file)
@@ -873,10 +873,8 @@ long wxMDIChildFrame::MSWWindowProc(WXUINT message,
             break;
 
         case WM_GETMINMAXINFO:
-            // let the default window proc calculate the size of MDI children
-            // frames because it is based on the size of the MDI client window,
-            // not on the values specified in wxWindow m_min/max variables
-            return MSWDefWindowProc(message, wParam, lParam);
+            processed = HandleGetMinMaxInfo((MINMAXINFO *)lParam);
+            break;
 
         case WM_MDIACTIVATE:
             {
@@ -1040,6 +1038,33 @@ bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
     return FALSE;
 }
 
+bool wxMDIChildFrame::HandleGetMinMaxInfo(void *mmInfo)
+{
+    MINMAXINFO *info = (MINMAXINFO *)mmInfo;
+
+    // let the default window proc calculate the size of MDI children
+    // frames because it is based on the size of the MDI client window,
+    // not on the values specified in wxWindow m_max variables
+    bool processed = MSWDefWindowProc(WM_GETMINMAXINFO, 0, (LPARAM)mmInfo);
+
+    // but allow GetSizeHints() to set the min size
+    if ( m_minWidth != -1 )
+    {
+        info->ptMinTrackSize.x = m_minWidth;
+
+        processed = TRUE;
+    }
+
+    if ( m_minHeight != -1 )
+    {
+        info->ptMinTrackSize.y = m_minHeight;
+
+        processed = TRUE;
+    }
+
+    return TRUE;
+}
+
 // ---------------------------------------------------------------------------
 // MDI specific message translation/preprocessing
 // ---------------------------------------------------------------------------