]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/window.cpp
Added WIN16 code for window disabler
[wxWidgets.git] / src / gtk1 / window.cpp
index 805201a26c6fc6ce9522d953aa3b5b88af599b60..7525485937a69e5d7fd184398383c2502f399b04 100644 (file)
@@ -208,6 +208,8 @@ extern bool g_mainThreadLocked;
 // debug
 //-----------------------------------------------------------------------------
 
+#define DISABLE_STYLE_IF_BROKEN_THEME 1
+
 #ifdef __WXDEBUG__
 
 #if wxUSE_THREADS
@@ -612,11 +614,8 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
 {
     DEBUG_MAIN_THREAD
 
-    if (!win->m_hasVMT)
-        return;
-
 /*
-    if (win->GetName() == wxT("columntitles"))
+    if (win->GetName() == wxT("grid window"))
     {
         wxPrintf( wxT("OnExpose from ") );
         if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -637,6 +636,9 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
     if (gdk_event->count > 0)
         return;
 
+    if (!win->m_hasVMT)
+        return;
+
     wxEraseEvent eevent( win->GetId() );
     eevent.SetEventObject( win );
     win->GetEventHandler()->ProcessEvent(eevent);
@@ -659,9 +661,12 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
 
     if (g_isIdle)
         wxapp_install_idle_handler();
+        
+    if ((rect->x == 0) && (rect->y == 0) && (rect->width <= 1) && (rect->height <= 1))
+        return;
 
 /*
-    if ((win->GetName() == wxT("columntitles")) && (rect->x == 2))
+    if (win->GetName() == wxT("grid window"))
     {
         wxPrintf( wxT("OnDraw from ") );
         if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -676,6 +681,9 @@ static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget),
     win->GetUpdateRegion().Union( rect->x, rect->y,
                                   rect->width, rect->height );
 
+    if (!win->m_hasVMT)
+        return;
+
     wxEraseEvent eevent( win->GetId() );
     eevent.SetEventObject( win );
     win->GetEventHandler()->ProcessEvent(eevent);
@@ -2151,10 +2159,11 @@ wxWindow::~wxWindow()
 
     if (m_widgetStyle)
     {
+#if DISABLE_STYLE_IF_BROKEN_THEME
         // don't delete if it's a pixmap theme style
         if (!m_widgetStyle->engine_data)
             gtk_style_unref( m_widgetStyle );
-            
+#endif            
         m_widgetStyle = (GtkStyle*) NULL;
     }
 
@@ -3047,6 +3056,7 @@ GtkStyle *wxWindow::GetWidgetStyle()
 
 void wxWindow::SetWidgetStyle()
 {
+#if DISABLE_STYLE_IF_BROKEN_THEM
     if (m_widget->style->engine_data)
     {
         static bool s_warningPrinted = FALSE;
@@ -3058,6 +3068,7 @@ void wxWindow::SetWidgetStyle()
         m_widgetStyle = m_widget->style;
         return;
     }
+#endif
 
     GtkStyle *style = GetWidgetStyle();
 
@@ -3438,6 +3449,60 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
     wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
 
     wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
+    
+    if ((dx == 0) && (dy == 0)) return;
 
     gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
+    
+/*    
+    if (m_children.GetCount() > 0)
+    {
+        gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
+    }
+    else
+    {
+        GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
+    
+        pizza->xoffset -= dx;
+        pizza->yoffset -= dy;
+        
+        GdkGC *m_scrollGC = gdk_gc_new( pizza->bin_window );
+        gdk_gc_set_exposures( m_scrollGC, TRUE );
+
+        int cw = 0;
+        int ch = 0;
+        GetClientSize( &cw, &ch );
+        int w = cw - abs(dx);
+        int h = ch - abs(dy);
+
+        if ((h < 0) || (w < 0))
+        {
+            Refresh();
+        } 
+        else
+        {
+            int s_x = 0;
+            int s_y = 0;
+            if (dx < 0) s_x = -dx;
+            if (dy < 0) s_y = -dy;
+            int d_x = 0;
+            int d_y = 0;
+            if (dx > 0) d_x = dx;
+            if (dy > 0) d_y = dy;
+
+            gdk_window_copy_area( pizza->bin_window, m_scrollGC, d_x, d_y,
+                pizza->bin_window, s_x, s_y, w, h );
+
+            wxRect rect;
+            if (dx < 0) rect.x = cw+dx; else rect.x = 0;
+            if (dy < 0) rect.y = ch+dy; else rect.y = 0;
+            if (dy != 0) rect.width = cw; else rect.width = abs(dx);
+            if (dx != 0) rect.height = ch; else rect.height = abs(dy);
+
+            Refresh( TRUE, &rect );
+        }
+        
+        gdk_gc_unref( m_scrollGC );
+    }
+*/
 }