- m_ok = TRUE;
- m_logicalFunction = wxCOPY;
- if (m_penGC) gdk_gc_unref( m_penGC );
- m_penGC = gdk_gc_new( m_window );
- if (m_brushGC) gdk_gc_unref( m_brushGC );
- m_brushGC = gdk_gc_new( m_window );
- if (m_textGC) gdk_gc_unref( m_textGC );
- m_textGC = gdk_gc_new( m_window );
- if (m_bgGC) gdk_gc_unref( m_bgGC );
- m_bgGC = gdk_gc_new( m_window );
- SetTextForeground( m_textForegroundColour );
- SetTextBackground( m_textBackgroundColour );
- SetPen( m_pen );
- SetFont( m_font );
- SetBrush( m_brush );
-
- gdk_gc_set_background( m_penGC, wxWHITE->GetColor() );
-
- if (!hatch_bitmap)
- {
- hatch_bitmap = hatches;
- hatch_bitmap[0] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, bdiag_bits, bdiag_width, bdiag_height );
- hatch_bitmap[1] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, cdiag_bits, cdiag_width, cdiag_height );
- hatch_bitmap[2] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, fdiag_bits, fdiag_width, fdiag_height );
- hatch_bitmap[3] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, cross_bits, cross_width, cross_height );
- hatch_bitmap[4] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, horiz_bits, horiz_width, horiz_height );
- hatch_bitmap[5] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, verti_bits, verti_width, verti_height );
- }
+ Destroy();
+ m_ok = TRUE;
+ m_logicalFunction = wxCOPY;
+ m_penGC = gdk_gc_new( m_window );
+ m_brushGC = gdk_gc_new( m_window );
+ m_textGC = gdk_gc_new( m_window );
+ m_bgGC = gdk_gc_new( m_window );
+
+ wxColour tmp_col( m_textForegroundColour );
+ m_textForegroundColour = wxNullColour;
+ SetTextForeground( tmp_col );
+ tmp_col = m_textBackgroundColour;
+ m_textBackgroundColour = wxNullColour;
+ SetTextBackground( tmp_col );
+
+ wxPen tmp_pen( m_pen );
+ m_pen = wxNullPen;
+ SetPen( tmp_pen );
+
+ wxFont tmp_font( m_font );
+ m_font = wxNullFont;
+ SetFont( tmp_font );
+
+ wxBrush tmp_brush( m_brush );
+ m_brush = wxNullBrush;
+ SetBrush( tmp_brush );
+
+ tmp_brush = m_backgroundBrush;
+ m_backgroundBrush = wxNullBrush;
+ SetBackground( tmp_brush );
+
+ if (!hatch_bitmap)
+ {
+ hatch_bitmap = hatches;
+ hatch_bitmap[0] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, bdiag_bits, bdiag_width, bdiag_height );
+ hatch_bitmap[1] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, cdiag_bits, cdiag_width, cdiag_height );
+ hatch_bitmap[2] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, fdiag_bits, fdiag_width, fdiag_height );
+ hatch_bitmap[3] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, cross_bits, cross_width, cross_height );
+ hatch_bitmap[4] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, horiz_bits, horiz_width, horiz_height );
+ hatch_bitmap[5] = gdk_bitmap_create_from_data( (GdkWindow *) NULL, verti_bits, verti_width, verti_height );
+ }
+}
+
+void wxWindowDC::Destroy()
+{
+ if (m_penGC) gdk_gc_unref( m_penGC );
+ m_penGC = (GdkGC*) NULL;
+ if (m_brushGC) gdk_gc_unref( m_brushGC );
+ m_brushGC = (GdkGC*) NULL;
+ if (m_textGC) gdk_gc_unref( m_textGC );
+ m_textGC = (GdkGC*) NULL;
+ if (m_bgGC) gdk_gc_unref( m_bgGC );
+ m_bgGC = (GdkGC*) NULL;