]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved Get/SetToolBar down into frame.h/cpp
authorJulian Smart <julian@anthemion.co.uk>
Thu, 23 Jul 1998 14:25:44 +0000 (14:25 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 23 Jul 1998 14:25:44 +0000 (14:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@325 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index 9da07a884c7ab91866da304d54340524961f3918..f2163fac02098316ebac321d790b230646a3c3e8 100644 (file)
@@ -58,6 +58,10 @@ public:
   void GetPosition(int *x, int *y) const ;
   void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
 
+  // Toolbar: if made known to the frame, the frame will manage it automatically.
+  virtual inline void SetToolBar(wxWindow *toolbar) { m_frameToolBar = toolbar; }
+  virtual inline wxWindow *GetToolBar(void) const { return m_frameToolBar; }
+
   virtual bool OnClose(void);
 
   void OnSize(wxSizeEvent& event);
@@ -144,6 +148,7 @@ protected:
   bool                  m_iconized;
   WXHICON               m_defaultIcon;
   static bool           m_useNativeStatusBar;
+  wxWindow *            m_frameToolBar ;
 
   DECLARE_EVENT_TABLE()
 };
index d5039e704e0ff0910df4c3ad1dddfb54decb07f4..0ba4f620349151be384f408ee40351d785b17157 100644 (file)
@@ -63,10 +63,6 @@ class WXDLLEXPORT wxMDIParentFrame: public wxFrame
   void OnSize(wxSizeEvent& event);
   void OnActivate(wxActivateEvent& event);
 
-  // Toolbar (currently, for use by Windows MDI parent frames ONLY)
-  virtual inline void SetToolBar(wxWindow *toolbar) { m_frameToolBar = toolbar; }
-  virtual inline wxWindow *GetToolBar(void) const { return m_frameToolBar; }
-
   void SetMenuBar(wxMenuBar *menu_bar);
 
   // Gets the size available for subwindows after menu size, toolbar size
@@ -113,7 +109,6 @@ class WXDLLEXPORT wxMDIParentFrame: public wxFrame
     WXHMENU                         m_windowMenu;
     bool                            m_parentFrameActive; // TRUE if MDI Frame is intercepting
                                                          // commands, not child
-    wxWindow *                      m_frameToolBar ;
 DECLARE_EVENT_TABLE()
 };
 
index 83690f3fe072543c9f15d6014ed25fc542c7ccea..a4c8b0b9021861f92fbabb96efc44fb094520fac 100644 (file)
@@ -68,6 +68,7 @@ bool wxFrame::m_useNativeStatusBar = FALSE;
 
 wxFrame::wxFrame(void)
 {
+  m_frameToolBar = NULL ;
   m_frameMenuBar = NULL;
   m_frameStatusBar = NULL;
 
@@ -90,6 +91,7 @@ bool wxFrame::Create(wxWindow *parent,
 //  m_modalShowing = FALSE;
   m_windowStyle = style;
   m_frameMenuBar = NULL;
+  m_frameToolBar = NULL ;
   m_frameStatusBar = NULL;
 
   SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE));
@@ -764,7 +766,8 @@ void wxFrame::OnSize(wxSizeEvent& event)
     wxWindow *win = (wxWindow *)node->Data();
     if ( !win->IsKindOf(CLASSINFO(wxFrame))  &&
          !win->IsKindOf(CLASSINFO(wxDialog)) && 
-         (win != GetStatusBar()) )
+         (win != GetStatusBar()) &&
+         (win != GetToolBar()) )
     {
       if ( child )
         return;     // it's our second subwindow - nothing to do
@@ -774,10 +777,23 @@ void wxFrame::OnSize(wxSizeEvent& event)
 
   if ( child ) {
     // we have exactly one child - set it's size to fill the whole frame
-    int client_x, client_y;
+    int clientW, clientH;
+    GetClientSize(&clientW, &clientH);
 
-    GetClientSize(&client_x, &client_y);
-    child->SetSize(0, 0, client_x, client_y);
+    int x = 0;
+    int y = 0;
+
+    // Manage the toolbar if there is one
+    if ( GetToolBar() )
+    {
+        int wt, ht;
+        GetToolBar()->GetSize(&wt, &ht);
+        clientH -= ht;
+        y += ht;
+        GetToolBar()->SetSize(0, 0, clientW, ht);
+    }
+
+    child->SetSize(x, y, clientW, clientH);
   }
 }
 
index c156a76dc9276c41ba359b2529ff3fa48edc0ca8..f893117e5f858d2cb2b3f1a29c76fe85cd7a8f99 100644 (file)
@@ -82,7 +82,6 @@ wxMDIParentFrame::wxMDIParentFrame(void)
     m_currentChild = NULL;
     m_windowMenu = 0;
     m_parentFrameActive = TRUE;
-       m_frameToolBar = NULL ;
 }
 
 bool wxMDIParentFrame::Create(wxWindow *parent,
@@ -95,7 +94,6 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
 {
   m_defaultIcon = (WXHICON) (wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON : wxDEFAULT_MDIPARENTFRAME_ICON);
 
-  m_frameToolBar = NULL ;
   m_clientWindow = NULL;
   m_currentChild = NULL;
   m_windowMenu = 0;