- wxWindow *win = (wxWindow *)node->Data();
- if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
- !win->IsKindOf(CLASSINFO(wxDialog))
-#if 0 // not in m_children anyway
- && (win != m_frameMenuBar) &&
- (win != m_frameStatusBar)
-#endif
- )
- {
- if ( child ) // it's the second one: do nothing
- return;
-
- child = win;
- };
- };
-
- // yes: set it's size to fill all the frame
- int client_x, client_y;
- GetClientSize(&client_x, &client_y);
- child->SetSize( 1, 1, client_x-2, client_y);
- }
-};
-
-static void SetInvokingWindow( wxMenu *menu, wxWindow *win )
-{
- menu->SetInvokingWindow( win );
- wxNode *node = menu->m_items.First();
- while (node)
- {
- wxMenuItem *menuitem = (wxMenuItem*)node->Data();
- if (menuitem->m_isSubMenu) SetInvokingWindow( menuitem->m_subMenu, win );
- node = node->Next();
- };
-};
-
-void wxFrame::SetMenuBar( wxMenuBar *menuBar )
-{
- m_frameMenuBar = menuBar;
-
- if (m_frameMenuBar)
- {
- if (m_frameMenuBar->m_parent != this)
+ // set size hints
+ gint flag = 0; // GDK_HINT_POS;
+ if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
+ if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
+ GdkGeometry geom;
+ geom.min_width = minWidth;
+ geom.min_height = minHeight;
+ geom.max_width = maxWidth;
+ geom.max_height = maxHeight;
+ gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
+ (GtkWidget*) NULL,
+ &geom,
+ (GdkWindowHints) flag );
+
+ // I revert back to wxGTK's original behaviour. m_mainWidget holds
+ // the menubar, the toolbar and the client area, which is represented
+ // by m_wxwindow.
+ // This hurts in the eye, but I don't want to call SetSize()
+ // because I don't want to call any non-native functions here.
+
+#if wxUSE_MENUS_NATIVE
+ if (m_frameMenuBar)
+ {
+ int xx = m_miniEdge;
+ int yy = m_miniEdge + m_miniTitle;
+ int ww = m_width - 2*m_miniEdge;
+ int hh = m_menuBarHeight;
+ if (m_menuBarDetached) hh = wxPLACE_HOLDER;
+ m_frameMenuBar->m_x = xx;
+ m_frameMenuBar->m_y = yy;
+ m_frameMenuBar->m_width = ww;
+ m_frameMenuBar->m_height = hh;
+ gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
+ m_frameMenuBar->m_widget,
+ xx, yy, ww, hh );
+ client_area_y_offset += hh;
+ }
+#endif // wxUSE_MENUS_NATIVE
+
+#if wxUSE_TOOLBAR
+ if ((m_frameToolBar) && m_frameToolBar->IsShown() &&
+ (m_frameToolBar->m_widget->parent == m_mainWidget))
+ {
+ int xx = m_miniEdge;
+ 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
+
+ m_frameToolBar->m_x = xx;
+ m_frameToolBar->m_y = yy;
+
+ // don't change the toolbar's reported height/width
+ int ww, hh;
+ if ( m_frameToolBar->GetWindowStyle() & wxTB_VERTICAL )
+ {
+ ww = m_toolBarDetached ? wxPLACE_HOLDER
+ : m_frameToolBar->m_width;
+ hh = m_height - 2*m_miniEdge;
+
+ client_area_x_offset += ww;
+ }
+ else
+ {
+ ww = m_width - 2*m_miniEdge;
+ hh = m_toolBarDetached ? wxPLACE_HOLDER
+ : m_frameToolBar->m_height;
+
+ client_area_y_offset += hh;
+ }
+
+ gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
+ m_frameToolBar->m_widget,
+ xx, yy, ww, hh );
+ }
+#endif // wxUSE_TOOLBAR
+
+ 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;
+ gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
+ m_wxwindow,
+ client_x, client_y, client_w, client_h );
+ }
+ else