// Name: src/gtk/dcmemory.cpp
// Purpose:
// Author: Robert Roebling
-// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/dcmemory.h"
#include "wx/gtk/dcmemory.h"
-#include <gdk/gdk.h>
#include <gtk/gtk.h>
//-----------------------------------------------------------------------------
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) )
Destroy();
m_selected = bitmap;
- if (m_selected.Ok())
+ if (m_selected.IsOk())
{
m_gdkwindow = m_selected.GetPixmap();
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) )
{
void wxMemoryDCImpl::SetBrush( const wxBrush& brushOrig )
{
wxBrush brush( brushOrig );
- if ( m_selected.Ok() &&
+ if ( m_selected.IsOk() &&
m_selected.GetDepth() == 1 &&
(brush != *wxTRANSPARENT_BRUSH) )
{
{
wxBrush brush(brushOrig);
- if ( m_selected.Ok() &&
+ if ( m_selected.IsOk() &&
m_selected.GetDepth() == 1 &&
(brush != *wxTRANSPARENT_BRUSH) )
{
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 );
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 );
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();
return m_selected;
}
+void* wxMemoryDCImpl::GetHandle() const
+{
+ const wxBitmap& bmp = GetSelectedBitmap();
+ return bmp.GetPixmap();
+}