]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/tglbtn.mm
don't duplicate GSocket creation/destruction and shutdown code in BSD and Winsock...
[wxWidgets.git] / src / osx / cocoa / tglbtn.mm
index d638d955f8443deda2076044a6487ad26f1a2f80..5db9b8e456099aa374f9bcb4f6feef201d23d13f 100644 (file)
@@ -34,15 +34,11 @@ wxWidgetImplType* wxWidgetImpl::CreateToggleButton( wxWindowMac* wxpeer,
                                     long style, 
                                     long extraStyle)
 {
                                     long style, 
                                     long extraStyle)
 {
-    NSView* sv = (wxpeer->GetParent()->GetHandle() );
-    
-    NSRect r = wxToNSRect( sv, wxRect( pos, size) );
-    // Rect bounds = wxMacGetBoundsForControl( wxpeer, pos , size ) ;
+    NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
     wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
     
     [v setBezelStyle:NSRoundedBezelStyle];    
     [v setButtonType:NSOnOffButton];
     wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
     
     [v setBezelStyle:NSRoundedBezelStyle];    
     [v setButtonType:NSOnOffButton];
-    [sv addSubview:v];
     wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
     [v setImplementation:c];
     return c;
     wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
     [v setImplementation:c];
     return c;
@@ -57,15 +53,11 @@ wxWidgetImplType* wxWidgetImpl::CreateBitmapToggleButton( wxWindowMac* wxpeer,
                                     long style, 
                                     long extraStyle)
 {    
                                     long style, 
                                     long extraStyle)
 {    
-    NSView* sv = (wxpeer->GetParent()->GetHandle() );
-    
-    NSRect r = wxToNSRect( sv, wxRect( pos, size) );
-    // Rect bounds = wxMacGetBoundsForControl( wxpeer, pos , size ) ;
+    NSRect r = wxOSXGetFrameForControl( wxpeer, pos , size ) ;
     wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
     
     [v setBezelStyle:NSRegularSquareBezelStyle];
     [v setButtonType:NSOnOffButton];
     wxNSButton* v = [[wxNSButton alloc] initWithFrame:r];
     
     [v setBezelStyle:NSRegularSquareBezelStyle];
     [v setButtonType:NSOnOffButton];
-    [sv addSubview:v];
     wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
     [v setImplementation:c];
     return c;
     wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
     [v setImplementation:c];
     return c;