]> git.saurik.com Git - wxWidgets.git/blame - src/motif/dc.cpp
compilation fix for wxUSE_DBGHELP==0 after latest changes
[wxWidgets.git] / src / motif / dc.cpp
CommitLineData
4bb6408c 1/////////////////////////////////////////////////////////////////////////////
7520f3da 2// Name: src/motif/dc.cpp
4bb6408c
JS
3// Purpose: wxDC class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
4bb6408c
JS
10/////////////////////////////////////////////////////////////////////////////
11
1248b41f
MB
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
4bb6408c 15#include "wx/dc.h"
f38924e8
WS
16
17#ifndef WX_PRECOMP
18 #include "wx/dcmemory.h"
19#endif
4bb6408c 20
7520f3da 21IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
4bb6408c 22
4bb6408c
JS
23//-----------------------------------------------------------------------------
24// wxDC
25//-----------------------------------------------------------------------------
26
af0bb3b1 27wxDC::wxDC()
4bb6408c 28{
96be256b 29 m_ok = false;
af0bb3b1 30
2d120f83 31 m_backgroundMode = wxTRANSPARENT;
af0bb3b1 32
96be256b 33 m_isInteractive = false;
af0bb3b1 34}
4bb6408c 35
7b65ea1a 36void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
4bb6408c 37{
af0bb3b1
VZ
38 wxCHECK_RET( Ok(), "invalid dc" );
39 wxCHECK_RET( icon.Ok(), "invalid icon" );
4bb6408c 40
96be256b 41 DoDrawBitmap(icon, x, y, true);
af0bb3b1 42}
4bb6408c 43
7b65ea1a 44void wxDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
a367b9b3 45{
af0bb3b1
VZ
46 wxCHECK_RET( bitmap.Ok(), "invalid bitmap" );
47
a367b9b3 48 wxMemoryDC memDC;
f536319d 49 memDC.SelectObjectAsSource(bitmap);
af0bb3b1
VZ
50
51#if 0
52 // Not sure if we need this. The mask should leave the masked areas as per
53 // the original background of this DC.
a367b9b3
JS
54 if (useMask)
55 {
af0bb3b1
VZ
56 // There might be transparent areas, so make these the same colour as this
57 // DC
58 memDC.SetBackground(* GetBackground());
59 memDC.Clear();
a367b9b3 60 }
af0bb3b1 61#endif // 0
a367b9b3 62
af0bb3b1 63 Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), &memDC, 0, 0, wxCOPY, useMask);
4bb6408c 64
af0bb3b1
VZ
65 memDC.SelectObject(wxNullBitmap);
66}
4bb6408c 67
7b65ea1a 68void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
4bb6408c 69{
96be256b 70 m_clipping = true;
2d120f83
JS
71 m_clipX1 = x;
72 m_clipY1 = y;
73 m_clipX2 = x + width;
74 m_clipY2 = y + height;
af0bb3b1 75}
4bb6408c 76
af0bb3b1 77void wxDC::DoGetSize( int* width, int* height ) const
4bb6408c 78{
af0bb3b1
VZ
79 if ( width )
80 *width = m_maxX - m_minX;
81 if ( height )
82 *height = m_maxY - m_minY;
83}
4bb6408c 84
af0bb3b1 85void wxDC::DoGetSizeMM( int* width, int* height ) const
4bb6408c 86{
af0bb3b1 87 int w, h;
2d120f83 88 GetSize( &w, &h );
af0bb3b1
VZ
89
90 if ( width )
91 *width = int( double(w) / (m_scaleX*m_mm_to_pix_x) );
92 if ( height )
93 *height = int( double(h) / (m_scaleY*m_mm_to_pix_y) );
94}
4bb6408c 95
7bcb11d3 96// Resolution in pixels per logical inch
af0bb3b1 97wxSize wxDC::GetPPI() const
7bcb11d3
JS
98{
99 // TODO (should probably be pure virtual)
100 return wxSize(0, 0);
101}