]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/frame.cpp
cleanup for 10.5
[wxWidgets.git] / src / gtk / frame.cpp
index 2d8ad5a544e375a3aa1af569a9ab8fa82dab3092..801f14ac60b20c94ef778bb9b3373d9a89732a30 100644 (file)
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
 #include "wx/frame.h"
 
 #ifndef WX_PRECOMP
-    #include "wx/app.h"
-    #include "wx/dcclient.h"
     #include "wx/menu.h"
-    #include "wx/dialog.h"
-    #include "wx/control.h"
     #include "wx/toolbar.h"
     #include "wx/statusbr.h"
 #endif // WX_PRECOMP
 
-#include <glib.h>
 #include "wx/gtk/private.h"
-
-#include <gdk/gdkkeysyms.h>
-#include <gdk/gdkx.h>
-
 #include "wx/gtk/win_gtk.h"
 
 // ----------------------------------------------------------------------------
 // constants
 // ----------------------------------------------------------------------------
 
-const int wxSTATUS_HEIGHT  = 25;
-const int wxPLACE_HOLDER   = 0;
+static const int wxSTATUS_HEIGHT  = 25;
+static const int wxPLACE_HOLDER   = 0;
 
 // ----------------------------------------------------------------------------
 // event tables
@@ -252,31 +235,39 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const
         if (m_frameStatusBar && m_frameStatusBar->IsShown())
             (*height) -= wxSTATUS_HEIGHT;
 #endif // wxUSE_STATUSBAR
+    }
 
 #if wxUSE_TOOLBAR
-        // tool bar
-        if (m_frameToolBar && m_frameToolBar->IsShown())
+    // tool bar
+    if (m_frameToolBar && m_frameToolBar->IsShown())
+    {
+        if (m_toolBarDetached)
         {
-            if (m_toolBarDetached)
-            {
+            if (height != NULL)
                 *height -= wxPLACE_HOLDER;
+        }
+        else
+        {
+            int x, y;
+            m_frameToolBar->GetSize( &x, &y );
+            if ( m_frameToolBar->GetWindowStyle() & wxTB_VERTICAL )
+            {
+                if (width != NULL)
+                    *width -= x;
             }
             else
             {
-                int x, y;
-                m_frameToolBar->GetSize( &x, &y );
-                if ( m_frameToolBar->GetWindowStyle() & wxTB_VERTICAL )
-                {
-                    *width -= x;
-                }
-                else
-                {
+                if (height != NULL)
                     *height -= y;
-                }
             }
         }
-#endif // wxUSE_TOOLBAR
     }
+#endif // wxUSE_TOOLBAR
+
+    if (width != NULL && *width < 0)
+        *width = 0;
+    if (height != NULL && *height < 0)
+        *height = 0;
 }
 
 void wxFrame::DoSetClientSize( int width, int height )
@@ -425,11 +416,22 @@ void wxFrame::GtkOnSize()
                 ww = m_toolBarDetached ? wxPLACE_HOLDER
                                        : m_frameToolBar->m_width;
                 hh = m_height - 2*m_miniEdge;
-                if (hh < 0)
-                    hh = 0;
 
                 client_area_x_offset += ww;
             }
+            else if( m_frameToolBar->GetWindowStyle() & wxTB_BOTTOM )
+            {
+                xx = m_miniEdge;
+                yy = GetClientSize().y;
+#if wxUSE_MENUS_NATIVE
+                yy += m_menuBarHeight;
+#endif // wxUSE_MENU_NATIVE
+                m_frameToolBar->m_x = xx;
+                m_frameToolBar->m_y = yy;
+                ww = m_width - 2*m_miniEdge;
+                hh = m_toolBarDetached ? wxPLACE_HOLDER
+                                       : m_frameToolBar->m_height;
+            }
             else
             {
                 ww = m_width - 2*m_miniEdge;
@@ -439,6 +441,10 @@ void wxFrame::GtkOnSize()
                 client_area_y_offset += hh;
             }
 
+            if (ww < 0)
+                ww = 0;
+            if (hh < 0)
+                hh = 0;
             gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
                                   m_frameToolBar->m_widget,
                                   xx, yy, ww, hh );