]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/frame.cpp
Borland has only lfind
[wxWidgets.git] / src / gtk / frame.cpp
index c89c664ade3001bc12452da25d69081799819761..48b111dc80732e6a1384238459cf86f242be9dd8 100644 (file)
@@ -202,8 +202,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const
     {
 #if wxUSE_MENUS_NATIVE
         // menu bar
-        if (m_frameMenuBar &&
-            GTK_WIDGET_VISIBLE(m_frameMenuBar->m_widget) && !m_menuBarDetached)
+        if (HasVisibleMenubar() && !m_menuBarDetached)
         {
             *height -= m_menuBarHeight;
         }
@@ -311,6 +310,9 @@ void wxFrame::GtkOnSize()
 
     ConstrainSize();
 
+    int width, height;
+    GTKDoGetSize(&width, &height);
+
     if (m_mainWidget)
     {
         // TODO
@@ -320,23 +322,27 @@ void wxFrame::GtkOnSize()
         // area, which is represented by m_wxwindow.
 
 #if wxUSE_MENUS_NATIVE
-        if (m_frameMenuBar && m_frameMenuBar->IsShown())
+        int menubarHeight = 0;
+#endif
+
+#if wxUSE_MENUS_NATIVE
+        if (HasVisibleMenubar())
         {
             int xx = m_miniEdge;
             int yy = m_miniEdge + m_miniTitle;
-            int ww = m_width  - 2*m_miniEdge;
+            int ww = width - 2*m_miniEdge;
             if (ww < 0)
                 ww = 0;
-            int hh = m_menuBarHeight;
-            if (m_menuBarDetached) hh = wxPLACE_HOLDER;
+            menubarHeight = m_menuBarHeight;
+            if (m_menuBarDetached) menubarHeight = wxPLACE_HOLDER;
             m_frameMenuBar->m_x = xx;
             m_frameMenuBar->m_y = yy;
             m_frameMenuBar->m_width = ww;
-            m_frameMenuBar->m_height = hh;
+            m_frameMenuBar->m_height = menubarHeight;
             gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
                                   m_frameMenuBar->m_widget,
-                                  xx, yy, ww, hh );
-            client_area_y_offset += hh;
+                                  xx, yy, ww, menubarHeight);
+            client_area_y_offset += menubarHeight;
         }
 #endif // wxUSE_MENUS_NATIVE
 
@@ -345,16 +351,11 @@ void wxFrame::GtkOnSize()
             (m_frameToolBar->m_widget->parent == m_mainWidget))
         {
             int xx = m_miniEdge;
-            int yy = m_miniEdge + m_miniTitle;
+            int yy = m_miniEdge + m_miniTitle
 #if wxUSE_MENUS_NATIVE
-            if (m_frameMenuBar)
-            {
-                if (!m_menuBarDetached)
-                    yy += m_menuBarHeight;
-                else
-                    yy += wxPLACE_HOLDER;
-            }
-#endif // wxUSE_MENUS_NATIVE
+                        + menubarHeight
+#endif
+                        ;
 
             m_frameToolBar->m_x = xx;
             m_frameToolBar->m_y = yy;
@@ -365,7 +366,7 @@ void wxFrame::GtkOnSize()
             {
                 ww = m_toolBarDetached ? wxPLACE_HOLDER
                                        : m_frameToolBar->m_width;
-                hh = m_height - 2*m_miniEdge;
+                hh = height - 2*m_miniEdge;
 
                 client_area_x_offset += ww;
             }
@@ -375,7 +376,7 @@ void wxFrame::GtkOnSize()
                ww = m_toolBarDetached ? wxPLACE_HOLDER
                                       : m_frameToolBar->m_width;
                xx = GetClientSize().x - 1;
-               hh = m_height - 2*m_miniEdge;
+               hh = height - 2*m_miniEdge;
                if( hh < 0 )
                   hh = 0;
 
@@ -386,16 +387,16 @@ void wxFrame::GtkOnSize()
                 yy = GetClientSize().y;
 #if wxUSE_MENUS_NATIVE
                 yy += m_menuBarHeight;
-#endif // wxUSE_MENU_NATIVE
+#endif // wxUSE_MENUS_NATIVE
                 m_frameToolBar->m_x = xx;
                 m_frameToolBar->m_y = yy;
-                ww = m_width - 2*m_miniEdge;
+                ww = width - 2*m_miniEdge;
                 hh = m_toolBarDetached ? wxPLACE_HOLDER
                                        : m_frameToolBar->m_height;
             }
             else
             {
-                ww = m_width - 2*m_miniEdge;
+                ww = width - 2*m_miniEdge;
                 hh = m_toolBarDetached ? wxPLACE_HOLDER
                                        : m_frameToolBar->m_height;
 
@@ -414,8 +415,8 @@ void wxFrame::GtkOnSize()
 
         int client_x = client_area_x_offset + m_miniEdge;
         int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
-        int client_w = m_width - client_area_x_offset - 2*m_miniEdge;
-        int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
+        int client_w = width - client_area_x_offset - 2*m_miniEdge;
+        int client_h = height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
         if (client_w < 0)
             client_w = 0;
         if (client_h < 0)
@@ -434,8 +435,8 @@ void wxFrame::GtkOnSize()
     if (m_frameStatusBar && m_frameStatusBar->IsShown())
     {
         int xx = 0 + m_miniEdge;
-        int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset;
-        int ww = m_width - 2*m_miniEdge;
+        int yy = height - wxSTATUS_HEIGHT - m_miniEdge - client_area_y_offset;
+        int ww = width - 2*m_miniEdge;
         if (ww < 0)
             ww = 0;
         int hh = wxSTATUS_HEIGHT;
@@ -589,6 +590,10 @@ void wxFrame::UpdateMenuBarSize()
     GtkUpdateSize();
 }
 
+bool wxFrame::HasVisibleMenubar() const
+{
+    return m_frameMenuBar && m_frameMenuBar->IsShown();
+}
 #endif // wxUSE_MENUS_NATIVE
 
 #if wxUSE_TOOLBAR