X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1c54c79268ff605780cad4f13a6af9643ef0559a..84f6927eca931441abec9b6d21c0e412841eaab9:/src/cocoa/stattext.mm diff --git a/src/cocoa/stattext.mm b/src/cocoa/stattext.mm index ff30c7cb2f..ff04f5899a 100644 --- a/src/cocoa/stattext.mm +++ b/src/cocoa/stattext.mm @@ -9,10 +9,14 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// -#include "wx/app.h" -#include "wx/stattext.h" +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/app.h" + #include "wx/stattext.h" +#endif //WX_PRECOMP #include "wx/cocoa/autorelease.h" +#include "wx/cocoa/string.h" #import #import @@ -34,9 +38,9 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID winid, if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name)) return false; m_cocoaNSView = NULL; - SetNSTextField([[NSTextField alloc] initWithFrame:NSMakeRect(0,0,30,30)]); + SetNSTextField([[NSTextField alloc] initWithFrame:MakeDefaultNSRect(size)]); [m_cocoaNSView release]; - [GetNSTextField() setStringValue:[NSString stringWithCString:label.c_str()]]; + [GetNSTextField() setStringValue:wxNSStringWithWxString(label)]; // [GetNSTextField() setBordered: NO]; [GetNSTextField() setBezeled: NO]; [GetNSTextField() setEditable: NO]; @@ -50,12 +54,14 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID winid, if(m_parent) m_parent->CocoaAddChild(this); + SetInitialFrameRect(pos,size); + return true; } wxStaticText::~wxStaticText() { - DisassociateNSTextField(m_cocoaNSView); + DisassociateNSTextField(GetNSTextField()); } void wxStaticText::SetLabel(const wxString& label)