fixed DoGetBestSize() for default buttons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26550 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -149,8 +149,6 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
|
|
||||||
SetSize( new_size );
|
SetSize( new_size );
|
||||||
|
|
||||||
Show( TRUE );
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,8 +208,25 @@ void wxButton::ApplyWidgetStyle()
|
|||||||
|
|
||||||
wxSize wxButton::DoGetBestSize() const
|
wxSize wxButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
|
// the default button in wxGTK is bigger than the other ones because of an
|
||||||
|
// extra border around it, but we don't want to take it into account in
|
||||||
|
// our size calculations (otherwsie the result is visually ugly), so
|
||||||
|
// always return the size of non default button from here
|
||||||
|
const bool isDefault = GTK_WIDGET_HAS_DEFAULT(m_widget);
|
||||||
|
if ( isDefault )
|
||||||
|
{
|
||||||
|
// temporarily unset default flag
|
||||||
|
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_DEFAULT );
|
||||||
|
}
|
||||||
|
|
||||||
wxSize ret( wxControl::DoGetBestSize() );
|
wxSize ret( wxControl::DoGetBestSize() );
|
||||||
|
|
||||||
|
if ( isDefault )
|
||||||
|
{
|
||||||
|
// set it back again
|
||||||
|
GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef __WXGTK20__
|
#ifndef __WXGTK20__
|
||||||
ret.x += 10; // add a few pixels for sloppy (but common) themes
|
ret.x += 10; // add a few pixels for sloppy (but common) themes
|
||||||
#endif
|
#endif
|
||||||
|
@@ -149,8 +149,6 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
|
|
||||||
SetSize( new_size );
|
SetSize( new_size );
|
||||||
|
|
||||||
Show( TRUE );
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,8 +208,25 @@ void wxButton::ApplyWidgetStyle()
|
|||||||
|
|
||||||
wxSize wxButton::DoGetBestSize() const
|
wxSize wxButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
|
// the default button in wxGTK is bigger than the other ones because of an
|
||||||
|
// extra border around it, but we don't want to take it into account in
|
||||||
|
// our size calculations (otherwsie the result is visually ugly), so
|
||||||
|
// always return the size of non default button from here
|
||||||
|
const bool isDefault = GTK_WIDGET_HAS_DEFAULT(m_widget);
|
||||||
|
if ( isDefault )
|
||||||
|
{
|
||||||
|
// temporarily unset default flag
|
||||||
|
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_DEFAULT );
|
||||||
|
}
|
||||||
|
|
||||||
wxSize ret( wxControl::DoGetBestSize() );
|
wxSize ret( wxControl::DoGetBestSize() );
|
||||||
|
|
||||||
|
if ( isDefault )
|
||||||
|
{
|
||||||
|
// set it back again
|
||||||
|
GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef __WXGTK20__
|
#ifndef __WXGTK20__
|
||||||
ret.x += 10; // add a few pixels for sloppy (but common) themes
|
ret.x += 10; // add a few pixels for sloppy (but common) themes
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user