support SetBackgroundMode and SetTextBackground with GTK+2
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20783 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1451,6 +1451,8 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
#endif
|
#endif
|
||||||
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
|
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
|
||||||
|
|
||||||
|
int w,h;
|
||||||
|
|
||||||
if (m_scaleY != 1.0)
|
if (m_scaleY != 1.0)
|
||||||
{
|
{
|
||||||
// If there is a user or actually any scale applied to
|
// If there is a user or actually any scale applied to
|
||||||
@@ -1465,6 +1467,14 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
// actually apply scaled font
|
// actually apply scaled font
|
||||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||||
|
|
||||||
|
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||||
|
if ( m_backgroundMode == wxSOLID )
|
||||||
|
{
|
||||||
|
gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
|
||||||
|
gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
|
||||||
|
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
|
||||||
|
}
|
||||||
|
|
||||||
// Draw layout.
|
// Draw layout.
|
||||||
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
||||||
|
|
||||||
@@ -1476,19 +1486,17 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||||
|
if ( m_backgroundMode == wxSOLID )
|
||||||
|
{
|
||||||
|
gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
|
||||||
|
gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
|
||||||
|
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
|
||||||
|
}
|
||||||
// Draw layout.
|
// Draw layout.
|
||||||
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Measure layout
|
|
||||||
int w,h;
|
|
||||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
|
||||||
#else
|
|
||||||
int w = 10;
|
|
||||||
int h = 10;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxCoord width = w;
|
wxCoord width = w;
|
||||||
wxCoord height = h;
|
wxCoord height = h;
|
||||||
|
|
||||||
|
@@ -1451,6 +1451,8 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
#endif
|
#endif
|
||||||
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
|
pango_layout_set_text( m_layout, (const char*) data, strlen( (const char*) data ));
|
||||||
|
|
||||||
|
int w,h;
|
||||||
|
|
||||||
if (m_scaleY != 1.0)
|
if (m_scaleY != 1.0)
|
||||||
{
|
{
|
||||||
// If there is a user or actually any scale applied to
|
// If there is a user or actually any scale applied to
|
||||||
@@ -1465,6 +1467,14 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
// actually apply scaled font
|
// actually apply scaled font
|
||||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||||
|
|
||||||
|
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||||
|
if ( m_backgroundMode == wxSOLID )
|
||||||
|
{
|
||||||
|
gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
|
||||||
|
gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
|
||||||
|
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
|
||||||
|
}
|
||||||
|
|
||||||
// Draw layout.
|
// Draw layout.
|
||||||
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
||||||
|
|
||||||
@@ -1476,19 +1486,17 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||||
|
if ( m_backgroundMode == wxSOLID )
|
||||||
|
{
|
||||||
|
gdk_gc_set_foreground(m_textGC, m_textBackgroundColour.GetColor());
|
||||||
|
gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
|
||||||
|
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
|
||||||
|
}
|
||||||
// Draw layout.
|
// Draw layout.
|
||||||
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Measure layout
|
|
||||||
int w,h;
|
|
||||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
|
||||||
#else
|
|
||||||
int w = 10;
|
|
||||||
int h = 10;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxCoord width = w;
|
wxCoord width = w;
|
||||||
wxCoord height = h;
|
wxCoord height = h;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user