No code changes, fixed various typos.
[wxWidgets.git] / src / cocoa / statbmp.mm
1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        src/cocoa/statbmp.mm
3 // Purpose:     wxStaticBitmap
4 // Author:      David Elliott
5 // Modified by:
6 // Created:     2003/02/15
7 // RCS-ID:      $Id$
8 // Copyright:   (c) 2003 David Elliott
9 // Licence:     wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #include "wx/statbmp.h"
15
16 #ifndef WX_PRECOMP
17     #include "wx/app.h"
18 #endif //WX_PRECOMP
19
20 #include "wx/cocoa/autorelease.h"
21
22 #import <AppKit/NSImageView.h>
23
24 BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
25 END_EVENT_TABLE()
26 // WX_IMPLEMENT_COCOA_OWNER(wxStaticBitmap,NSTextField,NSControl,NSView)
27
28 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID winid,
29            const wxBitmap& bitmap,
30            const wxPoint& pos,
31            const wxSize& size,
32            long style,
33            const wxString& name)
34 {
35     wxAutoNSAutoreleasePool pool;
36     if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
37         return false;
38     SetNSView([[NSImageView alloc] initWithFrame: MakeDefaultNSRect(size)]);
39     [m_cocoaNSView release];
40
41     [GetNSImageView() setImage:bitmap.GetNSImage(true)];
42     m_bitmap = bitmap;
43
44     if(m_parent)
45         m_parent->CocoaAddChild(this);
46     SetInitialFrameRect(pos,size);
47
48     return true;
49 }
50
51 wxStaticBitmap::~wxStaticBitmap()
52 {
53 }
54
55 void wxStaticBitmap::SetIcon(const wxIcon& icon)
56 {
57 }
58
59 void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
60 {
61     [GetNSImageView() setImage:bitmap.GetNSImage(true)];
62     m_bitmap = bitmap;
63 }
64
65 wxBitmap wxStaticBitmap::GetBitmap() const
66 {
67     return m_bitmap;
68 }