#define XIconifyWindow XICONIFYWINDOW
#endif
-#include "wx/frame.h"
+#include "wx/defs.h"
+
#include "wx/dialog.h"
#include "wx/control.h"
#include "wx/app.h"
// event tables
// ----------------------------------------------------------------------------
-#ifdef __WXUNIVERSAL__
- IMPLEMENT_DYNAMIC_CLASS(wxFrameGTK, wxWindow)
-#else
- IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxFrameGTK)
- IMPLEMENT_DYNAMIC_CLASS(wxFrameGTK, wxWindow)
+#ifndef __WXUNIVERSAL__
+ IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
#endif
// ----------------------------------------------------------------------------
return TRUE;
}
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
+
//-----------------------------------------------------------------------------
// "child_attached" of menu bar
//-----------------------------------------------------------------------------
win->m_menuBarDetached = TRUE;
win->GtkUpdateSize();
}
-#endif // wxUSE_MENUS
+
+#endif // wxUSE_MENUS_NATIVE
#if wxUSE_TOOLBAR
//-----------------------------------------------------------------------------
wxWindow::DoGetClientSize( width, height );
if (height)
{
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
/* menu bar */
if (m_frameMenuBar)
{
else
(*height) -= wxPLACE_HOLDER;
}
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
#if wxUSE_STATUSBAR
/* status bar */
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
/* menu bar */
if (m_frameMenuBar)
{
else
height += wxPLACE_HOLDER;
}
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
#if wxUSE_STATUSBAR
/* status bar */
* 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
+#if wxUSE_MENUS_NATIVE
if (m_frameMenuBar)
{
int xx = m_miniEdge;
xx, yy, ww, hh );
client_area_y_offset += hh;
}
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
#if wxUSE_TOOLBAR
if ((m_frameToolBar) && m_frameToolBar->IsShown() &&
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
if (m_frameMenuBar)
{
if (!m_menuBarDetached)
else
yy += wxPLACE_HOLDER;
}
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy;
return;
}
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
if (m_frameMenuBar) m_frameMenuBar->OnInternalIdle();
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
#if wxUSE_TOOLBAR
if (m_frameToolBar) m_frameToolBar->OnInternalIdle();
#endif
// menu/tool/status bar stuff
// ----------------------------------------------------------------------------
-#if wxUSE_MENUS
+#if wxUSE_MENUS_NATIVE
-void wxFrameGTK::SetMenuBar( wxMenuBar *menuBar )
+void wxFrameGTK::DetachMenuBar()
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
wxASSERT_MSG( (m_wxwindow != NULL), wxT("invalid frame") );
- if (menuBar == m_frameMenuBar)
- return;
-
- if (m_frameMenuBar)
+ if ( m_frameMenuBar )
{
m_frameMenuBar->UnsetInvokingWindow( this );
gtk_widget_unparent( m_frameMenuBar->m_widget );
}
- m_frameMenuBar = menuBar;
+ wxFrameBase::DetachMenuBar();
+}
+
+void wxFrameGTK::AttachMenuBar( wxMenuBar *menuBar )
+{
+ wxFrameBase::AttachMenuBar(menuBar);
if (m_frameMenuBar)
{
m_sizeSet = FALSE;
}
-#endif // wxUSE_MENUS
+#endif // wxUSE_MENUS_NATIVE
#if wxUSE_TOOLBAR
{
if (iconize)
{
- XIconifyWindow( GDK_WINDOW_XDISPLAY( m_widget->window ),
- GDK_WINDOW_XWINDOW( m_widget->window ),
- DefaultScreen( GDK_DISPLAY() ) );
+ GdkWindow *window = m_widget->window;
+
+ // you should do it later, for example from OnCreate() handler
+ wxCHECK_RET( window, _T("frame not created yet - can't iconize") );
+
+ XIconifyWindow( GDK_WINDOW_XDISPLAY( window ),
+ GDK_WINDOW_XWINDOW( window ),
+ DefaultScreen( GDK_DISPLAY() ) );
}
}
m_isIconized = iconize;
(void)SendIconizeEvent(iconize);
}
- else
- {
- // this is not supposed to happen if we're called only from
- // gtk_frame_(un)map_callback!
-
- // RR: I don't understand this test. Upon startup, the frame is
- // not iconized by default, it has just not been created
- // yet.
- ///wxFAIL_MSG( _T("unexpected call to SendIconizeEvent ignored") );
- }
}