Ticket #9858 gtk wxDC::DrawText() - draw text background natively
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55144 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1366,7 +1366,7 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
wxCHECK_RET( m_layout, wxT("no Pango layout") );
|
wxCHECK_RET( m_layout, wxT("no Pango layout") );
|
||||||
wxCHECK_RET( m_fontdesc, wxT("no Pango font description") );
|
wxCHECK_RET( m_fontdesc, wxT("no Pango font description") );
|
||||||
|
|
||||||
gdk_pango_context_set_colormap( m_context, m_cmap );
|
gdk_pango_context_set_colormap( m_context, m_cmap ); // not needed in gtk+ >= 2.6
|
||||||
|
|
||||||
bool underlined = m_font.IsOk() && m_font.GetUnderlined();
|
bool underlined = m_font.IsOk() && m_font.GetUnderlined();
|
||||||
|
|
||||||
@@ -1449,18 +1449,17 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
pango_layout_get_pixel_size(m_layout, &w, &h);
|
pango_layout_get_pixel_size(m_layout, &w, &h);
|
||||||
if (m_backgroundMode == wxBRUSHSTYLE_SOLID)
|
|
||||||
{
|
|
||||||
gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
|
|
||||||
gdk_draw_rectangle(m_gdkwindow, m_textGC, true, x, y, w, h);
|
|
||||||
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw layout.
|
// Draw layout.
|
||||||
int x_rtl = x;
|
int x_rtl = x;
|
||||||
if (m_window && m_window->GetLayoutDirection() == wxLayout_RightToLeft)
|
if (m_window && m_window->GetLayoutDirection() == wxLayout_RightToLeft)
|
||||||
x_rtl -= w;
|
x_rtl -= w;
|
||||||
gdk_draw_layout(m_gdkwindow, m_textGC, x_rtl, y, m_layout);
|
|
||||||
|
const GdkColor* bg_col = NULL;
|
||||||
|
if (m_backgroundMode == wxBRUSHSTYLE_SOLID)
|
||||||
|
bg_col = m_textBackgroundColour.GetColor();
|
||||||
|
|
||||||
|
gdk_draw_layout_with_colors(m_gdkwindow, m_textGC, x_rtl, y, m_layout, NULL, bg_col);
|
||||||
|
|
||||||
if (isScaled)
|
if (isScaled)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user