X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/888dde65f43d5f57e8fb2028b27191cca1741403..bf2c43c76e2819be443ab1d830ab68d9569d66b1:/src/gtk/dcmemory.cpp diff --git a/src/gtk/dcmemory.cpp b/src/gtk/dcmemory.cpp index 2a0d2687cb..05009c9e59 100644 --- a/src/gtk/dcmemory.cpp +++ b/src/gtk/dcmemory.cpp @@ -2,7 +2,6 @@ // Name: src/gtk/dcmemory.cpp // Purpose: // Author: Robert Roebling -// RCS-ID: $Id$ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -10,10 +9,8 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#include "wx/dcmemory.h" #include "wx/gtk/dcmemory.h" -#include #include //----------------------------------------------------------------------------- @@ -22,17 +19,17 @@ IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxWindowDCImpl) -wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner ) +wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner ) : wxWindowDCImpl( owner ) -{ - Init(); +{ + Init(); } -wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap) +wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap) : wxWindowDCImpl( owner ) -{ - Init(); - owner->SelectObject(bitmap); +{ + Init(); + DoSelect(bitmap); } wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *WXUNUSED(dc) ) @@ -65,7 +62,7 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) Destroy(); m_selected = bitmap; - if (m_selected.Ok()) + if (m_selected.IsOk()) { m_gdkwindow = m_selected.GetPixmap(); @@ -76,14 +73,14 @@ void wxMemoryDCImpl::DoSelect( const wxBitmap& bitmap ) else { m_ok = false; - m_gdkwindow = (GdkWindow *) NULL; + m_gdkwindow = NULL; } } void wxMemoryDCImpl::SetPen( const wxPen& penOrig ) { wxPen pen( penOrig ); - if ( m_selected.Ok() && + if ( m_selected.IsOk() && m_selected.GetDepth() == 1 && (pen != *wxTRANSPARENT_PEN) ) { @@ -96,7 +93,7 @@ void wxMemoryDCImpl::SetPen( const wxPen& penOrig ) void wxMemoryDCImpl::SetBrush( const wxBrush& brushOrig ) { wxBrush brush( brushOrig ); - if ( m_selected.Ok() && + if ( m_selected.IsOk() && m_selected.GetDepth() == 1 && (brush != *wxTRANSPARENT_BRUSH) ) { @@ -110,7 +107,7 @@ void wxMemoryDCImpl::SetBackground( const wxBrush& brushOrig ) { wxBrush brush(brushOrig); - if ( m_selected.Ok() && + if ( m_selected.IsOk() && m_selected.GetDepth() == 1 && (brush != *wxTRANSPARENT_BRUSH) ) { @@ -122,7 +119,7 @@ void wxMemoryDCImpl::SetBackground( const wxBrush& brushOrig ) void wxMemoryDCImpl::SetTextForeground( const wxColour& col ) { - if ( m_selected.Ok() && m_selected.GetDepth() == 1 ) + if ( m_selected.IsOk() && m_selected.GetDepth() == 1 ) wxWindowDCImpl::SetTextForeground( col == *wxWHITE ? *wxBLACK : *wxWHITE); else wxWindowDCImpl::SetTextForeground( col ); @@ -130,7 +127,7 @@ void wxMemoryDCImpl::SetTextForeground( const wxColour& col ) void wxMemoryDCImpl::SetTextBackground( const wxColour &col ) { - if (m_selected.Ok() && m_selected.GetDepth() == 1) + if (m_selected.IsOk() && m_selected.GetDepth() == 1) wxWindowDCImpl::SetTextBackground( col == *wxWHITE ? *wxBLACK : *wxWHITE ); else wxWindowDCImpl::SetTextBackground( col ); @@ -138,7 +135,7 @@ void wxMemoryDCImpl::SetTextBackground( const wxColour &col ) void wxMemoryDCImpl::DoGetSize( int *width, int *height ) const { - if (m_selected.Ok()) + if (m_selected.IsOk()) { if (width) (*width) = m_selected.GetWidth(); if (height) (*height) = m_selected.GetHeight(); @@ -166,3 +163,8 @@ wxBitmap& wxMemoryDCImpl::GetSelectedBitmap() return m_selected; } +void* wxMemoryDCImpl::GetHandle() const +{ + const wxBitmap& bmp = GetSelectedBitmap(); + return bmp.GetPixmap(); +}