]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/dc.h
use native toolbar, font dialog and CG by default
[wxWidgets.git] / include / wx / x11 / dc.h
CommitLineData
83df96d6
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
65571936 9// Licence: wxWindows licence
83df96d6
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_DC_H_
13#define _WX_DC_H_
14
83df96d6
JS
15#include "wx/pen.h"
16#include "wx/brush.h"
17#include "wx/icon.h"
18#include "wx/font.h"
19#include "wx/gdicmn.h"
20
21//-----------------------------------------------------------------------------
22// constants
23//-----------------------------------------------------------------------------
24
25#ifndef MM_TEXT
26#define MM_TEXT 0
27#define MM_ISOTROPIC 1
28#define MM_ANISOTROPIC 2
29#define MM_LOMETRIC 3
30#define MM_HIMETRIC 4
31#define MM_TWIPS 5
32#define MM_POINTS 6
33#define MM_METRIC 7
34#endif
35
36//-----------------------------------------------------------------------------
37// wxDC
38//-----------------------------------------------------------------------------
39
40class WXDLLEXPORT wxDC : public wxDCBase
41{
83df96d6
JS
42public:
43 wxDC();
d3c7fc99 44 virtual ~wxDC() { }
d16b634f 45
83df96d6
JS
46 // implement base class pure virtuals
47 // ----------------------------------
d16b634f 48
83df96d6 49 virtual wxSize GetPPI() const;
d16b634f 50
83df96d6
JS
51 virtual void SetMapMode(int mode);
52 virtual void SetUserScale(double x, double y);
53 virtual void SetLogicalScale(double x, double y);
54 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
55 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
56 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
d16b634f 57
83df96d6 58protected:
83df96d6
JS
59 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
60 wxCoord width, wxCoord height);
83df96d6 61 virtual void DoGetSizeMM(int* width, int* height) const;
d16b634f 62
83df96d6 63public:
b1263dcf 64 virtual void ComputeScaleAndOrigin();
d16b634f 65
83df96d6
JS
66 wxCoord XDEV2LOG(wxCoord x) const
67 {
68 wxCoord new_x = x - m_deviceOriginX;
69 if (new_x > 0)
70 return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
71 else
72 return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
73 }
74 wxCoord XDEV2LOGREL(wxCoord x) const
75 {
76 if (x > 0)
77 return (wxCoord)((double)(x) / m_scaleX + 0.5);
78 else
79 return (wxCoord)((double)(x) / m_scaleX - 0.5);
80 }
81 wxCoord YDEV2LOG(wxCoord y) const
82 {
83 wxCoord new_y = y - m_deviceOriginY;
84 if (new_y > 0)
85 return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
86 else
87 return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
88 }
89 wxCoord YDEV2LOGREL(wxCoord y) const
90 {
91 if (y > 0)
92 return (wxCoord)((double)(y) / m_scaleY + 0.5);
93 else
94 return (wxCoord)((double)(y) / m_scaleY - 0.5);
95 }
96 wxCoord XLOG2DEV(wxCoord x) const
97 {
98 wxCoord new_x = x - m_logicalOriginX;
99 if (new_x > 0)
100 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
101 else
102 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
103 }
83df96d6
JS
104 wxCoord XLOG2DEVREL(wxCoord x) const
105 {
106 if (x > 0)
107 return (wxCoord)((double)(x) * m_scaleX + 0.5);
108 else
109 return (wxCoord)((double)(x) * m_scaleX - 0.5);
110 }
111 wxCoord YLOG2DEV(wxCoord y) const
112 {
113 wxCoord new_y = y - m_logicalOriginY;
114 if (new_y > 0)
115 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
116 else
117 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
118 }
83df96d6
JS
119 wxCoord YLOG2DEVREL(wxCoord y) const
120 {
121 if (y > 0)
122 return (wxCoord)((double)(y) * m_scaleY + 0.5);
123 else
124 return (wxCoord)((double)(y) * m_scaleY - 0.5);
125 }
d16b634f 126
83df96d6
JS
127public:
128 // not sure what for, but what is a mm on a screen you don't know the size of?
129 double m_mm_to_pix_x,m_mm_to_pix_y;
d16b634f 130
83df96d6
JS
131 // recompute scale?
132 bool m_needComputeScaleX, m_needComputeScaleY;
d16b634f 133
3cd0b8c5
RR
134
135private:
136 DECLARE_ABSTRACT_CLASS(wxDC)
83df96d6
JS
137};
138
139#endif
140// _WX_DC_H_