]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/dcclient.cpp
1. wxGridCellEditor::SetSize needs to use the wxSIZE_ALLOW_MINUS_ONE
[wxWidgets.git] / src / gtk1 / dcclient.cpp
index 294e9b890b91a2a9a355b8278390d1c27a759f35..45ce6c6dc5c7c08bebaaa3f8eaf4705ff36bbf42 100644 (file)
@@ -1,10 +1,10 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        dcclient.cpp
+// Name:        gtk/dcclient.cpp
 // Purpose:
 // Author:      Robert Roebling
 // RCS-ID:      $Id$
 // Copyright:   (c) 1998 Robert Roebling, Markus Holzem, Chris Breeze
-// Licence:           wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
 #include "wx/dcclient.h"
 #include "wx/dcmemory.h"
 #include "wx/image.h"
+#include "wx/module.h"
+
 #include "wx/gtk/win_gtk.h"
 
 #include <math.h>               // for floating-point functions
+
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
@@ -100,11 +103,24 @@ void gdk_draw_bitmap     (GdkDrawable  *drawable,
 // Implement Pool of Graphic contexts. Creating them takes too much time.
 //-----------------------------------------------------------------------------
 
+enum wxPoolGCType
+{
+   wxGC_ERROR = 0,
+   wxTEXT_MONO,
+   wxBG_MONO,
+   wxPEN_MONO,
+   wxBRUSH_MONO,
+   wxTEXT_COLOUR,
+   wxBG_COLOUR,
+   wxPEN_COLOUR,
+   wxBRUSH_COLOUR
+};
+
 struct wxGC
 {
-    GdkGC  *m_gc;
-    bool    m_mono;
-    bool    m_used;
+    GdkGC        *m_gc;
+    wxPoolGCType  m_type;
+    bool          m_used;
 };
 
 static wxGC wxGCPool[200];
@@ -123,7 +139,7 @@ static void wxCleanUpGCPool()
     }
 }
 
-static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE )
+static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
 {
     for (int i = 0; i < 200; i++)
     {
@@ -131,10 +147,10 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE )
         {
             wxGCPool[i].m_gc = gdk_gc_new( window );
             gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
-            wxGCPool[i].m_mono = mono;
+            wxGCPool[i].m_type = type;
             wxGCPool[i].m_used = FALSE;
         }
-        if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_mono == mono))
+        if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type))
         {
             wxGCPool[i].m_used = TRUE;
             return wxGCPool[i].m_gc;
@@ -654,6 +670,14 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
                 gdk_gc_set_fill( gc, GDK_OPAQUE_STIPPLED );
                 gdk_gc_set_stipple( gc, mask );
                 gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh );
+/*                
+                gdk_gc_set_clip_mask( m_brushGC, NULL );
+                gdk_gc_set_clip_mask( m_textGC, NULL );
+                SetBrush( *wxRED_BRUSH );
+                DrawRectangle( 70, 0, 70, 1000 );
+                gdk_draw_bitmap( m_window, m_textGC, new_mask, 0, 0, 100, 5, ww, hh );
+                gdk_draw_bitmap( m_window, m_textGC, mask, 0, 0, 80, 5, ww, hh );
+*/                
                 gdk_gc_unref( gc );
             }
         
@@ -1587,10 +1611,10 @@ void wxWindowDC::SetUpDC()
     
     if (!m_penGC)
     {
-        m_penGC = wxGetPoolGC( m_window );
-        m_brushGC = wxGetPoolGC( m_window );
-        m_textGC = wxGetPoolGC( m_window );
-        m_bgGC = wxGetPoolGC( m_window );
+        m_penGC = wxGetPoolGC( m_window, wxPEN_COLOUR );
+        m_brushGC = wxGetPoolGC( m_window, wxBRUSH_COLOUR );
+        m_textGC = wxGetPoolGC( m_window, wxTEXT_COLOUR );
+        m_bgGC = wxGetPoolGC( m_window, wxBG_COLOUR );
     }
 
     /* background colour */
@@ -1606,14 +1630,12 @@ void wxWindowDC::SetUpDC()
     gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
 
     gdk_gc_set_fill( m_textGC, GDK_SOLID );
-    gdk_gc_set_line_attributes( m_textGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
 
     /* m_penGC */
     m_pen.GetColour().CalcPixel( m_cmap );
     gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
     gdk_gc_set_background( m_penGC, bg_col );
     
-    gdk_gc_set_fill( m_penGC, GDK_SOLID );
     gdk_gc_set_line_attributes( m_penGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
 
     
@@ -1623,7 +1645,6 @@ void wxWindowDC::SetUpDC()
     gdk_gc_set_background( m_brushGC, bg_col );
     
     gdk_gc_set_fill( m_brushGC, GDK_SOLID );
-    gdk_gc_set_line_attributes( m_brushGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
     
     
     /* m_bgGC */
@@ -1631,13 +1652,11 @@ void wxWindowDC::SetUpDC()
     gdk_gc_set_foreground( m_bgGC, bg_col );
 
     gdk_gc_set_fill( m_bgGC, GDK_SOLID );
-    gdk_gc_set_line_attributes( m_bgGC, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_ROUND );
   
     /* ROPs */
     gdk_gc_set_function( m_textGC, GDK_COPY );
     gdk_gc_set_function( m_brushGC, GDK_COPY );
     gdk_gc_set_function( m_penGC, GDK_COPY );
-    gdk_gc_set_function( m_bgGC, GDK_COPY );
     
     /* clipping */
     gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL );
@@ -1886,7 +1905,6 @@ wxPaintDC::wxPaintDC()
 wxPaintDC::wxPaintDC( wxWindow *win )
   : wxWindowDC( win )
 {
-/*
     if (!win->GetUpdateRegion().IsEmpty())
     {
         m_paintClippingRegion = win->GetUpdateRegion();
@@ -1897,7 +1915,6 @@ wxPaintDC::wxPaintDC( wxWindow *win )
         gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
         gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
     }
-*/
 }
 
 //-----------------------------------------------------------------------------