]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/dc.h
added GetHimagelist()
[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
65571936 9// Licence: wxWindows licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_DC_H_
13#define _WX_DC_H_
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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)
d16b634f 47
af0bb3b1
VZ
48public:
49 wxDC();
50 ~wxDC() { }
d16b634f 51
af0bb3b1
VZ
52 // implement base class pure virtuals
53 // ----------------------------------
d16b634f 54
af0bb3b1 55 virtual wxSize GetPPI() const;
d16b634f 56
af0bb3b1
VZ
57 virtual void SetMapMode(int mode);
58 virtual void SetUserScale(double x, double y);
af0bb3b1 59 virtual void SetLogicalScale(double x, double y);
7b65ea1a
MB
60 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
61 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
af0bb3b1 62 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
d16b634f 63
af0bb3b1 64protected:
7b65ea1a
MB
65 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
66 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
b1263dcf 67 bool useMask = false);
d16b634f 68
7b65ea1a 69 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
83df96d6 70 wxCoord width, wxCoord height);
af0bb3b1
VZ
71 virtual void DoGetSize(int *width, int *height) const;
72 virtual void DoGetSizeMM(int* width, int* height) const;
d16b634f 73
af0bb3b1 74public:
b1263dcf 75 virtual void ComputeScaleAndOrigin();
d16b634f 76
7b65ea1a 77 wxCoord XDEV2LOG(wxCoord x) const
9b6dbb09 78 {
7b65ea1a 79 wxCoord new_x = x - m_deviceOriginX;
af0bb3b1 80 if (new_x > 0)
7b65ea1a 81 return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
af0bb3b1 82 else
7b65ea1a 83 return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
9b6dbb09 84 }
7b65ea1a 85 wxCoord XDEV2LOGREL(wxCoord x) const
9b6dbb09 86 {
af0bb3b1 87 if (x > 0)
7b65ea1a 88 return (wxCoord)((double)(x) / m_scaleX + 0.5);
af0bb3b1 89 else
7b65ea1a 90 return (wxCoord)((double)(x) / m_scaleX - 0.5);
9b6dbb09 91 }
7b65ea1a 92 wxCoord YDEV2LOG(wxCoord y) const
9b6dbb09 93 {
7b65ea1a 94 wxCoord new_y = y - m_deviceOriginY;
af0bb3b1 95 if (new_y > 0)
7b65ea1a 96 return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
af0bb3b1 97 else
7b65ea1a 98 return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
9b6dbb09 99 }
7b65ea1a 100 wxCoord YDEV2LOGREL(wxCoord y) const
9b6dbb09 101 {
af0bb3b1 102 if (y > 0)
7b65ea1a 103 return (wxCoord)((double)(y) / m_scaleY + 0.5);
af0bb3b1 104 else
7b65ea1a 105 return (wxCoord)((double)(y) / m_scaleY - 0.5);
9b6dbb09 106 }
7b65ea1a 107 wxCoord XLOG2DEV(wxCoord x) const
9b6dbb09 108 {
7b65ea1a 109 wxCoord new_x = x - m_logicalOriginX;
af0bb3b1 110 if (new_x > 0)
7b65ea1a 111 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
af0bb3b1 112 else
7b65ea1a 113 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
9b6dbb09 114 }
af0bb3b1 115 // Without device translation, for backing pixmap purposes
7b65ea1a 116 wxCoord XLOG2DEV_2(wxCoord x) const
9b6dbb09 117 {
7b65ea1a 118 wxCoord new_x = x - m_logicalOriginX;
af0bb3b1 119 if (new_x > 0)
7b65ea1a 120 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX;
af0bb3b1 121 else
7b65ea1a 122 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX;
9b6dbb09 123 }
7b65ea1a 124 wxCoord XLOG2DEVREL(wxCoord x) const
9b6dbb09 125 {
af0bb3b1 126 if (x > 0)
7b65ea1a 127 return (wxCoord)((double)(x) * m_scaleX + 0.5);
af0bb3b1 128 else
7b65ea1a 129 return (wxCoord)((double)(x) * m_scaleX - 0.5);
9b6dbb09 130 }
7b65ea1a 131 wxCoord YLOG2DEV(wxCoord y) const
9b6dbb09 132 {
7b65ea1a 133 wxCoord new_y = y - m_logicalOriginY;
af0bb3b1 134 if (new_y > 0)
7b65ea1a 135 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
af0bb3b1 136 else
7b65ea1a 137 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
9b6dbb09 138 }
af0bb3b1 139 // Without device translation, for backing pixmap purposes
7b65ea1a 140 wxCoord YLOG2DEV_2(wxCoord y) const
9b6dbb09 141 {
7b65ea1a 142 wxCoord new_y = y - m_logicalOriginY;
af0bb3b1 143 if (new_y > 0)
7b65ea1a 144 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY;
af0bb3b1 145 else
7b65ea1a 146 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY;
9b6dbb09 147 }
7b65ea1a 148 wxCoord YLOG2DEVREL(wxCoord y) const
9b6dbb09 149 {
af0bb3b1 150 if (y > 0)
7b65ea1a 151 return (wxCoord)((double)(y) * m_scaleY + 0.5);
af0bb3b1 152 else
7b65ea1a 153 return (wxCoord)((double)(y) * m_scaleY - 0.5);
9b6dbb09 154 }
d16b634f 155
af0bb3b1
VZ
156public:
157 // not sure what for, but what is a mm on a screen you don't know the size of?
158 double m_mm_to_pix_x,m_mm_to_pix_y;
d16b634f 159
af0bb3b1
VZ
160 // recompute scale?
161 bool m_needComputeScaleX, m_needComputeScaleY;
d16b634f 162
9b6dbb09
JS
163};
164
165#endif
83df96d6 166// _WX_DC_H_