1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        wx/motif/dcclient.h 
   3 // Purpose:     wxClientDC, wxPaintDC and wxWindowDC classes 
   4 // Author:      Julian Smart 
   8 // Copyright:   (c) Julian Smart 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 #ifndef _WX_DCCLIENT_H_ 
  13 #define _WX_DCCLIENT_H_ 
  17 // ---------------------------------------------------------------------------- 
  19 // ---------------------------------------------------------------------------- 
  21 class WXDLLIMPEXP_FWD_CORE wxWindowDC
; 
  22 class WXDLLIMPEXP_FWD_CORE wxWindow
; 
  24 // Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented 
  25 // differently. On many platforms, however, they will be the same. 
  27 //----------------------------------------------------------------------------- 
  29 //----------------------------------------------------------------------------- 
  31 class WXDLLEXPORT wxWindowDC 
: public wxDC
 
  33     DECLARE_DYNAMIC_CLASS(wxWindowDC
) 
  37     wxWindowDC( wxWindow 
*win 
); 
  39     virtual ~wxWindowDC(); 
  41     // TODO this function is Motif-only for now - should it go into base class? 
  42     void Clear(const wxRect
& rect
); 
  44     // implement base class pure virtuals 
  45     // ---------------------------------- 
  49     virtual void SetFont(const wxFont
& font
); 
  50     virtual void SetPen(const wxPen
& pen
); 
  51     virtual void SetBrush(const wxBrush
& brush
); 
  52     virtual void SetBackground(const wxBrush
& brush
); 
  53     virtual void SetBackgroundMode(int mode
); 
  54     virtual void SetPalette(const wxPalette
& palette
); 
  55     virtual void SetLogicalFunction( int function 
); 
  57     virtual void SetTextForeground(const wxColour
& colour
); 
  58     virtual void SetTextBackground(const wxColour
& colour
); 
  60     virtual wxCoord 
GetCharHeight() const; 
  61     virtual wxCoord 
GetCharWidth() const; 
  62     virtual void DoGetTextExtent(const wxString
& string
, 
  63         wxCoord 
*x
, wxCoord 
*y
, 
  64         wxCoord 
*descent 
= NULL
, 
  65         wxCoord 
*externalLeading 
= NULL
, 
  66         const wxFont 
*theFont 
= NULL
) const; 
  68     virtual bool CanDrawBitmap() const; 
  69     virtual bool CanGetTextExtent() const; 
  71     virtual int GetDepth() const; 
  72     virtual wxSize 
GetPPI() const; 
  74     virtual void DestroyClippingRegion(); 
  76     // Helper function for setting clipping 
  77     void SetDCClipping(WXRegion region
); 
  79     // implementation from now on 
  80     // -------------------------- 
  82     WXGC 
GetGC() const { return m_gc
; } 
  83     WXGC 
GetBackingGC() const { return m_gcBacking
; } 
  84     WXDisplay
* GetDisplay() const { return m_display
; } 
  85     bool GetAutoSetting() const { return (m_autoSetting 
!= 0); } // See comment in dcclient.cpp 
  86     void SetAutoSetting(bool flag
) { m_autoSetting 
= flag
; } 
  89     // note that this function will call colour.SetPixel, 
  90     // and will do one of curCol = colour, curCol = wxWHITE, curCol = wxBLACK 
  91     // roundToWhite has an effect for monochrome display only 
  92     // if roundToWhite == true then the colour will be set to white unless 
  93     // it is RGB 0x000000;if roundToWhite == true the colour wull be set to 
  94     // black unless it id RGB 0xffffff 
  95     WXPixel 
CalculatePixel(wxColour
& colour
, wxColour
& curCol
, 
  96                            bool roundToWhite
) const; 
  97     // sets the foreground pixel taking into account the 
  98     // currently selected logical operation 
  99     void SetForegroundPixelWithLogicalFunction(WXPixel pixel
); 
 101     virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
, 
 102         int style 
= wxFLOOD_SURFACE
); 
 104     virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour 
*col
) const; 
 106     virtual void DoDrawPoint(wxCoord x
, wxCoord y
); 
 107     virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
); 
 109     virtual void DoDrawArc(wxCoord x1
, wxCoord y1
, 
 110         wxCoord x2
, wxCoord y2
, 
 111         wxCoord xc
, wxCoord yc
); 
 112     virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
, 
 113         double sa
, double ea
); 
 115     virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
); 
 116     virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
, 
 117         wxCoord width
, wxCoord height
, 
 119     virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
); 
 121     virtual void DoCrossHair(wxCoord x
, wxCoord y
); 
 123     virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
); 
 124     virtual void DoDrawRotatedText(const wxString 
&text
, wxCoord x
, wxCoord y
, double angle
); 
 126     virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
, 
 127         wxDC 
*source
, wxCoord xsrc
, wxCoord ysrc
, 
 128         int rop 
= wxCOPY
, bool useMask 
= false, wxCoord xsrcMask 
= -1, wxCoord ysrcMask 
= -1); 
 130     virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
); 
 131     virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
, 
 132         wxCoord width
, wxCoord height
); 
 134     virtual void DoDrawLines(int n
, wxPoint points
[], 
 135         wxCoord xoffset
, wxCoord yoffset
); 
 136     virtual void DoDrawPolygon(int n
, wxPoint points
[], 
 137         wxCoord xoffset
, wxCoord yoffset
, 
 138         int fillStyle 
= wxODDEVEN_RULE
); 
 140     void DoGetSize( int *width
, int *height 
) const; 
 142     // common part of constructors 
 147     WXDisplay
*   m_display
; 
 149     // Pixmap for drawing on 
 151     // Last clipping region set on th GC, this is the combination 
 152     // of paint clipping region and all user-defined clipping regions 
 153     WXRegion     m_clipRegion
; 
 155     // Not sure if we'll need all of these 
 156     WXPixel      m_backgroundPixel
; 
 157     wxColour     m_currentColour
; 
 158     int          m_currentPenWidth 
; 
 159     int          m_currentPenJoin 
; 
 160     int          m_currentPenCap 
; 
 161     int          m_currentPenDashCount 
; 
 162     wxX11Dash
*   m_currentPenDash 
; 
 163     wxBitmap     m_currentStipple 
; 
 166     int          m_autoSetting 
; // See comment in dcclient.cpp 
 169 class WXDLLEXPORT wxPaintDC
: public wxWindowDC
 
 171     DECLARE_DYNAMIC_CLASS(wxPaintDC
) 
 175     wxPaintDC(wxWindow
* win
); 
 177     virtual ~wxPaintDC(); 
 180 class WXDLLEXPORT wxClientDC
: public wxWindowDC
 
 182     DECLARE_DYNAMIC_CLASS(wxClientDC
) 
 186     wxClientDC(wxWindow
* win
) : wxWindowDC(win
) { } 
 189 #endif // _WX_DCCLIENT_H_