From 9cce71a0f949c227c2c2ad53d700eca16af92cbe Mon Sep 17 00:00:00 2001 From: David Elliott Date: Thu, 9 Aug 2007 16:53:32 +0000 Subject: [PATCH] Implement wxStaticBitmap. Copyright 2007 Software 2000 Ltd. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cocoa/statbmp.h | 5 ++++- src/cocoa/statbmp.mm | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/wx/cocoa/statbmp.h b/include/wx/cocoa/statbmp.h index df5866edcf..48e281b4a0 100644 --- a/include/wx/cocoa/statbmp.h +++ b/include/wx/cocoa/statbmp.h @@ -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 // ------------------------------------------------------------------------ diff --git a/src/cocoa/statbmp.mm b/src/cocoa/statbmp.mm index 0be69ca515..3a050757c9 100644 --- a/src/cocoa/statbmp.mm +++ b/src/cocoa/statbmp.mm @@ -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; } -- 2.45.2