]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/motif/dc.cpp
Fix recursion problems when loading pages from a virtual file system using the WebKit...
[wxWidgets.git] / src / motif / dc.cpp
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/motif/dc.cpp
3// Purpose: wxMotifDCImpl class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifndef WX_PRECOMP
16 #include "wx/dcmemory.h"
17 #include "wx/icon.h"
18#endif
19
20#include "wx/motif/dc.h"
21
22IMPLEMENT_ABSTRACT_CLASS(wxMotifDCImpl, wxDCImpl)
23
24//-----------------------------------------------------------------------------
25// wxMotifDCImpl
26//-----------------------------------------------------------------------------
27
28wxMotifDCImpl::wxMotifDCImpl(wxDC *owner)
29 : wxDCImpl(owner)
30{
31 m_ok = false;
32
33 m_backgroundMode = wxTRANSPARENT;
34}
35
36void wxMotifDCImpl::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
37{
38 wxCHECK_RET( IsOk(), "invalid dc" );
39 wxCHECK_RET( icon.IsOk(), "invalid icon" );
40
41 DoDrawBitmap(icon, x, y, true);
42}
43
44void wxMotifDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask )
45{
46 wxCHECK_RET( bitmap.IsOk(), "invalid bitmap" );
47
48 wxMemoryDC memDC;
49 memDC.SelectObjectAsSource(bitmap);
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.
54 if (useMask)
55 {
56 // There might be transparent areas, so make these the same colour as this
57 // DC
58 memDC.SetBackground(* GetBackground());
59 memDC.Clear();
60 }
61#endif // 0
62
63 DoBlit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), &memDC, 0, 0, wxCOPY, useMask);
64
65 memDC.SelectObject(wxNullBitmap);
66}
67
68void wxMotifDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
69{
70 m_clipping = true;
71 m_clipX1 = x;
72 m_clipY1 = y;
73 m_clipX2 = x + width;
74 m_clipY2 = y + height;
75}
76
77void wxMotifDCImpl::DoGetSize( int* width, int* height ) const
78{
79 if ( width )
80 *width = m_maxX - m_minX;
81 if ( height )
82 *height = m_maxY - m_minY;
83}
84
85void wxMotifDCImpl::DoGetSizeMM( int* width, int* height ) const
86{
87 int w, h;
88 GetSize( &w, &h );
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}
95
96// Resolution in pixels per logical inch
97wxSize wxMotifDCImpl::GetPPI() const
98{
99 // TODO (should probably be pure virtual)
100 return wxSize(0, 0);
101}