]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/button.mm
Bail out if GetCurrentMenu returns NULL
[wxWidgets.git] / src / cocoa / button.mm
index f9d006b3a72232f41f5bf565a172441736645c99..a4955ccb28e45fac0c9138b9e307a073c8142c4a 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2002/12/30
 // RCS-ID:      $Id: 
 // Copyright:   (c) 2002 David Elliott
-// Licence:    wxWindows license
+// Licence:    wxWidgets licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
@@ -16,6 +16,7 @@
     #include "wx/log.h"
 #endif
 
+#include "wx/stockitem.h"
 #include "wx/cocoa/autorelease.h"
 
 #import <AppKit/NSButton.h>
@@ -27,15 +28,17 @@ END_EVENT_TABLE()
 WX_IMPLEMENT_COCOA_OWNER(wxButton,NSButton,NSControl,NSView)
 
 bool wxButton::Create(wxWindow *parent, wxWindowID winid,
-            const wxString& label, const wxPoint& pos,
+            const wxString& lbl, const wxPoint& pos,
             const wxSize& size, long style,
             const wxValidator& validator, const wxString& name)
 {
+    wxString label((lbl.empty() && wxIsStockID(winid))?wxGetStockLabel(winid):lbl);
+
     wxAutoNSAutoreleasePool pool;
-    wxLogDebug(wxT("Creating control with id=%d"),winid);
+    wxLogTrace(wxTRACE_COCOA,wxT("Creating control with id=%d"),winid);
     if(!CreateControl(parent,winid,pos,size,style,validator,name))
         return false;
-    wxLogDebug(wxT("Created control with id=%d"),GetId());
+    wxLogTrace(wxTRACE_COCOA,wxT("Created control with id=%d"),GetId());
     m_cocoaNSView = NULL;
     SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
     // NOTE: YES we want to release this (to match the alloc).
@@ -60,7 +63,7 @@ wxButton::~wxButton()
 
 void wxButton::Cocoa_wxNSButtonAction(void)
 {
-    wxLogDebug(wxT("YAY!"));
+    wxLogTrace(wxTRACE_COCOA,wxT("YAY!"));
     wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
     InitCommandEvent(event); //    event.SetEventObject(this);
     Command(event);