Fix setting fonts and colours for wxToggleButton with bitmaps in wxGTK.

Apply the fixes of r54138 to wxToggleButton too, the problem of #3939 was not
specific to just plain wxButtons.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75643 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-01-19 12:57:35 +00:00
parent dfe2e8c1e1
commit 0e53ae9eb0
2 changed files with 19 additions and 1 deletions

View File

@@ -599,6 +599,7 @@ wxGTK:
- Fix mouse wheel scrolling in wxListCtrl broken just before 3.0.0.
- Fix memory leak in wxSocket.
- Fix raw access to wxBitmap pixels after drawing on it using wxMemoryDC.
- Fix setting font and colours of wxToggleButtons with images.
wxMSW:

View File

@@ -22,6 +22,7 @@
#include <gtk/gtk.h>
#include "wx/gtk/private.h"
#include "wx/gtk/private/list.h"
extern bool g_blockEventsOnDrag;
@@ -213,7 +214,23 @@ GtkLabel *wxToggleButton::GTKGetLabel() const
void wxToggleButton::DoApplyWidgetStyle(GtkRcStyle *style)
{
GTKApplyStyle(m_widget, style);
GTKApplyStyle(gtk_bin_get_child(GTK_BIN(m_widget)), style);
GtkWidget* child = gtk_bin_get_child(GTK_BIN(m_widget));
GTKApplyStyle(child, style);
// for buttons with images, the path to the label is (at least in 2.12)
// GtkButton -> GtkAlignment -> GtkHBox -> GtkLabel
if ( GTK_IS_ALIGNMENT(child) )
{
GtkWidget* box = gtk_bin_get_child(GTK_BIN(child));
if ( GTK_IS_BOX(box) )
{
wxGtkList list(gtk_container_get_children(GTK_CONTAINER(box)));
for (GList* item = list; item; item = item->next)
{
GTKApplyStyle(GTK_WIDGET(item->data), style);
}
}
}
}
// Get the "best" size for this control.