- if (!win->HasVMT()) return;
-
- win->m_toolBarDetached = TRUE;
- win->m_sizeSet = FALSE;
-}
-
-//-----------------------------------------------------------------------------
-// "configure_event"
-//-----------------------------------------------------------------------------
-
-static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
-{
- if (!win->HasVMT()) return FALSE;
-
- win->m_x = event->x;
- win->m_y = event->y;
-
- wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
- mevent.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( mevent );
-
- return FALSE;
-}
-
-//-----------------------------------------------------------------------------
-// InsertChild for wxFrame
-//-----------------------------------------------------------------------------
-
-/* 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 wxWindows requires different ways to insert
- * a child in container classes. */
-
-static void wxInsertChildInFrame( wxWindow* parent, wxWindow* child )
-{
- 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),
- GTK_WIDGET(child->m_widget),
- child->m_x,
- child->m_y );
-
- /* we connect to these events for recalculating the client area
- space when the toolbar is floating */
- if (wxIS_KIND_OF(child,wxToolBar))
- {
- wxToolBar *toolBar = (wxToolBar*) child;
- if (toolBar->m_windowStyle & wxTB_DOCKABLE)
- {
- gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_attached",
- GTK_SIGNAL_FUNC(gtk_toolbar_attached_callback), (gpointer)parent );
-
- gtk_signal_connect( GTK_OBJECT(toolBar->m_widget), "child_detached",
- GTK_SIGNAL_FUNC(gtk_toolbar_detached_callback), (gpointer)parent );
- }
- }
- }
- else
- {
- /* these are inside the client area */
- gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
- GTK_WIDGET(child->m_widget),
- child->m_x,
- child->m_y );
- }
-
- gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
- child->m_width,
- child->m_height );
-
- /* resize on OnInternalIdle */
- parent->m_sizeSet = FALSE;
-
- if (parent->m_windowStyle & wxTAB_TRAVERSAL)
- {
- /* we now allow a window to get the focus as long as it
- doesn't have any children. */
- GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS );
- }
-}
-
-//-----------------------------------------------------------------------------
-// wxFrame
-//-----------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(wxFrame, wxWindow)
- EVT_SIZE(wxFrame::OnSize)
- EVT_CLOSE(wxFrame::OnCloseWindow)
- EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
-END_EVENT_TABLE()
-
-IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
-
-wxFrame::wxFrame()
-{
- m_frameMenuBar = (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;
- m_insertCallback = wxInsertChildInFrame;
-}
-
-wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
- const wxPoint &pos, const wxSize &size,
- long style, const wxString &name )
-{
- m_frameMenuBar = (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;
- m_insertCallback = wxInsertChildInFrame;
- Create( parent, id, title, pos, size, style, name );
-}
-
-bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
- const wxPoint &pos, const wxSize &size,
- long style, const wxString &name )
-{
- wxTopLevelWindows.Append( this );
-
- m_needParent = FALSE;
-
- PreCreation( parent, id, pos, size, style, name );
-
- m_title = title;
-
- m_insertCallback = wxInsertChildInFrame;
-
- GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
- if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
-
- m_widget = gtk_window_new( win_type );
-
- gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
- GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
-
- gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
- GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this );
-
- /* m_mainWidget holds the toolbar, the menubar and the client area */
- m_mainWidget = gtk_myfixed_new();
- gtk_widget_show( m_mainWidget );
- GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
- gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
- gtk_widget_realize( m_mainWidget );
-
- /* m_wxwindow only represents the client area without toolbar and menubar */
- m_wxwindow = gtk_myfixed_new();
- gtk_widget_show( m_wxwindow );
- GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
- gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow );
-
- if (m_parent) m_parent->AddChild( this );
-
- PostCreation();
-
- gtk_widget_realize( m_widget );
-
- /* all this is for Motif Window Manager "hints" and is supposed to be
- 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)
- func |= GDK_FUNC_MINIMIZE;
- if ((m_windowStyle & wxMAXIMIZE) == 0)
- func |= GDK_FUNC_MAXIMIZE; */
- if ((m_windowStyle & wxSYSTEM_MENU) == 0)
- decor |= GDK_DECOR_MENU;
- if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
- decor |= GDK_DECOR_MINIMIZE;
- if ((m_windowStyle & wxMAXIMIZE_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);
-
- /* GTK's shrinking/growing policy */
- if ((m_windowStyle & wxRESIZE_BORDER) == 0)
- gtk_window_set_policy(GTK_WINDOW(m_widget), 0, 0, 1);
- else
- gtk_window_set_policy(GTK_WINDOW(m_widget), 1, 1, 1);
-
- /* the user resized the frame by dragging etc. */
- gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
- GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
-
- /* the only way to get the window size is to connect to this event */
- gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
- GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
-
- return TRUE;