Fix wxDataViewIconTextRenderer background on GTK
Background attribute needs to be set on the icon renderer as well. See #19301
This commit is contained in:
@@ -216,6 +216,7 @@ protected:
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewTextRenderer
|
||||
{
|
||||
typedef wxDataViewTextRenderer BaseType;
|
||||
public:
|
||||
static wxString GetDefaultType() { return wxS("wxDataViewIconText"); }
|
||||
|
||||
@@ -230,6 +231,7 @@ public:
|
||||
virtual void GtkPackIntoColumn(GtkTreeViewColumn *column) wxOVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual void SetAttr(const wxDataViewItemAttr& attr) wxOVERRIDE;
|
||||
virtual wxVariant GtkGetValueFromString(const wxString& str) const wxOVERRIDE;
|
||||
|
||||
private:
|
||||
|
||||
@@ -3136,6 +3136,26 @@ bool wxDataViewIconTextRenderer::GetValue(wxVariant& value) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxDataViewIconTextRenderer::SetAttr(const wxDataViewItemAttr& attr)
|
||||
{
|
||||
BaseType::SetAttr(attr);
|
||||
|
||||
if (attr.HasBackgroundColour())
|
||||
{
|
||||
#ifdef __WXGTK3__
|
||||
const GdkRGBA* rbga = attr.GetBackgroundColour();
|
||||
g_object_set(G_OBJECT(m_rendererIcon), "cell-background-rgba", rbga, NULL);
|
||||
#else
|
||||
const GdkColor* color = attr.GetBackgroundColour().GetColor();
|
||||
g_object_set(G_OBJECT(m_rendererIcon), "cell-background-gdk", color, NULL);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
g_object_set(G_OBJECT(m_rendererIcon), "cell-background-set", false, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
wxVariant
|
||||
wxDataViewIconTextRenderer::GtkGetValueFromString(const wxString& str) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user