- wxWindowID id, const wxString &title,
- const wxPoint &pos, const wxSize &size,
- long style, const wxString &name )
-{
- m_needParent = FALSE;
-
- PreCreation( parent, id, pos, size, style, name );
-
- m_modalShowing = ((m_windowStyle & wxDIALOG_MODAL) == wxDIALOG_MODAL);
-
- m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
- GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
-
- gtk_widget_set( m_widget, "GtkWindow::allow_shrink", TRUE, NULL);
-
- gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
- GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this );
-
- 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_widget), m_wxwindow );
-
- SetTitle( title );
-
- PostCreation();
-
- return TRUE;
-};
-
-wxDialog::~wxDialog(void)
-{
- wxTopLevelWindows.DeleteObject( this );
- if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
-};
-
-void wxDialog::SetTitle(const wxString& title )
-{
- m_title = title;
- gtk_window_set_title( GTK_WINDOW(m_widget), m_title );
-};
-
-wxString wxDialog::GetTitle(void) const
-{
- return (wxString&)m_title;
-};
+ 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_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+
+ gtk_widget_set( m_widget, "GtkWindow::allow_shrink", TRUE, NULL);
+
+ gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
+ GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this );
+
+ 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_widget), m_wxwindow );
+
+ SetTitle( title );
+
+ 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_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
+ GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
+ GTK_SIGNAL_FUNC(gtk_dialog_configure_callback), (gpointer)this );
+
+ return TRUE;
+}
+
+wxDialog::~wxDialog()
+{
+ wxTopLevelWindows.DeleteObject( this );
+
+ if (wxTheApp->GetTopWindow() == this)
+ {
+ wxTheApp->SetTopWindow( (wxWindow*) NULL );
+ }
+
+ if (wxTopLevelWindows.Number() == 0)
+ {
+ wxTheApp->ExitMainLoop();
+ }
+}
+
+void wxDialog::SetTitle( const wxString& title )
+{
+ m_title = title;
+ if (m_title.IsNull()) m_title = _T("");
+ gtk_window_set_title( GTK_WINDOW(m_widget), m_title.mbc_str() );
+}
+
+wxString wxDialog::GetTitle() const
+{
+ return (wxString&)m_title;
+}