]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/statbmp.mm
fix for GTK assert after r72696, a draw/expose_event signal may also be attached...
[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
e267406e 7// RCS-ID: $Id$
da0634c1 8// Copyright: (c) 2003 David Elliott
526954c5 9// Licence: wxWindows licence
da0634c1
DE
10/////////////////////////////////////////////////////////////////////////////
11
449c5673 12#include "wx/wxprec.h"
e267406e
WS
13
14#include "wx/statbmp.h"
15
449c5673
DE
16#ifndef WX_PRECOMP
17 #include "wx/app.h"
449c5673 18#endif //WX_PRECOMP
e267406e 19
9556c0f1 20#include "wx/cocoa/autorelease.h"
da0634c1 21
0ca6987d 22#import <AppKit/NSImageView.h>
a8c80eb1 23
da0634c1
DE
24BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
25END_EVENT_TABLE()
26// WX_IMPLEMENT_COCOA_OWNER(wxStaticBitmap,NSTextField,NSControl,NSView)
27
28bool 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{
9556c0f1 35 wxAutoNSAutoreleasePool pool;
da0634c1
DE
36 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
37 return false;
0ca6987d 38 SetNSView([[NSImageView alloc] initWithFrame: MakeDefaultNSRect(size)]);
a8c80eb1 39 [m_cocoaNSView release];
9cce71a0
DE
40
41 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
42 m_bitmap = bitmap;
43
da0634c1
DE
44 if(m_parent)
45 m_parent->CocoaAddChild(this);
8d656ea9
DE
46 SetInitialFrameRect(pos,size);
47
da0634c1
DE
48 return true;
49}
50
51wxStaticBitmap::~wxStaticBitmap()
52{
da0634c1
DE
53}
54
55void wxStaticBitmap::SetIcon(const wxIcon& icon)
56{
57}
58
59void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
60{
9cce71a0
DE
61 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
62 m_bitmap = bitmap;
da0634c1
DE
63}
64
65wxBitmap wxStaticBitmap::GetBitmap() const
66{
9cce71a0 67 return m_bitmap;
da0634c1 68}