return TRUE;
}
+//-----------------------------------------------------------------------------
+// "child_attached" of menu bar
+//-----------------------------------------------------------------------------
+
+static void gtk_menu_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+{
+ if (!win->HasVMT()) return;
+
+ win->m_menuBarDetached = FALSE;
+ win->m_sizeSet = FALSE;
+}
+
+//-----------------------------------------------------------------------------
+// "child_detached" of menu bar
+//-----------------------------------------------------------------------------
+
+static void gtk_menu_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+{
+ if (!win->HasVMT()) return;
+
+ win->m_menuBarDetached = TRUE;
+ win->m_sizeSet = FALSE;
+}
+
+//-----------------------------------------------------------------------------
+// "child_attached" of tool bar
+//-----------------------------------------------------------------------------
+
+static void gtk_toolbar_attached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+{
+ if (!win->HasVMT()) return;
+
+ win->m_toolBarDetached = FALSE;
+ win->m_sizeSet = FALSE;
+}
+
+//-----------------------------------------------------------------------------
+// "child_detached" of tool bar
+//-----------------------------------------------------------------------------
+
+static void gtk_toolbar_detached_callback( GtkWidget *WXUNUSED(widget), GtkWidget *WXUNUSED(child), wxFrame *win )
+{
+ if (!win->HasVMT()) return;
+
+ win->m_toolBarDetached = TRUE;
+ win->m_sizeSet = FALSE;
+}
+
//-----------------------------------------------------------------------------
// "configure_event"
//-----------------------------------------------------------------------------
{
if (wxIS_KIND_OF(child,wxToolBar) || wxIS_KIND_OF(child,wxMenuBar))
{
+ /* actually, menubars are never inserted here, but this
+ may change one day */
+
/* these are outside the client area */
wxFrame* frame = (wxFrame*) parent;
gtk_myfixed_put( GTK_MYFIXED(frame->m_mainWidget),
wxFrame::wxFrame()
{
m_frameMenuBar = (wxMenuBar *) NULL;
- m_mdiMenuBar = (wxMenuBar *) NULL;
m_frameStatusBar = (wxStatusBar *) NULL;
m_frameToolBar = (wxToolBar *) NULL;
m_sizeSet = FALSE;
m_miniEdge = 0;
m_miniTitle = 0;
m_mainWidget = (GtkWidget*) NULL;
+ m_menuBarDetached = FALSE;
+ m_toolBarDetached = FALSE;
}
wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
long style, const wxString &name )
{
m_frameMenuBar = (wxMenuBar *) NULL;
- m_mdiMenuBar = (wxMenuBar *) NULL;
m_frameStatusBar = (wxStatusBar *) NULL;
m_frameToolBar = (wxToolBar *) NULL;
m_sizeSet = FALSE;
m_miniEdge = 0;
m_miniTitle = 0;
m_mainWidget = (GtkWidget*) NULL;
+ m_menuBarDetached = FALSE;
+ m_toolBarDetached = FALSE;
Create( parent, id, title, pos, size, style, name );
}
recognized by other WM as well. not tested. */
long decor = (long) GDK_DECOR_ALL;
long func = (long) GDK_FUNC_ALL;
+
if ((m_windowStyle & wxCAPTION) == 0)
decor |= GDK_DECOR_TITLE;
-/*
- if ((m_windowStyle & wxMINIMIZE) == 0)
+/* if ((m_windowStyle & wxMINIMIZE) == 0)
func |= GDK_FUNC_MINIMIZE;
if ((m_windowStyle & wxMAXIMIZE) == 0)
- func |= GDK_FUNC_MAXIMIZE;
-*/
+ func |= GDK_FUNC_MAXIMIZE; */
if ((m_windowStyle & wxSYSTEM_MENU) == 0)
decor |= GDK_DECOR_MENU;
if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
decor |= GDK_DECOR_MAXIMIZE;
if ((m_windowStyle & wxRESIZE_BORDER) == 0)
func |= GDK_FUNC_RESIZE;
+
gdk_window_set_decorations(m_widget->window, (GdkWMDecoration)decor);
gdk_window_set_functions(m_widget->window, (GdkWMFunction)func);
wxTopLevelWindows.DeleteObject( this );
if (wxTheApp->GetTopWindow() == this)
- {
wxTheApp->SetTopWindow( (wxWindow*) NULL );
- }
if (wxTopLevelWindows.Number() == 0)
- {
wxTheApp->ExitMainLoop();
- }
}
bool wxFrame::Show( bool show )
wxWindow::GetClientSize( width, height );
if (height)
{
- if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT;
+ if (m_frameMenuBar && !m_menuBarDetached) (*height) -= wxMENU_HEIGHT;
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
if (m_frameToolBar)
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
int h = height;
- if (m_frameMenuBar) h += wxMENU_HEIGHT;
+ if (m_frameMenuBar && !m_menuBarDetached) h += wxMENU_HEIGHT;
if (m_frameStatusBar) h += wxSTATUS_HEIGHT;
if (m_frameToolBar)
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge;
- int hh = wxMENU_HEIGHT;
+ int hh = 0;
+ if (!m_menuBarDetached) hh = wxMENU_HEIGHT;
m_frameMenuBar->m_x = xx;
m_frameMenuBar->m_y = yy;
m_frameMenuBar->m_width = ww;
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
- if ((m_frameMenuBar) || (m_mdiMenuBar)) yy += wxMENU_HEIGHT;
+ if (m_frameMenuBar && !m_menuBarDetached) yy += wxMENU_HEIGHT;
int ww = m_width - 2*m_miniEdge;
int hh = m_frameToolBar->m_height;
client_area_y_offset += hh;
}
- gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_wxwindow, 0, client_area_y_offset );
+ int client_x = m_miniEdge;
+ int client_y = client_area_y_offset + m_miniEdge + m_miniTitle;
+ gtk_myfixed_move( GTK_MYFIXED(m_mainWidget), m_wxwindow, client_x, client_y );
+
+ int client_w = m_width - 2*m_miniEdge;
+ int client_h = m_height - client_area_y_offset- 2*m_miniEdge - m_miniTitle;
+ gtk_widget_set_usize( m_wxwindow, client_w, client_h );
+ }
+ else
+ {
+ /* if there is no m_mainWidget between m_widget and m_wxwindow there
+ is no need to set the size or position of m_wxwindow. */
}
- gtk_widget_set_usize( m_wxwindow, m_width, m_height-client_area_y_offset );
-
if (m_frameStatusBar)
{
int xx = 0 + m_miniEdge;
m_frameMenuBar->m_parent = this;
gtk_myfixed_put( GTK_MYFIXED(m_mainWidget),
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
-
- /* an mdi child menu bar might be underneath */
- if (m_mdiMenuBar)
- m_frameMenuBar->Show( FALSE );
+
+ if (menuBar->m_windowStyle & wxMB_DOCKABLE)
+ {
+ gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_attached",
+ GTK_SIGNAL_FUNC(gtk_menu_attached_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(menuBar->m_widget), "child_detached",
+ GTK_SIGNAL_FUNC(gtk_menu_detached_callback), (gpointer)this );
+ }
}
}