]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
initialize backing store bitmap in Create(), notebook doesn't always get a size event...
[wxWidgets.git] / src / msw / mdi.cpp
index 3d2ac43e30e6ace14f964ac0fe3bd28f2854d64c..0dce669ebfd1d8f5471cdfe029cdcb8d4b9b5abf 100644 (file)
@@ -76,7 +76,6 @@ static HWND invalidHandle = 0;
 // constants
 // ---------------------------------------------------------------------------
 
-static const int IDM_WINDOWTILE  = 4001;
 static const int IDM_WINDOWTILEHOR  = 4001;
 static const int IDM_WINDOWCASCADE = 4002;
 static const int IDM_WINDOWICONS = 4003;
@@ -88,10 +87,6 @@ static const int IDM_WINDOWPREV = 4006;
 static const int wxFIRST_MDI_CHILD = 4100;
 static const int wxLAST_MDI_CHILD = 4600;
 
-// Status border dimensions
-static const int wxTHICK_LINE_BORDER = 3;
-static const int wxTHICK_LINE_WIDTH  = 1;
-
 // ---------------------------------------------------------------------------
 // private functions
 // ---------------------------------------------------------------------------
@@ -318,7 +313,7 @@ void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu)
             {
                 int nCount = bar->GetMenuCount();
                 for (int n = 0; n < nCount; n++)
-                bar->GetMenu(n)->UpdateUI(source);
+                    bar->GetMenu(n)->UpdateUI(source);
             }
         }
     }
@@ -384,10 +379,14 @@ void wxMDIParentFrame::Cascade()
     ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDICASCADE, 0, 0);
 }
 
-// TODO: add a direction argument (hor/vert)
-void wxMDIParentFrame::Tile()
+void wxMDIParentFrame::Tile(wxOrientation orient)
 {
-    ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDITILE, MDITILE_HORIZONTAL, 0);
+    wxASSERT_MSG( orient == wxHORIZONTAL || orient == wxVERTICAL,
+                  _T("invalid orientation value") );
+
+    ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDITILE,
+                  orient == wxHORIZONTAL ? MDITILE_HORIZONTAL
+                                         : MDITILE_VERTICAL, 0);
 }
 
 void wxMDIParentFrame::ArrangeIcons()
@@ -486,9 +485,8 @@ WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message,
             break;
 
         case WM_SIZE:
-            // as we don't (usually) resize the MDI client to exactly fit the
-            // client area (we put it below the toolbar, above statusbar &c),
-            // we should not pass this one to DefFrameProc
+            // though we don't (usually) resize the MDI client to exactly fit the
+            // client area we need to pass this one to DefFrameProc to allow the children to show
             break;
     }
 
@@ -817,7 +815,8 @@ void wxMDIChildFrame::DoSetClientSize(int width, int height)
 
   MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)true);
 
-  wxSizeEvent event(wxSize(width, height), m_windowId);
+  wxSize size(width, height);
+  wxSizeEvent event(size, m_windowId);
   event.SetEventObject( this );
   GetEventHandler()->ProcessEvent(event);
 }
@@ -835,8 +834,10 @@ void wxMDIChildFrame::DoGetPosition(int *x, int *y) const
   wxMDIParentFrame *mdiParent = (wxMDIParentFrame *)GetParent();
   ::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point);
 
-  *x = point.x;
-  *y = point.y;
+  if (x)
+      *x = point.x;
+  if (y)
+      *y = point.y;
 }
 
 void wxMDIChildFrame::InternalSetMenuBar()
@@ -849,6 +850,12 @@ void wxMDIChildFrame::InternalSetMenuBar()
     parent->m_parentFrameActive = false;
 }
 
+void wxMDIChildFrame::DetachMenuBar()
+{
+       RemoveWindowMenu(NULL, m_hMenu);
+       wxFrame::DetachMenuBar();
+}
+
 WXHICON wxMDIChildFrame::GetDefaultIcon() const
 {
     // we don't have any standard icons (any more)
@@ -1318,7 +1325,7 @@ void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
     {
         Show(true);
     }
-    
+
     // MDI child frames get their WM_SIZE when they're constructed but at this
     // moment they don't have any children yet so all child windows will be
     // positioned incorrectly when they are added later - to fix this, we
@@ -1376,6 +1383,7 @@ static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu)
                 continue;
             }
 
+
             if ( wxStripMenuCodes(wxString(buf)).IsSameAs(_("Help")) )
             {
                 success = true;