]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/statbmp.mm
Add missing c_str() call to fix wxGTK ANSI+STL build.
[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 // Copyright: (c) 2003 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #include "wx/statbmp.h"
14
15 #ifndef WX_PRECOMP
16 #include "wx/app.h"
17 #endif //WX_PRECOMP
18
19 #include "wx/cocoa/autorelease.h"
20
21 #import <AppKit/NSImageView.h>
22
23 BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
24 END_EVENT_TABLE()
25 // WX_IMPLEMENT_COCOA_OWNER(wxStaticBitmap,NSTextField,NSControl,NSView)
26
27 bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID winid,
28 const wxBitmap& bitmap,
29 const wxPoint& pos,
30 const wxSize& size,
31 long style,
32 const wxString& name)
33 {
34 wxAutoNSAutoreleasePool pool;
35 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
36 return false;
37 SetNSView([[NSImageView alloc] initWithFrame: MakeDefaultNSRect(size)]);
38 [m_cocoaNSView release];
39
40 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
41 m_bitmap = bitmap;
42
43 if(m_parent)
44 m_parent->CocoaAddChild(this);
45 SetInitialFrameRect(pos,size);
46
47 return true;
48 }
49
50 wxStaticBitmap::~wxStaticBitmap()
51 {
52 }
53
54 void wxStaticBitmap::SetIcon(const wxIcon& icon)
55 {
56 }
57
58 void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
59 {
60 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
61 m_bitmap = bitmap;
62 }
63
64 wxBitmap wxStaticBitmap::GetBitmap() const
65 {
66 return m_bitmap;
67 }