1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/statbmp.mm
3 // Purpose: wxStaticBitmap
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/statbmp.h"
20 #include "wx/cocoa/autorelease.h"
22 #import <AppKit/NSImageView.h>
24 IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
26 BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
28 // WX_IMPLEMENT_COCOA_OWNER(wxStaticBitmap,NSTextField,NSControl,NSView)
30 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID winid,
31 const wxBitmap& bitmap,
37 wxAutoNSAutoreleasePool pool;
38 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
40 SetNSView([[NSImageView alloc] initWithFrame: MakeDefaultNSRect(size)]);
41 [m_cocoaNSView release];
43 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
47 m_parent->CocoaAddChild(this);
48 SetInitialFrameRect(pos,size);
53 wxStaticBitmap::~wxStaticBitmap()
57 void wxStaticBitmap::SetIcon(const wxIcon& icon)
61 void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
63 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
67 wxBitmap wxStaticBitmap::GetBitmap() const