gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
gdk_gc_set_fill( m_textGC, GDK_SOLID );
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
gdk_gc_set_fill( m_textGC, GDK_SOLID );
{
wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") );
m_owner->GetSize(width, height);
}
{
wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") );
m_owner->GetSize(width, height);
}
-extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
- const wxColour & col, int style);
-
-bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y,
+bool wxGTKWindowImplDC::DoFloodFill(wxCoord x, wxCoord y,
return wxDoFloodFill(this, x, y, col, style);
return wxDoFloodFill(this, x, y, col, style);
wxImage image = bitmap.ConvertToImage();
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
return true;
wxImage image = bitmap.ConvertToImage();
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
return true;
-void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
+void wxGTKWindowImplDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
-void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
+void wxGTKWindowImplDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
-void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea )
+void wxGTKWindowImplDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double sa, double ea )
-void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
+void wxGTKWindowImplDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset )
-void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int WXUNUSED(fillStyle) )
+void wxGTKWindowImplDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int WXUNUSED(fillStyle) )
-void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+void wxGTKWindowImplDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-2, hh-2 );
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx-1, yy-1, ww, hh );
}
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-2, hh-2 );
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx-1, yy-1, ww, hh );
}
// reset
gdk_gc_set_line_attributes( m_penGC, 2, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND );
}
// reset
gdk_gc_set_line_attributes( m_penGC, 2, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND );
}
-void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
+void wxGTKWindowImplDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
-void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+void wxGTKWindowImplDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
// VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
DoDrawBitmap( (const wxBitmap&)icon, x, y, true );
}
{
// VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
DoDrawBitmap( (const wxBitmap&)icon, x, y, true );
}
if ((w != ww) || (h != hh))
use_bitmap = use_bitmap.Rescale( 0, 0, ww, hh, ww, hh );
if ((w != ww) || (h != hh))
use_bitmap = use_bitmap.Rescale( 0, 0, ww, hh, ww, hh );
// NB: We can't render pixbufs with GTK+ < 2.2, we need to use pixmaps code.
// Pixbufs-based bitmaps with alpha channel don't have a mask, so we
// have to call GetPixmap() here -- it converts the pixbuf into pixmap
// and also creates the mask as a side-effect:
// NB: We can't render pixbufs with GTK+ < 2.2, we need to use pixmaps code.
// Pixbufs-based bitmaps with alpha channel don't have a mask, so we
// have to call GetPixmap() here -- it converts the pixbuf into pixmap
// and also creates the mask as a side-effect:
wxCoord width, wxCoord height,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxCoord width, wxCoord height,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
// copy including child window contents
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
gdk_draw_drawable( m_window, m_penGC,
// copy including child window contents
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
gdk_draw_drawable( m_window, m_penGC,
- // TODO: as soon as Pango provides a function to check at runtime its
- // version, we can use it to disable the underline hack for
- // Pango >= 1.16 as the "underline of leading/trailing spaces"
- // has been fixed there
- bool needshack = underlined;
+ // in Pango >= 1.16 the "underline of leading/trailing spaces" bug
+ // has been fixed and thus the hack implemented below should never be used
+ static bool pangoOk = !wx_pango_version_check(1, 16, 0);
+
+ bool needshack = underlined && !pangoOk;
gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
}
gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
}
// Draw layout.
if (m_owner && m_owner->GetLayoutDirection() == wxLayout_RightToLeft)
gdk_draw_layout( m_window, m_textGC, x-w, y, m_layout );
// Draw layout.
if (m_owner && m_owner->GetLayoutDirection() == wxLayout_RightToLeft)
gdk_draw_layout( m_window, m_textGC, x-w, y, m_layout );
-void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
+void wxGTKWindowImplDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y, double angle )
// update the bounding box
CalcBoundingBox(x + minX, y + minY);
CalcBoundingBox(x + maxX, y + maxY);
// update the bounding box
CalcBoundingBox(x + minX, y + minY);
CalcBoundingBox(x + maxX, y + maxY);
wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading,
wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading,
{
PangoFontMetrics *metrics = pango_context_get_metrics (m_context, m_fontdesc, pango_context_get_language(m_context));
{
PangoFontMetrics *metrics = pango_context_get_metrics (m_context, m_fontdesc, pango_context_get_language(m_context));
- return PANGO_PIXELS (pango_font_metrics_get_descent (metrics) + pango_font_metrics_get_ascent (metrics));
+ wxCHECK_MSG( metrics, -1, _T("failed to get pango font metrics") );
+
+ wxCoord h = PANGO_PIXELS (pango_font_metrics_get_descent (metrics) +
+ pango_font_metrics_get_ascent (metrics));
+ pango_font_metrics_unref (metrics);
+ return h;
{
/* CMB 21/7/98: Added SetBackground. Sets background brush
* for Clear() and bg colour for shapes filled with cross-hatch brush */
{
/* CMB 21/7/98: Added SetBackground. Sets background brush
* for Clear() and bg colour for shapes filled with cross-hatch brush */
-void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
+void wxGTKWindowImplDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
// Limit the paint region to the window size. Sometimes
// the paint region is too big, and this risks X11 errors
// Limit the paint region to the window size. Sometimes
// the paint region is too big, and this risks X11 errors