BEGIN_EVENT_TABLE(wxBitmapButton, wxBitmapButtonBase)
END_EVENT_TABLE()
WX_IMPLEMENT_COCOA_OWNER(wxBitmapButton,NSButton,NSControl,NSView)
BEGIN_EVENT_TABLE(wxBitmapButton, wxBitmapButtonBase)
END_EVENT_TABLE()
WX_IMPLEMENT_COCOA_OWNER(wxBitmapButton,NSButton,NSControl,NSView)
bool wxBitmapButton::Create(wxWindow *parent, wxWindowID winid,
const wxBitmap& bitmap, const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator, const wxString& name)
{
wxAutoNSAutoreleasePool pool;
bool wxBitmapButton::Create(wxWindow *parent, wxWindowID winid,
const wxBitmap& bitmap, const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator, const wxString& name)
{
wxAutoNSAutoreleasePool pool;
if(!CreateControl(parent,winid,pos,size,style,validator,name))
return false;
if(!CreateControl(parent,winid,pos,size,style,validator,name))
return false;
m_cocoaNSView = NULL;
SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
// NOTE: YES we want to release this (to match the alloc).
// DoAddChild(this) will retain us again since addSubView doesn't.
[m_cocoaNSView release];
m_cocoaNSView = NULL;
SetNSButton([[NSButton alloc] initWithFrame: MakeDefaultNSRect(size)]);
// NOTE: YES we want to release this (to match the alloc).
// DoAddChild(this) will retain us again since addSubView doesn't.
[m_cocoaNSView release];
- [GetNSButton() setBezelStyle:NSRoundedBezelStyle];
- [GetNSButton() setTitle:@"Bitmap Button"];
+ [GetNSButton() setBezelStyle: NSRegularSquareBezelStyle];
+ [GetNSButton() setImage:bitmap.GetNSImage(true)];
- wxLogDebug("YAY!");
- wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
+ wxLogTrace(wxTRACE_COCOA,wxT("YAY!"));
+ wxCommandEvent event(wxEVT_BUTTON, GetId());