// local defines
//-----------------------------------------------------------------------------
-#define USE_PAINT_REGION 1
+// VZ: what is this for exactly??
+#define USE_PAINT_REGION 0
//-----------------------------------------------------------------------------
// local data
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
-wxWindowDC::wxWindowDC()
+void wxWindowDC::Init()
{
m_display = (WXDisplay *) NULL;
m_penGC = (WXGC *) NULL;
m_owner = (wxWindow *)NULL;
#if wxUSE_UNICODE
- m_context = (PangoContext *)NULL;
+ m_context = wxTheApp->GetPangoContext();
m_fontdesc = (PangoFontDescription *)NULL;
#endif
}
{
wxASSERT_MSG( window, wxT("DC needs a window") );
- m_display = (WXDisplay *) NULL;
- m_penGC = (WXGC *) NULL;
- m_brushGC = (WXGC *) NULL;
- m_textGC = (WXGC *) NULL;
- m_bgGC = (WXGC *) NULL;
- m_cmap = (WXColormap *) NULL;
- m_owner = (wxWindow *)NULL;
- m_isMemDC = false;
- m_isScreenDC = false;
+ Init();
+
m_font = window->GetFont();
m_window = (WXWindow*) window->GetMainWindow();
m_display = (WXDisplay *) wxGlobalDisplay();
#if wxUSE_UNICODE
- m_context = wxTheApp->GetPangoContext();
m_fontdesc = window->GetFont().GetNativeFontInfo()->description;
#endif
}
void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
- wxCoord xoffset, wxCoord yoffset, int fillStyle )
+ wxCoord xoffset, wxCoord yoffset,
+ int WXUNUSED(fillStyle) )
{
wxCHECK_RET( Ok(), wxT("invalid window dc") );
if (!m_window) return false;
// transform the source DC coords to the device ones
- xsrc = source->XLOG2DEV(xsrc);
- ysrc = source->YLOG2DEV(ysrc);
+ xsrc = source->LogicalToDeviceX(xsrc);
+ ysrc = source->LogicalToDeviceY(ysrc);
wxClientDC *srcDC = (wxClientDC*)source;
wxMemoryDC *memDC = (wxMemoryDC*)source;
slen = strlen(text);
XCharStruct overall_return;
- (void)XTextExtents(xfont, (char*) text.c_str(), slen, &direction,
+ (void)XTextExtents(xfont, (const char*) text.c_str(), slen, &direction,
&ascent, &descent, &overall_return);
cx = overall_return.width;
#endif
}
-void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
+void wxWindowDC::DoDrawRotatedText(const wxString& WXUNUSED(text),
+ wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
+ double WXUNUSED(angle))
{
- // later
+ wxFAIL_MSG( "not implemented" );
}
void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading,
- wxFont *font ) const
+ const wxFont *font ) const
{
wxCHECK_RET( Ok(), wxT("invalid dc") );
int direction, ascent, descent2;
XCharStruct overall;
- XTextExtents( xfont, (char*) string.c_str(), string.length(), &direction,
+ XTextExtents( xfont, (const char*) string.c_str(), string.length(), &direction,
&ascent, &descent2, &overall);
if (width)
m_font = font;
- return;
-
#if wxUSE_UNICODE
m_fontdesc = font.GetNativeFontInfo()->description;
#endif
}
}
-void wxWindowDC::SetPalette( const wxPalette& palette )
+void wxWindowDC::SetPalette( const wxPalette& WXUNUSED(palette) )
{
#if 0
if (m_window)
if (!m_window) return;
+ if (width <= 0)
+ width = 1;
+
+ if (height <= 0)
+ height = 1;
+
wxRect rect;
rect.x = XLOG2DEV(x);
rect.y = YLOG2DEV(y);
rect.width = XLOG2DEVREL(width);
rect.height = YLOG2DEVREL(height);
- if (!m_currentClippingRegion.IsNull())
+ if (!m_currentClippingRegion.IsEmpty())
m_currentClippingRegion.Intersect( rect );
else
- m_currentClippingRegion.Union( rect );
+ m_currentClippingRegion = rect;
#if USE_PAINT_REGION
- if (!m_paintClippingRegion.IsNull())
+ if (!m_paintClippingRegion.IsEmpty())
m_currentClippingRegion.Intersect( m_paintClippingRegion );
#endif
if (!m_window) return;
- if (!m_currentClippingRegion.IsNull())
+ if (!m_currentClippingRegion.IsEmpty())
m_currentClippingRegion.Intersect( region );
else
- m_currentClippingRegion.Union( region );
+ m_currentClippingRegion = region;
#if USE_PAINT_REGION
- if (!m_paintClippingRegion.IsNull())
+ if (!m_paintClippingRegion.IsEmpty())
m_currentClippingRegion.Intersect( m_paintClippingRegion );
#endif