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