]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/dcclient.h
added UnsetToolTip() which is also provided (as empty function) in wxUSE_TOOLTIPS...
[wxWidgets.git] / include / wx / motif / dcclient.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/dcclient.h
3 // Purpose: wxClientDCImpl, wxPaintDCImpl and wxWindowDCImpl classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DCCLIENT_H_
13 #define _WX_DCCLIENT_H_
14
15 #include "wx/motif/dc.h"
16
17 class WXDLLIMPEXP_FWD_CORE wxWindow;
18
19 //-----------------------------------------------------------------------------
20 // wxWindowDCImpl
21 //-----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxMotifDCImpl
24 {
25 public:
26 wxWindowDCImpl(wxDC *owner);
27 wxWindowDCImpl(wxDC *owner, wxWindow *win);
28
29 virtual ~wxWindowDCImpl();
30
31 // TODO this function is Motif-only for now - should it go into base class?
32 void Clear(const wxRect& rect);
33
34 // implement base class pure virtuals
35 // ----------------------------------
36
37 virtual void Clear();
38
39 virtual void SetFont(const wxFont& font);
40 virtual void SetPen(const wxPen& pen);
41 virtual void SetBrush(const wxBrush& brush);
42 virtual void SetBackground(const wxBrush& brush);
43 virtual void SetBackgroundMode(int mode);
44 virtual void SetPalette(const wxPalette& palette);
45 virtual void SetLogicalFunction( int function );
46
47 virtual void SetTextForeground(const wxColour& colour);
48 virtual void SetTextBackground(const wxColour& colour);
49
50 virtual wxCoord GetCharHeight() const;
51 virtual wxCoord GetCharWidth() const;
52 virtual void DoGetTextExtent(const wxString& string,
53 wxCoord *x, wxCoord *y,
54 wxCoord *descent = NULL,
55 wxCoord *externalLeading = NULL,
56 const wxFont *theFont = NULL) const;
57
58 virtual bool CanDrawBitmap() const;
59 virtual bool CanGetTextExtent() const;
60
61 virtual int GetDepth() const;
62 virtual wxSize GetPPI() const;
63
64 virtual void DestroyClippingRegion();
65
66 // Helper function for setting clipping
67 void SetDCClipping(WXRegion region);
68
69 // implementation from now on
70 // --------------------------
71
72 WXGC GetGC() const { return m_gc; }
73 WXGC GetBackingGC() const { return m_gcBacking; }
74 WXDisplay* GetDisplay() const { return m_display; }
75 bool GetAutoSetting() const { return (m_autoSetting != 0); } // See comment in dcclient.cpp
76 void SetAutoSetting(bool flag) { m_autoSetting = flag; }
77
78 protected:
79 // note that this function will call colour.SetPixel,
80 // and will do one of curCol = colour, curCol = wxWHITE, curCol = wxBLACK
81 // roundToWhite has an effect for monochrome display only
82 // if roundToWhite == true then the colour will be set to white unless
83 // it is RGB 0x000000;if roundToWhite == true the colour wull be set to
84 // black unless it id RGB 0xffffff
85 WXPixel CalculatePixel(wxColour& colour, wxColour& curCol,
86 bool roundToWhite) const;
87 // sets the foreground pixel taking into account the
88 // currently selected logical operation
89 void SetForegroundPixelWithLogicalFunction(WXPixel pixel);
90
91 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
92 int style = wxFLOOD_SURFACE);
93
94 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
95
96 virtual void DoDrawPoint(wxCoord x, wxCoord y);
97 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
98
99 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
100 wxCoord x2, wxCoord y2,
101 wxCoord xc, wxCoord yc);
102 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
103 double sa, double ea);
104
105 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
106 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
107 wxCoord width, wxCoord height,
108 double radius);
109 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
110
111 virtual void DoCrossHair(wxCoord x, wxCoord y);
112
113 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
114 virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle);
115
116 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
117 wxDC *source, wxCoord xsrc, wxCoord ysrc,
118 int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
119
120 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
121 wxCoord width, wxCoord height);
122 virtual void DoSetDeviceClippingRegion(const wxRegion& region);
123
124 virtual void DoDrawLines(int n, wxPoint points[],
125 wxCoord xoffset, wxCoord yoffset);
126 virtual void DoDrawPolygon(int n, wxPoint points[],
127 wxCoord xoffset, wxCoord yoffset,
128 int fillStyle = wxODDEVEN_RULE);
129
130 void DoGetSize( int *width, int *height ) const;
131
132 // common part of constructors
133 void Init();
134
135 WXGC m_gc;
136 WXGC m_gcBacking;
137 WXDisplay* m_display;
138 wxWindow* m_window;
139 // Pixmap for drawing on
140 WXPixmap m_pixmap;
141 // Last clipping region set on th GC, this is the combination
142 // of paint clipping region and all user-defined clipping regions
143 WXRegion m_clipRegion;
144
145 // Not sure if we'll need all of these
146 WXPixel m_backgroundPixel;
147 wxColour m_currentColour;
148 int m_currentPenWidth ;
149 int m_currentPenJoin ;
150 int m_currentPenCap ;
151 int m_currentPenDashCount ;
152 wxX11Dash* m_currentPenDash ;
153 wxBitmap m_currentStipple ;
154 int m_currentStyle ;
155 int m_currentFill ;
156 int m_autoSetting ; // See comment in dcclient.cpp
157
158 DECLARE_DYNAMIC_CLASS(wxWindowDCImpl)
159 };
160
161 class WXDLLIMPEXP_CORE wxPaintDCImpl: public wxWindowDCImpl
162 {
163 public:
164 wxPaintDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { }
165 wxPaintDCImpl(wxDC *owner, wxWindow* win);
166
167 virtual ~wxPaintDCImpl();
168
169 DECLARE_DYNAMIC_CLASS(wxPaintDCImpl)
170 };
171
172 class WXDLLIMPEXP_CORE wxClientDCImpl: public wxWindowDCImpl
173 {
174 public:
175 wxClientDCImpl(wxDC *owner) : wxWindowDCImpl(owner) { }
176 wxClientDCImpl(wxDC *owner, wxWindow* win)
177 : wxWindowDCImpl(owner, win) { }
178
179 DECLARE_DYNAMIC_CLASS(wxClientDCImpl)
180 };
181
182 #endif // _WX_DCCLIENT_H_