]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/dc.h
Fixed typo in my last commit (it did break socket detection code :-( ).
[wxWidgets.git] / include / wx / motif / dc.h
CommitLineData
9b6dbb09
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: dc.h
3// Purpose: wxDC class
4// Author: Julian Smart
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
af0bb3b1 9// Licence: wxWindows licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_DC_H_
13#define _WX_DC_H_
14
15#ifdef __GNUG__
83df96d6 16#pragma interface "dc.h"
9b6dbb09
JS
17#endif
18
19#include "wx/pen.h"
20#include "wx/brush.h"
21#include "wx/icon.h"
22#include "wx/font.h"
23#include "wx/gdicmn.h"
24
25//-----------------------------------------------------------------------------
26// constants
27//-----------------------------------------------------------------------------
28
29#ifndef MM_TEXT
83df96d6
JS
30#define MM_TEXT 0
31#define MM_ISOTROPIC 1
32#define MM_ANISOTROPIC 2
33#define MM_LOMETRIC 3
34#define MM_HIMETRIC 4
35#define MM_TWIPS 5
36#define MM_POINTS 6
37#define MM_METRIC 7
9b6dbb09
JS
38#endif
39
9b6dbb09
JS
40//-----------------------------------------------------------------------------
41// wxDC
42//-----------------------------------------------------------------------------
43
af0bb3b1 44class WXDLLEXPORT wxDC : public wxDCBase
9b6dbb09 45{
af0bb3b1 46 DECLARE_DYNAMIC_CLASS(wxDC)
83df96d6 47
af0bb3b1
VZ
48public:
49 wxDC();
50 ~wxDC() { }
83df96d6 51
af0bb3b1
VZ
52 // implement base class pure virtuals
53 // ----------------------------------
83df96d6 54
af0bb3b1 55 virtual void DestroyClippingRegion();
83df96d6 56
af0bb3b1 57 virtual wxSize GetPPI() const;
83df96d6 58
af0bb3b1
VZ
59 virtual void SetMapMode(int mode);
60 virtual void SetUserScale(double x, double y);
af0bb3b1 61 virtual void SetLogicalScale(double x, double y);
7b65ea1a
MB
62 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
63 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
af0bb3b1 64 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
83df96d6 65
af0bb3b1 66protected:
7b65ea1a
MB
67 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
68 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
83df96d6
JS
69 bool useMask = FALSE);
70
7b65ea1a 71 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
83df96d6 72 wxCoord width, wxCoord height);
af0bb3b1
VZ
73 virtual void DoGetSize(int *width, int *height) const;
74 virtual void DoGetSizeMM(int* width, int* height) const;
83df96d6 75
af0bb3b1
VZ
76public:
77 void ComputeScaleAndOrigin();
83df96d6 78
7b65ea1a 79 wxCoord XDEV2LOG(wxCoord x) const
9b6dbb09 80 {
7b65ea1a 81 wxCoord new_x = x - m_deviceOriginX;
af0bb3b1 82 if (new_x > 0)
7b65ea1a 83 return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
af0bb3b1 84 else
7b65ea1a 85 return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
9b6dbb09 86 }
7b65ea1a 87 wxCoord XDEV2LOGREL(wxCoord x) const
9b6dbb09 88 {
af0bb3b1 89 if (x > 0)
7b65ea1a 90 return (wxCoord)((double)(x) / m_scaleX + 0.5);
af0bb3b1 91 else
7b65ea1a 92 return (wxCoord)((double)(x) / m_scaleX - 0.5);
9b6dbb09 93 }
7b65ea1a 94 wxCoord YDEV2LOG(wxCoord y) const
9b6dbb09 95 {
7b65ea1a 96 wxCoord new_y = y - m_deviceOriginY;
af0bb3b1 97 if (new_y > 0)
7b65ea1a 98 return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
af0bb3b1 99 else
7b65ea1a 100 return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
9b6dbb09 101 }
7b65ea1a 102 wxCoord YDEV2LOGREL(wxCoord y) const
9b6dbb09 103 {
af0bb3b1 104 if (y > 0)
7b65ea1a 105 return (wxCoord)((double)(y) / m_scaleY + 0.5);
af0bb3b1 106 else
7b65ea1a 107 return (wxCoord)((double)(y) / m_scaleY - 0.5);
9b6dbb09 108 }
7b65ea1a 109 wxCoord XLOG2DEV(wxCoord x) const
9b6dbb09 110 {
7b65ea1a 111 wxCoord new_x = x - m_logicalOriginX;
af0bb3b1 112 if (new_x > 0)
7b65ea1a 113 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
af0bb3b1 114 else
7b65ea1a 115 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
9b6dbb09 116 }
af0bb3b1 117 // Without device translation, for backing pixmap purposes
7b65ea1a 118 wxCoord XLOG2DEV_2(wxCoord x) const
9b6dbb09 119 {
7b65ea1a 120 wxCoord new_x = x - m_logicalOriginX;
af0bb3b1 121 if (new_x > 0)
7b65ea1a 122 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX;
af0bb3b1 123 else
7b65ea1a 124 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX;
9b6dbb09 125 }
7b65ea1a 126 wxCoord XLOG2DEVREL(wxCoord x) const
9b6dbb09 127 {
af0bb3b1 128 if (x > 0)
7b65ea1a 129 return (wxCoord)((double)(x) * m_scaleX + 0.5);
af0bb3b1 130 else
7b65ea1a 131 return (wxCoord)((double)(x) * m_scaleX - 0.5);
9b6dbb09 132 }
7b65ea1a 133 wxCoord YLOG2DEV(wxCoord y) const
9b6dbb09 134 {
7b65ea1a 135 wxCoord new_y = y - m_logicalOriginY;
af0bb3b1 136 if (new_y > 0)
7b65ea1a 137 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
af0bb3b1 138 else
7b65ea1a 139 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
9b6dbb09 140 }
af0bb3b1 141 // Without device translation, for backing pixmap purposes
7b65ea1a 142 wxCoord YLOG2DEV_2(wxCoord y) const
9b6dbb09 143 {
7b65ea1a 144 wxCoord new_y = y - m_logicalOriginY;
af0bb3b1 145 if (new_y > 0)
7b65ea1a 146 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY;
af0bb3b1 147 else
7b65ea1a 148 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY;
9b6dbb09 149 }
7b65ea1a 150 wxCoord YLOG2DEVREL(wxCoord y) const
9b6dbb09 151 {
af0bb3b1 152 if (y > 0)
7b65ea1a 153 return (wxCoord)((double)(y) * m_scaleY + 0.5);
af0bb3b1 154 else
7b65ea1a 155 return (wxCoord)((double)(y) * m_scaleY - 0.5);
9b6dbb09 156 }
83df96d6 157
af0bb3b1
VZ
158public:
159 // not sure what for, but what is a mm on a screen you don't know the size of?
160 double m_mm_to_pix_x,m_mm_to_pix_y;
83df96d6 161
af0bb3b1
VZ
162 // recompute scale?
163 bool m_needComputeScaleX, m_needComputeScaleY;
83df96d6 164
9b6dbb09
JS
165};
166
167#endif
83df96d6 168// _WX_DC_H_