X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/88ac883a0d005437c97a60d8195bd5e4719b1154..4080c40a71a40c54798f2681e22c7cc4701ace07:/src/gtk1/frame.cpp?ds=inline diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 37e2910235..0963513426 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -16,8 +16,12 @@ #include "wx/control.h" #include "wx/app.h" #include "wx/menu.h" +#if wxUSE_TOOLBAR #include "wx/toolbar.h" +#endif +#if wxUSE_STATUSBAR #include "wx/statusbr.h" +#endif #include "wx/dcclient.h" #include "glib.h" @@ -482,7 +486,7 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) int old_width = m_width; int old_height = m_height; - if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING) + if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0) { if (x != -1) m_x = x; if (y != -1) m_y = y; @@ -560,9 +564,12 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const (*height) -= wxPLACE_HOLDER; } +#if wxUSE_STATUSBAR /* status bar */ if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT; +#endif +#if wxUSE_TOOLBAR /* tool bar */ if (m_frameToolBar) { @@ -575,6 +582,7 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const else (*height) -= wxPLACE_HOLDER; } +#endif /* mini edge */ (*height) -= m_miniEdge*2 + m_miniTitle; @@ -598,9 +606,12 @@ void wxFrame::DoSetClientSize( int width, int height ) height += wxPLACE_HOLDER; } +#if wxUSE_STATUSBAR /* status bar */ if (m_frameStatusBar) height += wxSTATUS_HEIGHT; +#endif +#if wxUSE_TOOLBAR /* tool bar */ if (m_frameToolBar) { @@ -613,6 +624,7 @@ void wxFrame::DoSetClientSize( int width, int height ) else height += wxPLACE_HOLDER; } +#endif wxWindow::DoSetClientSize( width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle ); } @@ -674,6 +686,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height client_area_y_offset += hh; } +#if wxUSE_TOOLBAR if (m_frameToolBar) { int xx = m_miniEdge; @@ -697,6 +710,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height xx, yy, ww, hh ); client_area_y_offset += hh; } +#endif int client_x = m_miniEdge; int client_y = client_area_y_offset + m_miniEdge + m_miniTitle; @@ -712,6 +726,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height is no need to set the size or position of m_wxwindow. */ } +#if wxUSE_STATUSBAR if (m_frameStatusBar) { int xx = 0 + m_miniEdge; @@ -726,6 +741,7 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_frameStatusBar->m_widget, xx, yy, ww, hh ); } +#endif /* we actually set the size of a frame here and no-where else */ gtk_widget_set_usize( m_widget, m_width, m_height ); @@ -764,8 +780,12 @@ void wxFrame::OnInternalIdle() DoMenuUpdates(); if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle(); +#if wxUSE_TOOLBAR if (m_frameToolBar) m_frameToolBar->OnInternalIdle(); +#endif +#if wxUSE_STATUSBAR if (m_frameStatusBar) m_frameStatusBar->OnInternalIdle(); +#endif } void wxFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) ) @@ -813,25 +833,6 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) } } -static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) -{ - menu->SetInvokingWindow( win ); - -#if (GTK_MINOR_VERSION > 0) - /* support for native hot keys */ - gtk_accel_group_attach( menu->m_accel, GTK_OBJECT(win->m_widget)); -#endif - - wxNode *node = menu->GetItems().First(); - while (node) - { - wxMenuItem *menuitem = (wxMenuItem*)node->Data(); - if (menuitem->IsSubMenu()) - SetInvokingWindow( menuitem->GetSubMenu(), win ); - node = node->Next(); - } -} - void wxFrame::SetMenuBar( wxMenuBar *menuBar ) { wxASSERT_MSG( (m_widget != NULL), _T("invalid frame") ); @@ -841,18 +842,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar ) if (m_frameMenuBar) { -#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0) - /* support for native key accelerators indicated by underscroes */ - gtk_accel_group_attach( m_frameMenuBar->m_accel, GTK_OBJECT(m_widget)); -#endif - - wxNode *node = m_frameMenuBar->GetMenus().First(); - while (node) - { - wxMenu *menu = (wxMenu*)node->Data(); - SetInvokingWindow( menu, this ); - node = node->Next(); - } + m_frameMenuBar->SetInvokingWindow( this ); if (m_frameMenuBar->GetParent() != this) { @@ -872,6 +862,8 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar ) gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached", GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this ); } + + m_frameMenuBar->Show( TRUE ); } }