#include "wx/fontutil.h"
#include "wx/gtk/win_gtk.h"
+#include "wx/gtk/private.h"
#include "wx/math.h" // for floating-point functions
for (int i = 0; i < wxGCPoolSize; i++)
{
if (wxGCPool[i].m_gc)
- gdk_gc_unref( wxGCPool[i].m_gc );
+ g_object_unref (G_OBJECT (wxGCPool[i].m_gc));
}
free(wxGCPool);
gdk_gc_set_fill( gc, GDK_OPAQUE_STIPPLED );
gdk_gc_set_stipple( gc, mask );
gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh );
- gdk_gc_unref( gc );
+ g_object_unref (G_OBJECT (gc));
}
if (is_mono)
gdk_draw_drawable( m_window, m_textGC, bitmap2, 0, 0, xx, yy, -1, -1 );
- gdk_bitmap_unref( bitmap2 );
- gdk_gc_unref( gc );
+ g_object_unref (G_OBJECT (bitmap2));
+ g_object_unref (G_OBJECT (gc));
}
else
{
else
#endif
{
- gdk_draw_pixmap(m_window, m_penGC,
- use_bitmap.GetPixmap(),
- 0, 0, xx, yy, -1, -1);
+ gdk_draw_drawable(m_window, m_penGC,
+ use_bitmap.GetPixmap(),
+ 0, 0, xx, yy, -1, -1);
}
}
}
if (new_mask)
- gdk_bitmap_unref( new_mask );
+ g_object_unref (G_OBJECT (new_mask));
}
bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
gdk_gc_set_fill( gc, GDK_OPAQUE_STIPPLED );
gdk_gc_set_stipple( gc, mask );
gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, bm_ww, bm_hh );
- gdk_gc_unref( gc );
+ g_object_unref (G_OBJECT (gc));
}
if (is_mono)
gdk_draw_drawable( m_window, m_textGC, bitmap, xsrc, ysrc, cx, cy, cw, ch );
- gdk_bitmap_unref( bitmap );
- gdk_gc_unref( gc );
+ g_object_unref (G_OBJECT (bitmap));
+ g_object_unref (G_OBJECT (gc));
}
else
{
- // was: gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), xsrc, ysrc, xx, yy, ww, hh );
- gdk_draw_pixmap( m_window, m_penGC, use_bitmap.GetPixmap(), xsrc, ysrc, cx, cy, cw, ch );
+ // was: gdk_draw_drawable( m_window, m_penGC, use_bitmap.GetPixmap(), xsrc, ysrc, xx, yy, ww, hh );
+ gdk_draw_drawable( m_window, m_penGC, use_bitmap.GetPixmap(), xsrc, ysrc, cx, cy, cw, ch );
}
// remove mask again if any
}
if (new_mask)
- gdk_bitmap_unref( new_mask );
+ g_object_unref (G_OBJECT (new_mask));
}
else // use_bitmap_method
{
wxBitmap bitmap = memDC->m_selected.Rescale( cx-xx, cy-yy, cw, ch, ww, hh );
// draw scaled bitmap
- // was: gdk_draw_pixmap( m_window, m_penGC, bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
- gdk_draw_pixmap( m_window, m_penGC, bitmap.GetPixmap(), 0, 0, cx, cy, -1, -1 );
+ // was: gdk_draw_drawable( m_window, m_penGC, bitmap.GetPixmap(), 0, 0, xx, yy, -1, -1 );
+ gdk_draw_drawable( m_window, m_penGC, bitmap.GetPixmap(), 0, 0, cx, cy, -1, -1 );
}
else
{
// copy including child window contents
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
- gdk_draw_pixmap( m_window, m_penGC,
- srcDC->GetWindow(),
- xsrc, ysrc, xx, yy,
- width, height );
+ gdk_draw_drawable( m_window, m_penGC,
+ srcDC->GetWindow(),
+ xsrc, ysrc, xx, yy,
+ width, height );
gdk_gc_set_subwindow( m_penGC, GDK_CLIP_BY_CHILDREN );
}
}
bool underlined = m_font.Ok() && m_font.GetUnderlined();
-#if wxUSE_UNICODE
- const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
-#else
- const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
- if ( !wdata )
+ const wxCharBuffer data = wxGTK_CONV( text );
+ if ( !data )
return;
- const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
-#endif
- size_t datalen = strlen((const char*)data);
- pango_layout_set_text( m_layout, (const char*) data, datalen);
+ const size_t datalen = strlen(data);
+ pango_layout_set_text( m_layout, data, datalen);
if (underlined)
{
*externalLeading = 0;
if (string.empty())
- {
return;
- }
- // Set new font description
- if (theFont)
- pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description );
+ // ensure that theFont is always non-NULL
+ if ( !theFont || !theFont->Ok() )
+ theFont = wx_const_cast(wxFont *, &m_font);
- // Set layout's text
-#if wxUSE_UNICODE
- const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
- const char *dataUTF8 = (const char *)data;
-#else
- const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
- if ( !wdata )
- return;
-
- const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
- const char *dataUTF8 = (const char *)data;
-#endif
+ // and use it if it's valid
+ if ( theFont->Ok() )
+ {
+ pango_layout_set_font_description
+ (
+ m_layout,
+ theFont->GetNativeFontInfo()->description
+ );
+ }
+ // Set layout's text
+ const wxCharBuffer dataUTF8 = wxGTK_CONV_FONT(string, *theFont);
if ( !dataUTF8 )
{
// hardly ideal, but what else can we do if conversion failed?