| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: dc.cpp |
| 3 | // Purpose: |
| 4 | // Author: Robert Roebling |
| 5 | // RCS-ID: $Id$ |
| 6 | // Copyright: (c) 1998 Robert Roebling |
| 7 | // Licence: wxWindows licence |
| 8 | ///////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | // For compilers that support precompilation, includes "wx.h". |
| 11 | #include "wx/wxprec.h" |
| 12 | |
| 13 | #include "wx/gtk1/dc.h" |
| 14 | |
| 15 | #include <gdk/gdk.h> |
| 16 | #include <gtk/gtk.h> |
| 17 | |
| 18 | //----------------------------------------------------------------------------- |
| 19 | // wxGTKDCImpl |
| 20 | //----------------------------------------------------------------------------- |
| 21 | |
| 22 | IMPLEMENT_ABSTRACT_CLASS(wxGTKDCImpl, wxDCImpl) |
| 23 | |
| 24 | wxGTKDCImpl::wxGTKDCImpl(wxDC *owner) |
| 25 | : wxDCImpl(owner) |
| 26 | { |
| 27 | m_ok = FALSE; |
| 28 | |
| 29 | m_logicalFunction = wxCOPY; |
| 30 | |
| 31 | m_pen = *wxBLACK_PEN; |
| 32 | m_font = *wxNORMAL_FONT; |
| 33 | m_brush = *wxWHITE_BRUSH; |
| 34 | } |
| 35 | |
| 36 | void wxGTKDCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) |
| 37 | { |
| 38 | m_clipping = TRUE; |
| 39 | m_clipX1 = x; |
| 40 | m_clipY1 = y; |
| 41 | m_clipX2 = x + width; |
| 42 | m_clipY2 = y + height; |
| 43 | } |
| 44 | |
| 45 | // --------------------------------------------------------------------------- |
| 46 | // get DC capabilities |
| 47 | // --------------------------------------------------------------------------- |
| 48 | |
| 49 | void wxGTKDCImpl::DoGetSizeMM( int* width, int* height ) const |
| 50 | { |
| 51 | int w = 0; |
| 52 | int h = 0; |
| 53 | GetSize( &w, &h ); |
| 54 | if (width) *width = int( double(w) / (m_userScaleX*m_mm_to_pix_x) ); |
| 55 | if (height) *height = int( double(h) / (m_userScaleY*m_mm_to_pix_y) ); |
| 56 | } |
| 57 | |
| 58 | // Resolution in pixels per logical inch |
| 59 | wxSize wxGTKDCImpl::GetPPI() const |
| 60 | { |
| 61 | // TODO (should probably be pure virtual) |
| 62 | return wxSize(0, 0); |
| 63 | } |
| 64 | |