Implement wxStaticBitmap.

Copyright 2007 Software 2000 Ltd.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2007-08-09 16:53:32 +00:00
parent c118d8b06e
commit 9cce71a0f9
2 changed files with 11 additions and 3 deletions

View File

@ -12,7 +12,7 @@
#ifndef __WX_COCOA_STATBMP_H__
#define __WX_COCOA_STATBMP_H__
// #include "wx/cocoa/NSxxx.h"
DECLARE_WXCOCOA_OBJC_CLASS(NSImageView);
// ========================================================================
// wxStaticBitmap
@ -46,6 +46,9 @@ public:
// ------------------------------------------------------------------------
// Cocoa specifics
// ------------------------------------------------------------------------
WX_NSImageView GetNSImageView() { return (WX_NSImageView)m_cocoaNSView; }
wxBitmap m_bitmap;
// ------------------------------------------------------------------------
// Implementation
// ------------------------------------------------------------------------

View File

@ -37,9 +37,12 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID winid,
wxAutoNSAutoreleasePool pool;
if(!CreateControl(parent,winid,pos,size,style,wxDefaultValidator,name))
return false;
m_cocoaNSView = NULL;
SetNSView([[NSImageView alloc] initWithFrame: MakeDefaultNSRect(size)]);
[m_cocoaNSView release];
[GetNSImageView() setImage:bitmap.GetNSImage(true)];
m_bitmap = bitmap;
if(m_parent)
m_parent->CocoaAddChild(this);
SetInitialFrameRect(pos,size);
@ -57,9 +60,11 @@ void wxStaticBitmap::SetIcon(const wxIcon& icon)
void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
{
[GetNSImageView() setImage:bitmap.GetNSImage(true)];
m_bitmap = bitmap;
}
wxBitmap wxStaticBitmap::GetBitmap() const
{
return wxNullBitmap;
return m_bitmap;
}