]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/stattext.mm
Remove incorrect and unnecessary wxEntryCleanup declaration.
[wxWidgets.git] / src / cocoa / stattext.mm
index 88574eeb03a61bc1d5b9aa1d3b2239623104cf4e..ff30c7cb2f1f82769e84de6a793b8a11720a0705 100644 (file)
 #include "wx/app.h"
 #include "wx/stattext.h"
 
+#include "wx/cocoa/autorelease.h"
+
 #import <Foundation/NSString.h>
 #import <AppKit/NSTextField.h>
+#include <math.h>
 
 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;