public:
wxDCCacheEntry(WXHBITMAP hBitmap, int w, int h, int depth);
wxDCCacheEntry(WXHDC hDC, int depth);
- ~wxDCCacheEntry();
+ virtual ~wxDCCacheEntry();
WXHBITMAP m_bitmap;
WXHDC m_dc;
{
public:
wxDC(WXHDC hDC) { Init(); m_hDC = hDC; }
- ~wxDC();
+ virtual ~wxDC();
// implement base class pure virtuals
// ----------------------------------
virtual wxCoord GetCharHeight() const;
virtual wxCoord GetCharWidth() const;
- virtual void DoGetTextExtent(const wxString& string,
- wxCoord *x, wxCoord *y,
- wxCoord *descent = NULL,
- wxCoord *externalLeading = NULL,
- wxFont *theFont = NULL) const;
- virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
virtual bool CanDrawBitmap() const;
virtual bool CanGetTextExtent() const;
static void ClearCache();
#endif
+ // RTL related functions
+ // ---------------------
+
+ // get or change the layout direction (LTR or RTL) for this dc,
+ // wxLayout_Default is returned if layout direction is not supported
+ virtual wxLayoutDirection GetLayoutDirection() const;
+ virtual void SetLayoutDirection(wxLayoutDirection dir);
+
protected:
void Init()
{
// classes
wxDC() { Init(); }
+ virtual void DoGetTextExtent(const wxString& string,
+ wxCoord *x, wxCoord *y,
+ wxCoord *descent = NULL,
+ wxCoord *externalLeading = NULL,
+ wxFont *theFont = NULL) const;
+ virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
+
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
int style = wxFLOOD_SURFACE);
+ virtual void DoGradientFillLinear(const wxRect& rect,
+ const wxColour& initialColour,
+ const wxColour& destColour,
+ wxDirection nDirection = wxEAST);
+
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
virtual void DoDrawPoint(wxCoord x, wxCoord y);
class WXDLLEXPORT wxDCTemp : public wxDC
{
public:
- wxDCTemp(WXHDC hdc) : wxDC(hdc)
+ // construct a temporary DC with the specified HDC and size (it should be
+ // specified whenever we know it for this HDC)
+ wxDCTemp(WXHDC hdc, const wxSize& size = wxDefaultSize)
+ : wxDC(hdc),
+ m_size(size)
{
}
SetHDC((WXHDC)NULL);
}
+protected:
virtual void DoGetSize(int *w, int *h) const
{
- wxFAIL_MSG( _T("no way to retrieve the size of generic DC") );
+ wxASSERT_MSG( m_size.IsFullySpecified(),
+ _T("size of this DC hadn't been set and is unknown") );
if ( w )
- *w = 0;
+ *w = m_size.x;
if ( h )
- *h = 0;
+ *h = m_size.y;
}
private:
+ // size of this DC must be explicitly set by SetSize() as we have no way to
+ // find it ourselves
+ const wxSize m_size;
+
DECLARE_NO_COPY_CLASS(wxDCTemp)
};