]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dialog.cpp
basic support for encodings for wxMSW::wxFont
[wxWidgets.git] / src / gtk1 / dialog.cpp
index 68afab7f746b3c6cacb7c44e02bfdcac559f7182..4869b9263fc1f904b46aabb49269f06b9b9fcb6e 100644 (file)
 #include "gdk/gdk.h"
 #include "gtk/gtk.h"
 #include "wx/gtk/win_gtk.h"
+#include "wx/cursor.h"
+
+/*
+#include "gdk/gdkprivate.h"
+#include "gdk/gdkx.h"
+*/
 
 //-----------------------------------------------------------------------------
 // idle system
@@ -32,6 +38,33 @@ extern bool g_isIdle;
 
 extern wxList wxPendingDelete;
 
+/*
+//-----------------------------------------------------------------------------
+// instruct X to set the WM hint for positioning
+//-----------------------------------------------------------------------------
+
+extern "C" {
+
+static void gdk_window_set_position_hint( GdkWindow *window, gint x, gint y )
+{
+  GdkWindowPrivate *priv;
+  XSizeHints size_hints;
+  
+  g_return_if_fail (window != NULL);
+  
+  priv = (GdkWindowPrivate*) window;
+  if (priv->destroyed) return;
+  
+  size_hints.flags = PPosition;
+  size_hints.x = x;
+  size_hints.y = y;
+   
+  XSetWMNormalHints (priv->xdisplay, priv->xwindow, &size_hints);
+}
+
+}
+*/
+
 //-----------------------------------------------------------------------------
 // "delete_event"
 //-----------------------------------------------------------------------------
@@ -69,19 +102,28 @@ static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation
 // "configure_event"
 //-----------------------------------------------------------------------------
 
-static gint gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDialog *win )
+static gint 
+#if (GTK_MINOR_VERSON > 0)
+gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDialog *win )
+#else
+gtk_dialog_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxDialog *win )
+#endif
 {
     if (g_isIdle) 
         wxapp_install_idle_handler();
 
     if (!win->m_hasVMT) return FALSE;
 
+#if (GTK_MINOR_VERSON > 0)
     int x = 0;
     int y = 0;
     gdk_window_get_root_origin( win->m_widget->window, &x, &y );
-    
     win->m_x = x;
     win->m_y = y;
+#else
+    win->m_x = event->x;
+    win->m_y = event->y;
+#endif
 
     wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() );
     mevent.SetEventObject( win );
@@ -108,6 +150,10 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win )
        position in "realize" and "map" */
     gtk_widget_set_uposition( widget, win->m_x, win->m_y );
 
+/*
+    gdk_window_set_position_hint( widget->window, win->m_x, win->m_y );
+*/
+
     /* reset the icon */
     if (win->m_icon != wxNullIcon)
     {
@@ -239,7 +285,12 @@ bool wxDialog::Create( wxWindow *parent,
 
     m_needParent = FALSE;
 
-    PreCreation( parent, id, pos, size, style, name );
+    if (!PreCreation( parent, pos, size ) ||
+        !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
+    {
+        wxFAIL_MSG( _T("wxDialog creation failed") );
+       return FALSE;
+    }
 
     m_insertCallback = (wxInsertChildFunction) wxInsertChildInDialog;
     
@@ -531,6 +582,8 @@ void wxDialog::OnInternalIdle()
 {
     if (!m_sizeSet && GTK_WIDGET_REALIZED(m_wxwindow))
         GtkOnSize( m_x, m_y, m_width, m_height );
+
+    wxWindow::OnInternalIdle();
 }
 
 bool wxDialog::Show( bool show )
@@ -581,6 +634,8 @@ int wxDialog::ShowModal()
        return GetReturnCode();
     }
 
+    wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
+    
     Show( TRUE );
 
     m_modalShowing = TRUE;