/////////////////////////////////////////////////////////////////////////////
-// 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>
// 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];
}
}
-static GdkGC* wxGetPoolGC( GdkWindow *window, bool mono=FALSE )
+static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
{
for (int i = 0; i < 200; i++)
{
{
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;
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 );
}
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 */
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 );
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 */
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 );
wxPaintDC::wxPaintDC( wxWindow *win )
: wxWindowDC( win )
{
-/*
if (!win->GetUpdateRegion().IsEmpty())
{
m_paintClippingRegion = win->GetUpdateRegion();
gdk_gc_set_clip_region( m_textGC, m_paintClippingRegion.GetRegion() );
gdk_gc_set_clip_region( m_bgGC, m_paintClippingRegion.GetRegion() );
}
-*/
}
//-----------------------------------------------------------------------------