X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0c8701abdbeba07683df2a04b397a55f92306756..cc4d5638c66a409e421420ed7110917755a66788:/src/gtk1/dcclient.cpp diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 9ee0908a4c..d0a7c12aba 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -2,7 +2,6 @@ // Name: src/gtk1/dcclient.cpp // Purpose: // Author: Robert Roebling -// RCS-ID: $Id$ // Copyright: (c) 1998 Robert Roebling, Chris Breeze // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -90,9 +89,9 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable, gint width, gint height) { - wxCHECK_RET( drawable, _T("NULL drawable in gdk_wx_draw_bitmap") ); - wxCHECK_RET( src, _T("NULL src in gdk_wx_draw_bitmap") ); - wxCHECK_RET( gc, _T("NULL gc in gdk_wx_draw_bitmap") ); + wxCHECK_RET( drawable, wxT("NULL drawable in gdk_wx_draw_bitmap") ); + wxCHECK_RET( src, wxT("NULL src in gdk_wx_draw_bitmap") ); + wxCHECK_RET( gc, wxT("NULL gc in gdk_wx_draw_bitmap") ); GdkWindowPrivate *drawable_private; GdkWindowPrivate *src_private; @@ -241,7 +240,7 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type ) // The realloc failed. Fall through to error. wxFAIL_MSG( wxT("No GC available") ); - return (GdkGC*) NULL; + return NULL; } static void wxFreePoolGC( GdkGC *gc ) @@ -267,14 +266,14 @@ IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxDC) wxWindowDCImpl::wxWindowDCImpl(wxDC *owner) : wxGTKDCImpl(owner) { - m_penGC = (GdkGC *) NULL; - m_brushGC = (GdkGC *) NULL; - m_textGC = (GdkGC *) NULL; - m_bgGC = (GdkGC *) NULL; - m_cmap = (GdkColormap *) NULL; + m_penGC = NULL; + m_brushGC = NULL; + m_textGC = NULL; + m_bgGC = NULL; + m_cmap = NULL; m_isMemDC = false; m_isScreenDC = false; - m_owner = (wxWindow *)NULL; + m_owner = NULL; } wxWindowDCImpl::wxWindowDCImpl(wxDC *owner, wxWindow *window) @@ -282,12 +281,12 @@ wxWindowDCImpl::wxWindowDCImpl(wxDC *owner, wxWindow *window) { wxASSERT_MSG( window, wxT("DC needs a window") ); - m_penGC = (GdkGC *) NULL; - m_brushGC = (GdkGC *) NULL; - m_textGC = (GdkGC *) NULL; - m_bgGC = (GdkGC *) NULL; - m_cmap = (GdkColormap *) NULL; - m_owner = (wxWindow *)NULL; + m_penGC = NULL; + m_brushGC = NULL; + m_textGC = NULL; + m_bgGC = NULL; + m_cmap = NULL; + m_owner = NULL; m_isMemDC = false; m_isScreenDC = false; m_font = window->GetFont(); @@ -404,26 +403,26 @@ void wxWindowDCImpl::SetUpDC() gdk_gc_set_function( m_penGC, GDK_COPY ); /* clipping */ - gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL ); - gdk_gc_set_clip_rectangle( m_brushGC, (GdkRectangle *) NULL ); - gdk_gc_set_clip_rectangle( m_textGC, (GdkRectangle *) NULL ); - gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL ); + gdk_gc_set_clip_rectangle( m_penGC, NULL ); + gdk_gc_set_clip_rectangle( m_brushGC, NULL ); + gdk_gc_set_clip_rectangle( m_textGC, NULL ); + gdk_gc_set_clip_rectangle( m_bgGC, NULL ); 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 ); + hatch_bitmap[0] = gdk_bitmap_create_from_data( NULL, bdiag_bits, bdiag_width, bdiag_height ); + hatch_bitmap[1] = gdk_bitmap_create_from_data( NULL, cdiag_bits, cdiag_width, cdiag_height ); + hatch_bitmap[2] = gdk_bitmap_create_from_data( NULL, fdiag_bits, fdiag_width, fdiag_height ); + hatch_bitmap[3] = gdk_bitmap_create_from_data( NULL, cross_bits, cross_width, cross_height ); + hatch_bitmap[4] = gdk_bitmap_create_from_data( NULL, horiz_bits, horiz_width, horiz_height ); + hatch_bitmap[5] = gdk_bitmap_create_from_data( NULL, verti_bits, verti_width, verti_height ); } } void wxWindowDCImpl::DoGetSize( int* width, int* height ) const { - wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") ); + wxCHECK_RET( m_owner, wxT("GetSize() doesn't work without window") ); m_owner->GetSize(width, height); } @@ -649,7 +648,7 @@ void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y ) CalcBoundingBox (x, y); } -void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset ) +void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset ) { wxCHECK_RET( IsOk(), wxT("invalid window dc") ); @@ -680,7 +679,7 @@ void wxWindowDCImpl::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCo delete[] gpts; } -void wxWindowDCImpl::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode WXUNUSED(fillStyle) ) +void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[], wxCoord xoffset, wxCoord yoffset, wxPolygonFillMode WXUNUSED(fillStyle) ) { wxCHECK_RET( IsOk(), wxT("invalid window dc") ); @@ -1004,7 +1003,7 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, { wxCHECK_RET( IsOk(), wxT("invalid window dc") ); - wxCHECK_RET( bitmap.Ok(), wxT("invalid bitmap") ); + wxCHECK_RET( bitmap.IsOk(), wxT("invalid bitmap") ); bool is_mono = (bitmap.GetBitmap() != NULL); @@ -1044,10 +1043,10 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, use_bitmap.GetPixmap(); // apply mask if any - GdkBitmap *mask = (GdkBitmap *) NULL; + GdkBitmap *mask = NULL; if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap(); - GdkBitmap *new_mask = (GdkBitmap*) NULL; + GdkBitmap *new_mask = NULL; if (useMask && mask) { @@ -1107,14 +1106,14 @@ void wxWindowDCImpl::DoDrawBitmap( const wxBitmap &bitmap, { if (is_mono) { - gdk_gc_set_clip_mask( m_textGC, (GdkBitmap *) NULL ); + gdk_gc_set_clip_mask( m_textGC, NULL ); gdk_gc_set_clip_origin( m_textGC, 0, 0 ); if (!m_currentClippingRegion.IsNull()) gdk_gc_set_clip_region( m_textGC, m_currentClippingRegion.GetRegion() ); } else { - gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL ); + gdk_gc_set_clip_mask( m_penGC, NULL ); gdk_gc_set_clip_origin( m_penGC, 0, 0 ); if (!m_currentClippingRegion.IsNull()) gdk_gc_set_clip_region( m_penGC, m_currentClippingRegion.GetRegion() ); @@ -1160,7 +1159,7 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, if (srcDC->m_isMemDC) { - if (!memDC->m_selected.Ok()) return false; + if (!memDC->m_selected.IsOk()) return false; is_mono = (memDC->m_selected.GetDepth() == 1); @@ -1267,10 +1266,10 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, } // apply mask if any - GdkBitmap *mask = (GdkBitmap *) NULL; + GdkBitmap *mask = NULL; if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap(); - GdkBitmap *new_mask = (GdkBitmap*) NULL; + GdkBitmap *new_mask = NULL; if (useMask && mask) { @@ -1343,14 +1342,14 @@ bool wxWindowDCImpl::DoBlit( wxCoord xdest, wxCoord ydest, { if (is_mono) { - gdk_gc_set_clip_mask( m_textGC, (GdkBitmap *) NULL ); + gdk_gc_set_clip_mask( m_textGC, NULL ); gdk_gc_set_clip_origin( m_textGC, 0, 0 ); if (!m_currentClippingRegion.IsNull()) gdk_gc_set_clip_region( m_textGC, m_currentClippingRegion.GetRegion() ); } else { - gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL ); + gdk_gc_set_clip_mask( m_penGC, NULL ); gdk_gc_set_clip_origin( m_penGC, 0, 0 ); if (!m_currentClippingRegion.IsNull()) gdk_gc_set_clip_region( m_penGC, m_currentClippingRegion.GetRegion() ); @@ -1650,7 +1649,7 @@ void wxWindowDCImpl::SetPen( const wxPen &pen ) m_pen = pen; - if (!m_pen.Ok()) return; + if (!m_pen.IsOk()) return; if (!m_window) return; @@ -1733,7 +1732,7 @@ void wxWindowDCImpl::SetPen( const wxPen &pen ) default: { lineStyle = GDK_LINE_SOLID; - req_dash = (wxGTKDash*)NULL; + req_dash = NULL; req_nb_dash = 0; break; } @@ -1800,7 +1799,7 @@ void wxWindowDCImpl::SetBrush( const wxBrush &brush ) m_brush = brush; - if (!m_brush.Ok()) return; + if (!m_brush.IsOk()) return; if (!m_window) return; @@ -1809,7 +1808,7 @@ void wxWindowDCImpl::SetBrush( const wxBrush &brush ) gdk_gc_set_fill( m_brushGC, GDK_SOLID ); - if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok())) + if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->IsOk())) { if (m_brush.GetStipple()->GetPixmap()) { @@ -1848,7 +1847,7 @@ void wxWindowDCImpl::SetBackground( const wxBrush &brush ) m_backgroundBrush = brush; - if (!m_backgroundBrush.Ok()) return; + if (!m_backgroundBrush.IsOk()) return; if (!m_window) return; @@ -1860,7 +1859,7 @@ void wxWindowDCImpl::SetBackground( const wxBrush &brush ) gdk_gc_set_fill( m_bgGC, GDK_SOLID ); - if ((m_backgroundBrush.GetStyle() == wxSTIPPLE) && (m_backgroundBrush.GetStipple()->Ok())) + if ((m_backgroundBrush.GetStyle() == wxSTIPPLE) && (m_backgroundBrush.GetStipple()->IsOk())) { if (m_backgroundBrush.GetStipple()->GetPixmap()) { @@ -1937,7 +1936,7 @@ void wxWindowDCImpl::SetTextForeground( const wxColour &col ) // don't set m_textForegroundColour to an invalid colour as we'd crash // later then (we use m_textForegroundColour.GetColor() without checking // in a few places) - if ( !col.Ok() || (m_textForegroundColour == col) ) + if ( !col.IsOk() || (m_textForegroundColour == col) ) return; m_textForegroundColour = col; @@ -1954,7 +1953,7 @@ void wxWindowDCImpl::SetTextBackground( const wxColour &col ) wxCHECK_RET( IsOk(), wxT("invalid window dc") ); // same as above - if ( !col.Ok() || (m_textBackgroundColour == col) ) + if ( !col.IsOk() || (m_textBackgroundColour == col) ) return; m_textBackgroundColour = col; @@ -2070,10 +2069,10 @@ void wxWindowDCImpl::DestroyClippingRegion() if (m_currentClippingRegion.IsEmpty()) { - gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL ); - gdk_gc_set_clip_rectangle( m_brushGC, (GdkRectangle *) NULL ); - gdk_gc_set_clip_rectangle( m_textGC, (GdkRectangle *) NULL ); - gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL ); + gdk_gc_set_clip_rectangle( m_penGC, NULL ); + gdk_gc_set_clip_rectangle( m_brushGC, NULL ); + gdk_gc_set_clip_rectangle( m_textGC, NULL ); + gdk_gc_set_clip_rectangle( m_bgGC, NULL ); } else { @@ -2087,13 +2086,13 @@ void wxWindowDCImpl::DestroyClippingRegion() void wxWindowDCImpl::Destroy() { if (m_penGC) wxFreePoolGC( m_penGC ); - m_penGC = (GdkGC*) NULL; + m_penGC = NULL; if (m_brushGC) wxFreePoolGC( m_brushGC ); - m_brushGC = (GdkGC*) NULL; + m_brushGC = NULL; if (m_textGC) wxFreePoolGC( m_textGC ); - m_textGC = (GdkGC*) NULL; + m_textGC = NULL; if (m_bgGC) wxFreePoolGC( m_bgGC ); - m_bgGC = (GdkGC*) NULL; + m_bgGC = NULL; } void wxWindowDCImpl::ComputeScaleAndOrigin() @@ -2103,7 +2102,7 @@ void wxWindowDCImpl::ComputeScaleAndOrigin() wxGTKDCImpl::ComputeScaleAndOrigin(); // if scale has changed call SetPen to recalulate the line width - if ( wxRealPoint(m_scaleX, m_scaleY) != origScale && m_pen.Ok() ) + if ( wxRealPoint(m_scaleX, m_scaleY) != origScale && m_pen.IsOk() ) { // this is a bit artificial, but we need to force wxDC to think the pen // has changed @@ -2189,7 +2188,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl) wxClientDCImpl::wxClientDCImpl(wxDC *owner, wxWindow *win) : wxWindowDCImpl(owner, win) { - wxCHECK_RET( win, _T("NULL window in wxClientDCImpl::wxClientDCImpl") ); + wxCHECK_RET( win, wxT("NULL window in wxClientDCImpl::wxClientDCImpl") ); #ifdef __WXUNIVERSAL__ wxPoint ptOrigin = win->GetClientAreaOrigin(); @@ -2201,7 +2200,7 @@ wxClientDCImpl::wxClientDCImpl(wxDC *owner, wxWindow *win) void wxClientDCImpl::DoGetSize(int *width, int *height) const { - wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") ); + wxCHECK_RET( m_owner, wxT("GetSize() doesn't work without window") ); m_owner->GetClientSize( width, height ); }