fixed GTK styles handling:
1. don't modify the style unless something changed 2. use gtk_widget_modify_style instead of gtk_widget_set_style, the latter is not recommended by GTK+ developers git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -92,6 +92,14 @@ wxSize wxControl::DoGetBestSize() const
|
||||
void wxControl::PostCreation(const wxSize& size)
|
||||
{
|
||||
wxWindow::PostCreation();
|
||||
|
||||
// NB: GetBestSize needs to know the style, otherwise it will assume
|
||||
// default font and if the user uses a different font, determined
|
||||
// best size will be different (typically, smaller) than the desired
|
||||
// size. This call ensure that a style is available at the time
|
||||
// GetBestSize is called.
|
||||
gtk_widget_ensure_style(m_widget);
|
||||
|
||||
InheritAttributes();
|
||||
ApplyWidgetStyle();
|
||||
SetInitialBestSize(size);
|
||||
@@ -259,6 +267,21 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustm
|
||||
return attr;
|
||||
}
|
||||
|
||||
void wxControl::ApplyWidgetStyle()
|
||||
{
|
||||
GtkRcStyle *style = CreateWidgetStyle();
|
||||
if ( style )
|
||||
{
|
||||
DoApplyWidgetStyle(style);
|
||||
gtk_rc_style_unref(style);
|
||||
}
|
||||
}
|
||||
|
||||
void wxControl::DoApplyWidgetStyle(GtkRcStyle *style)
|
||||
{
|
||||
gtk_widget_modify_style(m_widget, style);
|
||||
}
|
||||
|
||||
|
||||
#endif // wxUSE_CONTROLS
|
||||
|
||||
|
Reference in New Issue
Block a user