dvrenderer.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #ifndef _WX_GENERIC_DVRENDERER_H_
  11. #define _WX_GENERIC_DVRENDERER_H_
  12. // ----------------------------------------------------------------------------
  13. // wxDataViewRenderer
  14. // ----------------------------------------------------------------------------
  15. class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewCustomRendererBase
  16. {
  17. public:
  18. wxDataViewRenderer( const wxString &varianttype,
  19. wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
  20. int align = wxDVR_DEFAULT_ALIGNMENT );
  21. virtual ~wxDataViewRenderer();
  22. virtual wxDC *GetDC();
  23. virtual void SetAlignment( int align );
  24. virtual int GetAlignment() const;
  25. virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE)
  26. { m_ellipsizeMode = mode; }
  27. virtual wxEllipsizeMode GetEllipsizeMode() const
  28. { return m_ellipsizeMode; }
  29. virtual void SetMode( wxDataViewCellMode mode )
  30. { m_mode = mode; }
  31. virtual wxDataViewCellMode GetMode() const
  32. { return m_mode; }
  33. // implementation
  34. // This callback is used by generic implementation of wxDVC itself. It's
  35. // different from the corresponding ActivateCell() method which should only
  36. // be overridable for the custom renderers while the generic implementation
  37. // uses this one for all of them, including the standard ones.
  38. virtual bool WXActivateCell(const wxRect& WXUNUSED(cell),
  39. wxDataViewModel *WXUNUSED(model),
  40. const wxDataViewItem & WXUNUSED(item),
  41. unsigned int WXUNUSED(col),
  42. const wxMouseEvent* WXUNUSED(mouseEvent))
  43. { return false; }
  44. private:
  45. int m_align;
  46. wxDataViewCellMode m_mode;
  47. wxEllipsizeMode m_ellipsizeMode;
  48. wxDC *m_dc;
  49. DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
  50. };
  51. #endif // _WX_GENERIC_DVRENDERER_H_