]> git.saurik.com Git - wxWidgets.git/blame - src/cocoa/statbmp.mm
Call virtual ctrl->GetDefaultAttributes() instead of static GetClassDefaultAttributes()
[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
e267406e 9// Licence: wxWidgets 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 24IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
e267406e 25
da0634c1
DE
26BEGIN_EVENT_TABLE(wxStaticBitmap, wxControl)
27END_EVENT_TABLE()
28// WX_IMPLEMENT_COCOA_OWNER(wxStaticBitmap,NSTextField,NSControl,NSView)
29
30bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID winid,
31 const wxBitmap& bitmap,
32 const wxPoint& pos,
33 const wxSize& size,
34 long style,
35 const wxString& name)
36{
9556c0f1 37 wxAutoNSAutoreleasePool pool;
da0634c1
DE
38 if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
39 return false;
0ca6987d 40 SetNSView([[NSImageView alloc] initWithFrame: MakeDefaultNSRect(size)]);
a8c80eb1 41 [m_cocoaNSView release];
9cce71a0
DE
42
43 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
44 m_bitmap = bitmap;
45
da0634c1
DE
46 if(m_parent)
47 m_parent->CocoaAddChild(this);
8d656ea9
DE
48 SetInitialFrameRect(pos,size);
49
da0634c1
DE
50 return true;
51}
52
53wxStaticBitmap::~wxStaticBitmap()
54{
da0634c1
DE
55}
56
57void wxStaticBitmap::SetIcon(const wxIcon& icon)
58{
59}
60
61void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
62{
9cce71a0
DE
63 [GetNSImageView() setImage:bitmap.GetNSImage(true)];
64 m_bitmap = bitmap;
da0634c1
DE
65}
66
67wxBitmap wxStaticBitmap::GetBitmap() const
68{
9cce71a0 69 return m_bitmap;
da0634c1 70}