]> git.saurik.com Git - wxWidgets.git/blame - src/motif/dc.cpp
Fix compilation with MinGW -std=c++11 option.
[wxWidgets.git] / src / motif / dc.cpp
CommitLineData
4bb6408c 1/////////////////////////////////////////////////////////////////////////////
7520f3da 2// Name: src/motif/dc.cpp
fce127d7 3// Purpose: wxMotifDCImpl class
4bb6408c
JS
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
f38924e8
WS
15#ifndef WX_PRECOMP
16 #include "wx/dcmemory.h"
76c32e7b 17 #include "wx/icon.h"
f38924e8 18#endif
4bb6408c 19
fce127d7
VZ
20#include "wx/motif/dc.h"
21
22IMPLEMENT_ABSTRACT_CLASS(wxMotifDCImpl, wxDCImpl)
4bb6408c 23
4bb6408c 24//-----------------------------------------------------------------------------
fce127d7 25// wxMotifDCImpl
4bb6408c
JS
26//-----------------------------------------------------------------------------
27
fce127d7
VZ
28wxMotifDCImpl::wxMotifDCImpl(wxDC *owner)
29 : wxDCImpl(owner)
4bb6408c 30{
96be256b 31 m_ok = false;
af0bb3b1 32
2d120f83 33 m_backgroundMode = wxTRANSPARENT;
af0bb3b1 34}
4bb6408c 35
fce127d7 36void wxMotifDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
4bb6408c 37{
fce127d7 38 wxCHECK_RET( IsOk(), "invalid dc" );
a1b806b9 39 wxCHECK_RET( icon.IsOk(), "invalid icon" );
4bb6408c 40
96be256b 41 DoDrawBitmap(icon, x, y, true);
af0bb3b1 42}
4bb6408c 43
fce127d7 44void wxMotifDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
a367b9b3 45{
a1b806b9 46 wxCHECK_RET( bitmap.IsOk(), "invalid bitmap" );
af0bb3b1 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
fce127d7 63 DoBlit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), &memDC, 0, 0, wxCOPY, useMask);
4bb6408c 64
af0bb3b1
VZ
65 memDC.SelectObject(wxNullBitmap);
66}
4bb6408c 67
fce127d7 68void wxMotifDCImpl::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
fce127d7 77void wxMotifDCImpl::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
fce127d7 85void wxMotifDCImpl::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
fce127d7 97wxSize wxMotifDCImpl::GetPPI() const
7bcb11d3
JS
98{
99 // TODO (should probably be pure virtual)
100 return wxSize(0, 0);
101}