X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/570aaadf1ff3f8c3f8ecfea44dbeae64532c82c4..f3e28ade43cf9d6bd1c158280939870249cc9d2a:/src/cocoa/stattext.mm diff --git a/src/cocoa/stattext.mm b/src/cocoa/stattext.mm index 88574eeb03..ff30c7cb2f 100644 --- a/src/cocoa/stattext.mm +++ b/src/cocoa/stattext.mm @@ -12,8 +12,11 @@ #include "wx/app.h" #include "wx/stattext.h" +#include "wx/cocoa/autorelease.h" + #import #import +#include IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) BEGIN_EVENT_TABLE(wxStaticText, wxControl) @@ -27,6 +30,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID winid, long style, const wxString& name) { + wxAutoNSAutoreleasePool pool; if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name)) return false; m_cocoaNSView = NULL; @@ -37,7 +41,13 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID winid, [GetNSTextField() setBezeled: NO]; [GetNSTextField() setEditable: NO]; [GetNSTextField() setDrawsBackground: NO]; + [GetNSControl() sizeToFit]; + // Round-up to next integer size + NSRect nsrect = [m_cocoaNSView frame]; + nsrect.size.width = ceil(nsrect.size.width); + [m_cocoaNSView setFrameSize: nsrect.size]; + if(m_parent) m_parent->CocoaAddChild(this); return true;