From 4644cfba416e5bd16548747f865dc971ba47d8ef Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 11 Jun 2009 16:00:01 +0000 Subject: [PATCH] account for the label size in wxDisclosureTriangle under Carbon git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/button_osx.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/osx/button_osx.cpp b/src/osx/button_osx.cpp index 3dc35b6975..6428e4842a 100644 --- a/src/osx/button_osx.cpp +++ b/src/osx/button_osx.cpp @@ -44,7 +44,7 @@ bool wxButton::Create(wxWindow *parent, return false; m_labelOrig = m_label = label ; - + m_peer = wxWidgetImpl::CreateButton( this, parent, id, label, pos, size, style, GetExtraStyle() ); MacPostControlCreate( pos, size ); @@ -95,9 +95,9 @@ bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxStrin m_peer = wxWidgetImpl::CreateDisclosureTriangle(this, parent, id, label, pos, size, style, GetExtraStyle() ); MacPostControlCreate( pos, size ); - // passing the text in the param doesn't seem to work, so lets do if again + // passing the text in the param doesn't seem to work, so lets do it again SetLabel( label ); - + return true; } @@ -123,6 +123,14 @@ bool wxDisclosureTriangle::OSXHandleClicked( double WXUNUSED(timestampsec) ) wxSize wxDisclosureTriangle::DoGetBestSize() const { - return wxWindow::DoGetBestSize(); + wxSize size = wxWindow::DoGetBestSize(); + + // under Carbon the base class GetBestSize() implementation doesn't seem to + // take the label into account at all, correct for it here +#if wxOSX_USE_CARBON + size.x += GetTextExtent(GetLabel()).x; +#endif // wxOSX_USE_CARBON + + return size; } -- 2.45.2