]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement wxStaticBitmap.
authorDavid Elliott <dfe@tgwbd.org>
Thu, 9 Aug 2007 16:53:32 +0000 (16:53 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Thu, 9 Aug 2007 16:53:32 +0000 (16:53 +0000)
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
src/cocoa/statbmp.mm

index df5866edcf288fce40a2cfae58f89d8bba110a8f..48e281b4a0ef7d658521b97c2f602839f309d8a3 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef __WX_COCOA_STATBMP_H__
 #define __WX_COCOA_STATBMP_H__
 
 #ifndef __WX_COCOA_STATBMP_H__
 #define __WX_COCOA_STATBMP_H__
 
-// #include "wx/cocoa/NSxxx.h"
+DECLARE_WXCOCOA_OBJC_CLASS(NSImageView);
 
 // ========================================================================
 // wxStaticBitmap
 
 // ========================================================================
 // wxStaticBitmap
@@ -46,6 +46,9 @@ public:
 // ------------------------------------------------------------------------
 // Cocoa specifics
 // ------------------------------------------------------------------------
 // ------------------------------------------------------------------------
 // Cocoa specifics
 // ------------------------------------------------------------------------
+    WX_NSImageView GetNSImageView() { return (WX_NSImageView)m_cocoaNSView; }
+    wxBitmap m_bitmap;
+
 // ------------------------------------------------------------------------
 // Implementation
 // ------------------------------------------------------------------------
 // ------------------------------------------------------------------------
 // Implementation
 // ------------------------------------------------------------------------
index 0be69ca515805a48b39d38d80df93cba6d64e3b9..3a050757c91667339988b4aa4ac708208a5d2ac3 100644 (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;
     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];
     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);
     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)
 {
 
 void wxStaticBitmap::SetBitmap(const wxBitmap& bitmap)
 {
+    [GetNSImageView() setImage:bitmap.GetNSImage(true)];
+    m_bitmap = bitmap;
 }
 
 wxBitmap wxStaticBitmap::GetBitmap() const
 {
 }
 
 wxBitmap wxStaticBitmap::GetBitmap() const
 {
-    return wxNullBitmap;
+    return m_bitmap;
 }
 }