1 ///////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/generic/dvrenderer.h
3 // Purpose:     wxDataViewRenderer for generic wxDataViewCtrl implementation
4 // Author:      Robert Roebling, Vadim Zeitlin
5 // Created:     2009-11-07 (extracted from wx/generic/dataview.h)
6 // Copyright:   (c) 2006 Robert Roebling
7 //              (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence:     wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_GENERIC_DVRENDERER_H_
12 #define _WX_GENERIC_DVRENDERER_H_
13 
14 // ----------------------------------------------------------------------------
15 // wxDataViewRenderer
16 // ----------------------------------------------------------------------------
17 
18 class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewCustomRendererBase
19 {
20 public:
21     wxDataViewRenderer( const wxString &varianttype,
22                         wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
23                         int align = wxDVR_DEFAULT_ALIGNMENT );
24     virtual ~wxDataViewRenderer();
25 
26     virtual wxDC *GetDC();
27 
28     virtual void SetAlignment( int align );
29     virtual int GetAlignment() const;
30 
31     virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE)
32         { m_ellipsizeMode = mode; }
GetEllipsizeMode()33     virtual wxEllipsizeMode GetEllipsizeMode() const
34         { return m_ellipsizeMode; }
35 
SetMode(wxDataViewCellMode mode)36     virtual void SetMode( wxDataViewCellMode mode )
37         { m_mode = mode; }
GetMode()38     virtual wxDataViewCellMode GetMode() const
39         { return m_mode; }
40 
41     // implementation
42 
43     // This callback is used by generic implementation of wxDVC itself.  It's
44     // different from the corresponding ActivateCell() method which should only
45     // be overridable for the custom renderers while the generic implementation
46     // uses this one for all of them, including the standard ones.
47 
WXActivateCell(const wxRect & WXUNUSED (cell),wxDataViewModel * WXUNUSED (model),const wxDataViewItem & WXUNUSED (item),unsigned int WXUNUSED (col),const wxMouseEvent * WXUNUSED (mouseEvent))48     virtual bool WXActivateCell(const wxRect& WXUNUSED(cell),
49                                 wxDataViewModel *WXUNUSED(model),
50                                 const wxDataViewItem & WXUNUSED(item),
51                                 unsigned int WXUNUSED(col),
52                                 const wxMouseEvent* WXUNUSED(mouseEvent))
53         { return false; }
54 
55 private:
56     int                          m_align;
57     wxDataViewCellMode           m_mode;
58 
59     wxEllipsizeMode m_ellipsizeMode;
60 
61     wxDC *m_dc;
62 
63     DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
64 };
65 
66 #endif // _WX_GENERIC_DVRENDERER_H_
67 
68