standard (as e.g. wxStatusBar) */
m_owner = window;
-
+
if (m_owner && m_owner->m_wxwindow && (m_owner->GetLayoutDirection() == wxLayout_RightToLeft))
{
// reverse sense
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
gdk_gc_set_fill( m_textGC, GDK_SOLID );
-
+
gdk_gc_set_colormap( m_textGC, m_cmap );
/* m_penGC */
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 );
}
int w = bitmap.GetWidth();
int h = bitmap.GetHeight();
-
+
if (m_owner && m_owner->GetLayoutDirection() == wxLayout_RightToLeft)
xx -= w;
-
+
CalcBoundingBox( x, y );
CalcBoundingBox( x + w, y + h );
xsrc = source->LogicalToDeviceX(xsrc);
ysrc = source->LogicalToDeviceY(ysrc);
+ wxBitmap selected;
wxMemoryDC *memDC = wxDynamicCast(source, wxMemoryDC);
- wxBitmap selected = source->GetSelectedBitmap();
-
+ if ( memDC )
+ {
+ selected = memDC->GetSelectedBitmap();
+ if ( !selected.IsOk() )
+ return false;
+ }
+
bool use_bitmap_method = false;
bool is_mono = false;
ysrcMask = ysrc;
}
- if (memDC && !selected.Ok()) return false;
-
if (selected.Ok())
{
is_mono = (selected.GetDepth() == 1);
GdkWindow* window = source->GetGDKWindow();
if ( !window )
return false;
-
+
// copy including child window contents
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
gdk_draw_drawable( m_window, m_penGC,
return;
size_t datalen = strlen(data);
- // 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;
char *hackstring = NULL;
if (needshack)
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 );
void wxWindowDC::DoGetTextExtent(const wxString &string,
wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading,
- wxFont *theFont) const
+ const wxFont *theFont) const
{
if ( width )
*width = 0;
}
// Reset old font description
- if (theFont)
+ if (theFont->IsOk())
pango_layout_set_font_description( m_layout, m_fontdesc );
}
}
pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) );
-
+
// Calculate the position of each character based on the widths of
// the previous characters
{
pango_layout_iter_get_cluster_extents(iter, NULL, &pos);
int position = PANGO_PIXELS(pos.x);
- size_t curIndex = pango_layout_iter_get_index(iter);
widths[i++] = position;
}
while (i < len)
wxCoord wxWindowDC::GetCharHeight() const
{
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;
}
void wxWindowDC::Clear()
{
m_deviceOriginX = x;
m_deviceOriginY = y;
-
+
ComputeScaleAndOrigin();
}
{
m_signX = (xLeftRight ? 1 : -1);
m_signY = (yBottomUp ? -1 : 1);
-
+
if (m_owner && m_owner->m_wxwindow && (m_owner->GetLayoutDirection() == wxLayout_RightToLeft))
- m_signX = -m_signX;
-
+ m_signX = -m_signX;
+
ComputeScaleAndOrigin();
}