]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/checkbox.mm
new VC++ project files with both dll and lib in one project
[wxWidgets.git] / src / cocoa / checkbox.mm
index 5181c7ceda7ee5b79575965be08dff8962a22e38..1dfd1f63314935f20636309167bec24a80af1fec 100644 (file)
@@ -13,6 +13,8 @@
 #include "wx/checkbox.h"
 #include "wx/log.h"
 
+#include "wx/cocoa/autorelease.h"
+
 #import <AppKit/NSButton.h>
 #import <Foundation/NSString.h>
 
@@ -29,11 +31,11 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID winid,
            const wxValidator& validator,
            const wxString& name)
 {
+    wxAutoNSAutoreleasePool pool;
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
     m_cocoaNSView = NULL;
-    NSRect cocoaRect = NSMakeRect(10,10,20,20);
-    SetNSButton([[NSButton alloc] initWithFrame: cocoaRect]);
+    SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
     [m_cocoaNSView release];
     [GetNSButton() setButtonType: NSSwitchButton];
     [GetNSButton() setTitle:[NSString stringWithCString: label.c_str()]];
@@ -41,13 +43,14 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID winid,
 
     if(m_parent)
         m_parent->CocoaAddChild(this);
+    SetInitialFrameRect(pos,size);
+
     return true;
 }
 
 wxCheckBox::~wxCheckBox()
 {
-    CocoaRemoveFromParent();
-    SetNSButton(NULL);
+    DisassociateNSButton(m_cocoaNSView);
 }
 
 void wxCheckBox::SetValue(bool)