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