]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
= replaced with ==
[wxWidgets.git] / src / gtk1 / window.cpp
index fb798b8e5c500dd8729b8795bb1d02b9cce0ecc6..5c6a1422e1daa164bc9f291ca154f987075e2449 100644 (file)
@@ -303,7 +303,7 @@ static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *g
 }
 
 //-----------------------------------------------------------------------------
-// "draw" of m_wxwindow
+// "draw" of m_widget
 //-----------------------------------------------------------------------------
 
 static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
@@ -1766,6 +1766,8 @@ void wxWindow::Init()
     m_hasVMT = FALSE;
     m_needParent = TRUE;
     m_isBeingDeleted = FALSE;
+    
+    m_noExpose = FALSE;
 
     m_hasScrolling = FALSE;
     m_isScrolling = FALSE;
@@ -1776,7 +1778,6 @@ void wxWindow::Init()
     m_oldVerticalPos = 0.0;
 
     m_resizing = FALSE;
-    m_scrollGC = (GdkGC*) NULL;
     m_widgetStyle = (GtkStyle*) NULL;
 
     m_insertCallback = (wxInsertChildFunction) NULL;
@@ -1977,12 +1978,6 @@ wxWindow::~wxWindow()
         m_widgetStyle = (GtkStyle*) NULL;
     }
 
-    if (m_scrollGC)
-    {
-        gdk_gc_unref( m_scrollGC );
-        m_scrollGC = (GdkGC*) NULL;
-    }
-
     if (m_wxwindow)
     {
         gtk_widget_destroy( m_wxwindow );
@@ -2034,12 +2029,15 @@ void wxWindow::PostCreation()
 
     if (m_wxwindow)
     {
-        /* these get reported to wxWindows -> wxPaintEvent */
-        gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
-          GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
+        if (!m_noExpose)
+       {
+            /* these get reported to wxWindows -> wxPaintEvent */
+            gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
+                GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
 
-       gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
-          GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+            gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
+                GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+       }
          
 #if (GTK_MINOR_VERSION > 0)
         /* these are called when the "sunken" or "raised" borders are drawn */
@@ -2665,50 +2663,44 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )
         }
     }
 
+    /* there is no GTK equivalent of "draw only, don't clear" so we
+       invent our own in the GtkMyFixed widget */
+
     if (!rect)
     {
         if (m_wxwindow)
        {
-           /* call the callback directly for preventing GTK from
-              clearing the background */
-           int w = 0;
-           int h = 0;
-           GetClientSize( &w, &h );
+           GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow);
+           gboolean old_clear = myfixed->clear_on_draw;
+           gtk_my_fixed_set_clear( myfixed, FALSE );
            
-            GetUpdateRegion().Union( 0, 0, w, h );
-            wxPaintEvent event( GetId() );
-            event.SetEventObject( this );
-            GetEventHandler()->ProcessEvent( event );
-            GetUpdateRegion().Clear();
+            gtk_widget_draw( m_wxwindow, (GdkRectangle*) NULL );
+           
+           gtk_my_fixed_set_clear( myfixed, old_clear );
        }
         else
-       {
             gtk_widget_draw( m_widget, (GdkRectangle*) NULL );
-       }
     }
     else
     {
+        GdkRectangle gdk_rect;
+        gdk_rect.x = rect->x;
+        gdk_rect.y = rect->y;
+        gdk_rect.width = rect->width;
+        gdk_rect.height = rect->height;
 
         if (m_wxwindow)
        {
-           /* call the callback directly for preventing GTK from
-              clearing the background */
-            GetUpdateRegion().Union( rect->x, rect->y, rect->width, rect->height );
-            wxPaintEvent event( GetId() );
-            event.SetEventObject( this );
-            GetEventHandler()->ProcessEvent( event );
-            GetUpdateRegion().Clear();
+           GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow);
+           gboolean old_clear = myfixed->clear_on_draw;
+           gtk_my_fixed_set_clear( myfixed, FALSE );
+           
+            gtk_widget_draw( m_wxwindow, &gdk_rect );
+           
+           gtk_my_fixed_set_clear( myfixed, old_clear );
        }
         else
-       {
-            GdkRectangle gdk_rect;
-            gdk_rect.x = rect->x;
-            gdk_rect.y = rect->y;
-            gdk_rect.width = rect->width;
-            gdk_rect.height = rect->height;
-           
             gtk_widget_draw( m_widget, &gdk_rect );
-       }
     }
 }