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 BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
26 // WX_IMPLEMENT_COCOA_OWNER(wxStaticBitmap,NSTextField,NSControl,NSView)
28 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID winid,
29 const wxBitmap& bitmap,
35 wxAutoNSAutoreleasePool pool;
36 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
38 SetNSView([[NSImageView alloc] initWithFrame: MakeDefaultNSRect(size)]);
39 [m_cocoaNSView release];
41 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
45 m_parent->CocoaAddChild(this);
46 SetInitialFrameRect(pos,size);
51 wxStaticBitmap::~wxStaticBitmap()
55 void wxStaticBitmap::SetIcon(const wxIcon& icon)
59 void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
61 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
65 wxBitmap wxStaticBitmap::GetBitmap() const