Several wxBitmapDataCell changes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41540 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2006-09-30 21:21:19 +00:00
parent 38f82bf695
commit 2586d4a121
4 changed files with 97 additions and 7 deletions

View File

@@ -25,6 +25,8 @@
#include "wx/stockitem.h"
#include "wx/calctrl.h"
#include "wx/popupwin.h"
#include "wx/icon.h"
#include "wx/gtk/private.h"
#include "wx/gtk/win_gtk.h"
@@ -980,14 +982,30 @@ bool wxDataViewBitmapCell::SetValue( const wxVariant &value )
{
if (value.GetType() == wxT("wxBitmap"))
{
// We could also use the type safe wxGetVariantCast here
const wxBitmap *bitmap = (const wxBitmap*) value.GetWxObjectPtr();
if (!bitmap)
return false;
wxBitmap bitmap;
bitmap << value;
// This may create a Pixbuf representation in the
// wxBitmap object (and it will stay there)
GdkPixbuf *pixbuf = bitmap->GetPixbuf();
GdkPixbuf *pixbuf = bitmap.GetPixbuf();
GValue gvalue = { 0, };
g_value_init( &gvalue, G_TYPE_OBJECT );
g_value_set_object( &gvalue, pixbuf );
g_object_set_property( G_OBJECT(m_renderer), "pixbuf", &gvalue );
g_value_unset( &gvalue );
return true;
}
if (value.GetType() == wxT("wxIcon"))
{
wxIcon bitmap;
bitmap << value;
// This may create a Pixbuf representation in the
// wxBitmap object (and it will stay there)
GdkPixbuf *pixbuf = bitmap.GetPixbuf();
GValue gvalue = { 0, };
g_value_init( &gvalue, G_TYPE_OBJECT );