]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/NSButton.mm
fix for get best size when having empty labels
[wxWidgets.git] / src / cocoa / NSButton.mm
index 11027892aa451d5a880cffb52678eeca7f613d82..63cf30df2f37dff30e62d253ce07080f0c0b3427 100644 (file)
@@ -22,6 +22,8 @@
     #include "wx/log.h"
 #endif // WX_PRECOMP
 
+#include "wx/cocoa/ObjcPose.h"
+
 #include "wx/cocoa/NSButton.h"
 #import <AppKit/NSButton.h>
 
@@ -45,9 +47,9 @@ WX_IMPLEMENT_POSER(wxPoserNSButton);
 @implementation wxPoserNSButton :  NSButton
 - (void)wxNSButtonAction: (id)sender
 {
-    wxASSERT_MSG(self==sender,"Received wxNSButtonAction from another object");
+    wxASSERT_MSG((id)self==sender,wxT("Received wxNSButtonAction from another object"));
     wxCocoaNSButton *button = wxCocoaNSButton::GetFromCocoa(self);
-    wxCHECK_RET(button,"wxNSButtonAction received without associated wx object");
+    wxCHECK_RET(button,wxT("wxNSButtonAction received without associated wx object"));
     button->Cocoa_wxNSButtonAction();
 }
 
@@ -55,8 +57,11 @@ WX_IMPLEMENT_POSER(wxPoserNSButton);
 
 void wxCocoaNSButton::AssociateNSButton(WX_NSButton cocoaNSButton)
 {
-    sm_cocoaHash.insert(wxCocoaNSButtonHash::value_type(cocoaNSButton,this));
-    [cocoaNSButton setTarget: cocoaNSButton];
-    [cocoaNSButton setAction: @selector(wxNSButtonAction:)];
+    if(cocoaNSButton)
+    {
+        sm_cocoaHash.insert(wxCocoaNSButtonHash::value_type(cocoaNSButton,this));
+        [cocoaNSButton setTarget: cocoaNSButton];
+        [cocoaNSButton setAction: @selector(wxNSButtonAction:)];
+    }
 }