#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/app.h"
+
+#include "gdk/gdk.h"
+#include "gtk/gtk.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
win->GtkOnSize( alloc->x, alloc->y, alloc->width, alloc->height );
}
+//-----------------------------------------------------------------------------
+// "configure_event"
+//-----------------------------------------------------------------------------
+
+static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxDialog *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;
+}
+
//-----------------------------------------------------------------------------
// wxDialog
//-----------------------------------------------------------------------------
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
- GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
-
m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow );
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
gtk_widget_set_usize( m_widget, m_width, m_height );
+ 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 );
+
if (m_parent) m_parent->AddChild( this );
-
PostCreation();
return TRUE;
wxDialog::~wxDialog()
{
wxTopLevelWindows.DeleteObject( this );
- if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
+
+ if (wxTheApp->GetTopWindow() == this)
+ {
+ wxTheApp->SetTopWindow( (wxWindow*) NULL );
+ }
+
+ if (wxTopLevelWindows.Number() == 0)
+ {
+ wxTheApp->ExitMainLoop();
+ }
}
void wxDialog::SetTitle( const wxString& title )
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
+ if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
+ if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
gtk_widget_set_usize( m_widget, m_width, m_height );
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
+ if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
+ if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
if ((m_x != -1) || (m_y != -1))
{