1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dc.h
|
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-26 05:56:58 -05:00
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
1998-12-09 12:30:17 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GTKDCH__
|
|
|
|
#define __GTKDCH__
|
|
|
|
|
2002-09-07 08:28:46 -04:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
1998-05-20 10:01:55 -04:00
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxDC;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
#define MM_TEXT 0
|
1998-12-09 12:30:17 -05:00
|
|
|
#define MM_ISOTROPIC 1
|
1999-05-13 17:21:04 -04:00
|
|
|
#define MM_ANISOTROPIC 2
|
|
|
|
#define MM_LOMETRIC 3
|
|
|
|
#define MM_HIMETRIC 4
|
|
|
|
#define MM_TWIPS 5
|
|
|
|
#define MM_POINTS 6
|
|
|
|
#define MM_METRIC 7
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxDC
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
class wxDC : public wxDCBase
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
1998-12-03 10:14:45 -05:00
|
|
|
public:
|
1999-05-13 17:21:04 -04:00
|
|
|
wxDC();
|
|
|
|
~wxDC() { }
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
// the first two must be overridden and called
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual void DestroyClippingRegion();
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// Resolution in pixels per logical inch
|
|
|
|
virtual wxSize GetPPI() const;
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
|
|
|
virtual void EndDoc() { }
|
|
|
|
virtual void StartPage() { }
|
|
|
|
virtual void EndPage() { }
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual void SetMapMode( int mode );
|
|
|
|
virtual void SetUserScale( double x, double y );
|
|
|
|
virtual void SetLogicalScale( double x, double y );
|
1999-10-18 11:14:52 -04:00
|
|
|
virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
|
|
|
|
virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
1998-05-20 10:01:55 -04:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// implementation
|
|
|
|
// --------------
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1999-05-26 16:40:04 -04:00
|
|
|
virtual void ComputeScaleAndOrigin();
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord XDEV2LOG(wxCoord x) const
|
1999-05-13 17:21:04 -04:00
|
|
|
{
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord new_x = x - m_deviceOriginX;
|
1999-05-13 17:21:04 -04:00
|
|
|
if (new_x > 0)
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
|
1999-05-13 17:21:04 -04:00
|
|
|
else
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
|
1999-05-13 17:21:04 -04:00
|
|
|
}
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord XDEV2LOGREL(wxCoord x) const
|
1999-05-13 17:21:04 -04:00
|
|
|
{
|
|
|
|
if (x > 0)
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
1999-05-13 17:21:04 -04:00
|
|
|
else
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
1999-05-13 17:21:04 -04:00
|
|
|
}
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord YDEV2LOG(wxCoord y) const
|
1999-05-13 17:21:04 -04:00
|
|
|
{
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord new_y = y - m_deviceOriginY;
|
1999-05-13 17:21:04 -04:00
|
|
|
if (new_y > 0)
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
|
1999-05-13 17:21:04 -04:00
|
|
|
else
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
|
1999-05-13 17:21:04 -04:00
|
|
|
}
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord YDEV2LOGREL(wxCoord y) const
|
1999-05-13 17:21:04 -04:00
|
|
|
{
|
|
|
|
if (y > 0)
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
1999-05-13 17:21:04 -04:00
|
|
|
else
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
1999-05-13 17:21:04 -04:00
|
|
|
}
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord XLOG2DEV(wxCoord x) const
|
1999-05-13 17:21:04 -04:00
|
|
|
{
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord new_x = x - m_logicalOriginX;
|
1999-05-13 17:21:04 -04:00
|
|
|
if (new_x > 0)
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
|
1999-05-13 17:21:04 -04:00
|
|
|
else
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
|
1999-05-13 17:21:04 -04:00
|
|
|
}
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord XLOG2DEVREL(wxCoord x) const
|
1999-05-13 17:21:04 -04:00
|
|
|
{
|
|
|
|
if (x > 0)
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
1999-05-13 17:21:04 -04:00
|
|
|
else
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
1999-05-13 17:21:04 -04:00
|
|
|
}
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord YLOG2DEV(wxCoord y) const
|
1999-05-13 17:21:04 -04:00
|
|
|
{
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord new_y = y - m_logicalOriginY;
|
1999-05-13 17:21:04 -04:00
|
|
|
if (new_y > 0)
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
|
1999-05-13 17:21:04 -04:00
|
|
|
else
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
|
1999-05-13 17:21:04 -04:00
|
|
|
}
|
1999-10-18 11:14:52 -04:00
|
|
|
wxCoord YLOG2DEVREL(wxCoord y) const
|
1999-05-13 17:21:04 -04:00
|
|
|
{
|
|
|
|
if (y > 0)
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
1999-05-13 17:21:04 -04:00
|
|
|
else
|
1999-10-18 11:14:52 -04:00
|
|
|
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
1999-05-13 17:21:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// base class pure virtuals implemented here
|
1999-10-18 11:14:52 -04:00
|
|
|
virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
1999-05-13 17:21:04 -04:00
|
|
|
virtual void DoGetSizeMM(int* width, int* height) const;
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
public:
|
|
|
|
// GTK-specific member variables
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
// not sure what for, but what is a mm on a screen you don't know the size
|
|
|
|
// of?
|
|
|
|
double m_mm_to_pix_x,
|
|
|
|
m_mm_to_pix_y;
|
1998-12-09 12:30:17 -05:00
|
|
|
|
1999-05-13 17:21:04 -04:00
|
|
|
bool m_needComputeScaleX,
|
|
|
|
m_needComputeScaleY; // not yet used
|
1998-12-09 12:30:17 -05:00
|
|
|
|
2002-02-10 11:09:49 -05:00
|
|
|
|
1999-11-22 14:44:25 -05:00
|
|
|
private:
|
|
|
|
DECLARE_ABSTRACT_CLASS(wxDC)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
2002-02-10 11:09:49 -05:00
|
|
|
// this must be defined when wxDC::Blit() honours the DC origian and needed to
|
|
|
|
// allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
|
|
|
|
// 2.3.[23]
|
|
|
|
#ifndef wxHAS_WORKING_GTK_DC_BLIT
|
|
|
|
#define wxHAS_WORKING_GTK_DC_BLIT
|
|
|
|
#endif
|
|
|
|
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif // __GTKDCH__
|