1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/statbmp.mm
3 // Purpose: wxStaticBitmap
4 // Author: David Elliott
7 // Copyright: (c) 2003 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
13 #include "wx/statbmp.h"
19 #include "wx/cocoa/autorelease.h"
21 #import <AppKit/NSImageView.h>
23 BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
25 // WX_IMPLEMENT_COCOA_OWNER(wxStaticBitmap,NSTextField,NSControl,NSView)
27 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID winid,
28 const wxBitmap& bitmap,
34 wxAutoNSAutoreleasePool pool;
35 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
37 SetNSView([[NSImageView alloc] initWithFrame: MakeDefaultNSRect(size)]);
38 [m_cocoaNSView release];
40 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
44 m_parent->CocoaAddChild(this);
45 SetInitialFrameRect(pos,size);
50 wxStaticBitmap::~wxStaticBitmap()
54 void wxStaticBitmap::SetIcon(const wxIcon& icon)
58 void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
60 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
64 wxBitmap wxStaticBitmap::GetBitmap() const