X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1529bc41dc2ce5d35cbcc19ca0d1f8b2f68d7010..b2f0b9342aecc01f06871c53c75c53e8f7be9ff3:/src/gtk/frame.cpp diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index e79ff78ec2..68adf5fb90 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -119,6 +119,8 @@ static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidge // InsertChild for wxFrame //----------------------------------------------------------------------------- +#if wxUSE_TOOLBAR + /* Callback for wxFrame. This very strange beast has to be used because * C++ has no virtual methods in a constructor. We have to emulate a * virtual function here as wxWidgets requires different ways to insert @@ -152,9 +154,11 @@ static void wxInsertChildInFrame(wxWindow* parent, wxWindow* child) parent); } } -#endif // wxUSE_TOOLBAR +#endif // wxUSE_TOOLBAR_NATIVE } +#endif // wxUSE_TOOLBAR + // ---------------------------------------------------------------------------- // wxFrame creation // ---------------------------------------------------------------------------- @@ -198,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; } @@ -242,7 +245,21 @@ bool wxFrame::ShowFullScreen(bool show, long style) return false; wxWindow* const bar[] = { - m_frameMenuBar, m_frameToolBar, m_frameStatusBar +#if wxUSE_MENUS + m_frameMenuBar, +#else + NULL, +#endif +#if wxUSE_TOOLBAR + m_frameToolBar, +#else + NULL, +#endif +#if wxUSE_STATUSBAR + m_frameStatusBar, +#else + NULL, +#endif }; const long fsNoBar[] = { wxFULLSCREEN_NOMENUBAR, wxFULLSCREEN_NOTOOLBAR, wxFULLSCREEN_NOSTATUSBAR @@ -302,23 +319,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; 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 @@ -327,16 +348,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; @@ -368,7 +384,7 @@ 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; @@ -571,6 +587,10 @@ void wxFrame::UpdateMenuBarSize() GtkUpdateSize(); } +bool wxFrame::HasVisibleMenubar() const +{ + return m_frameMenuBar && m_frameMenuBar->IsShown(); +} #endif // wxUSE_MENUS_NATIVE #if wxUSE_TOOLBAR