]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/statbmp.mm
Add missing c_str() call to fix wxGTK ANSI+STL build.
[wxWidgets.git] / src / cocoa / statbmp.mm
CommitLineData
da0634c1 1/////////////////////////////////////////////////////////////////////////////
e267406e 2// Name: src/cocoa/statbmp.mm
da0634c1
DE
3// Purpose: wxStaticBitmap
4// Author: David Elliott
5// Modified by:
6// Created: 2003/02/15
da0634c1 7// Copyright: (c) 2003 David Elliott
526954c5 8// Licence: wxWindows licence
da0634c1
DE
9/////////////////////////////////////////////////////////////////////////////
10
449c5673 11#include "wx/wxprec.h"
e267406e
WS
12
13#include "wx/statbmp.h"
14
449c5673
DE
15#ifndef WX_PRECOMP
16 #include "wx/app.h"
449c5673 17#endif //WX_PRECOMP
e267406e 18
9556c0f1 19#include "wx/cocoa/autorelease.h"
da0634c1 20
0ca6987d 21#import <AppKit/NSImageView.h>
a8c80eb1 22
da0634c1
DE
23BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
24END_EVENT_TABLE()
25// WX_IMPLEMENT_COCOA_OWNER(wxStaticBitmap,NSTextField,NSControl,NSView)
26
27bool 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{
9556c0f1 34 wxAutoNSAutoreleasePool pool;
da0634c1
DE
35 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
36 return false;
0ca6987d 37 SetNSView([[NSImageView alloc] initWithFrame: MakeDefaultNSRect(size)]);
a8c80eb1 38 [m_cocoaNSView release];
9cce71a0
DE
39
40 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
41 m_bitmap = bitmap;
42
da0634c1
DE
43 if(m_parent)
44 m_parent->CocoaAddChild(this);
8d656ea9
DE
45 SetInitialFrameRect(pos,size);
46
da0634c1
DE
47 return true;
48}
49
50wxStaticBitmap::~wxStaticBitmap()
51{
da0634c1
DE
52}
53
54void wxStaticBitmap::SetIcon(const wxIcon& icon)
55{
56}
57
58void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
59{
9cce71a0
DE
60 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
61 m_bitmap = bitmap;
da0634c1
DE
62}
63
64wxBitmap wxStaticBitmap::GetBitmap() const
65{
9cce71a0 66 return m_bitmap;
da0634c1 67}