]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mdi.cpp
removed obsolete file
[wxWidgets.git] / src / msw / mdi.cpp
index 8ab7af988c6a09a829c42bd8afe27b81a5dc47ed..c71a0a8d37357ed5cd7b2c16562dfce6c0dfa392 100644 (file)
@@ -163,10 +163,6 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
                               long style,
                               const wxString& name)
 {
-  m_defaultIcon = (WXHICON) (wxSTD_MDIPARENTFRAME_ICON
-                                ? wxSTD_MDIPARENTFRAME_ICON
-                                : wxDEFAULT_MDIPARENTFRAME_ICON);
-
   m_clientWindow = NULL;
   m_currentChild = NULL;
 
@@ -270,19 +266,20 @@ wxMDIParentFrame::~wxMDIParentFrame()
     }
 }
 
+#if wxUSE_MENUS_NATIVE
+
 void wxMDIParentFrame::InternalSetMenuBar()
 {
-//    HMENU subMenu = GetSubMenu((HMENU) m_windowMenu, 0);
-
     m_parentFrameActive = TRUE;
 
-    HMENU subMenu = (HMENU) 0;
-    if (GetWindowMenu())
-        subMenu = (HMENU) GetWindowMenu()->GetHMenu();
+    wxMenu *menu = GetWindowMenu();
+    HMENU subMenu = menu ? GetHmenuOf(menu) : 0;
 
     InsertWindowMenu(GetClientWindow(), m_hMenu, subMenu);
 }
 
+#endif // wxUSE_MENUS_NATIVE
+
 void wxMDIParentFrame::SetWindowMenu(wxMenu* menu)
 {
     if (m_windowMenu)
@@ -348,6 +345,12 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
     event.Skip();
 }
 
+WXHICON wxMDIParentFrame::GetDefaultIcon() const
+{
+    return (WXHICON)(wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON
+                                               : wxDEFAULT_MDIPARENTFRAME_ICON);
+}
+
 // ---------------------------------------------------------------------------
 // MDI operations
 // ---------------------------------------------------------------------------
@@ -646,10 +649,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
                              long style,
                              const wxString& name)
 {
-  m_defaultIcon = (WXHICON)(wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON
-                                                     : wxDEFAULT_MDICHILDFRAME_ICON);
-
   SetName(name);
+  wxWindowBase::Show(TRUE); // MDI child frame starts off shown
 
   if ( id > -1 )
     m_windowId = id;
@@ -812,6 +813,12 @@ void wxMDIChildFrame::InternalSetMenuBar()
     parent->m_parentFrameActive = FALSE;
 }
 
+WXHICON wxMDIChildFrame::GetDefaultIcon() const
+{
+    return (WXHICON)(wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON
+                                              : wxDEFAULT_MDICHILDFRAME_ICON);
+}
+
 // ---------------------------------------------------------------------------
 // MDI operations
 // ---------------------------------------------------------------------------
@@ -872,10 +879,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:
             {
@@ -978,7 +983,10 @@ bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate),
         parent->m_currentChild = NULL;
 
         HMENU parent_menu = (HMENU)parent->GetWinMenu();
-        if ( parent_menu )
+
+        // activate the the parent menu only when there is no other child
+        // that has been activated
+        if ( parent_menu && !hwndAct )
         {
             parent->m_parentFrameActive = TRUE;
 
@@ -1036,6 +1044,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) != 0;
+
+    // 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
 // ---------------------------------------------------------------------------