]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dvrenderer.h
Big wxDataViewCtrl renderer classes refactoring.
[wxWidgets.git] / include / wx / gtk / dvrenderer.h
CommitLineData
6eec70b9
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/gtk/dvrenderer.h
3// Purpose: wxDataViewRenderer for GTK wxDataViewCtrl implementation
4// Author: Robert Roebling, Vadim Zeitlin
5// Created: 2009-11-07 (extracted from wx/gtk/dataview.h)
6// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
7// Copyright: (c) 2006 Robert Roebling
8// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GTK_DVRENDERER_H_
13#define _WX_GTK_DVRENDERER_H_
14
15typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
16
17// ----------------------------------------------------------------------------
18// wxDataViewRenderer
19// ----------------------------------------------------------------------------
20
21class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase
22{
23public:
24 wxDataViewRenderer( const wxString &varianttype,
25 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
26 int align = wxDVR_DEFAULT_ALIGNMENT );
27
28 virtual void SetMode( wxDataViewCellMode mode );
29 virtual wxDataViewCellMode GetMode() const;
30
31 virtual void SetAlignment( int align );
32 virtual int GetAlignment() const;
33
34 virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
35 virtual wxEllipsizeMode GetEllipsizeMode() const;
36
37 // GTK-specific implementation
38 // ---------------------------
39
40 // pack the GTK cell renderers used by this renderer to the given column
41 //
42 // by default only a single m_renderer is used but some renderers use more
43 // than one GTK cell renderer
44 virtual void GtkPackIntoColumn(GtkTreeViewColumn *column);
45
46 // called when the cell value was edited by user with the new value
47 //
48 // it validates the new value and notifies the model about the change by
49 // calling GtkOnCellChanged() if it was accepted
50 void GtkOnTextEdited(const gchar *itempath, const wxString& value);
51
52 GtkCellRenderer* GetGtkHandle() { return m_renderer; }
53 void GtkInitHandlers();
54 void GtkUpdateAlignment();
55
56 bool GtkIsUsingDefaultAttrs() const { return m_usingDefaultAttrs; }
57 void GtkSetUsingDefaultAttrs(bool def) { m_usingDefaultAttrs = def; }
58
59protected:
60 virtual void GtkOnCellChanged(const wxVariant& value,
61 const wxDataViewItem& item,
62 unsigned col);
63
64
65 GtkCellRenderer *m_renderer;
66 int m_alignment;
67
68 // true if we hadn't changed any visual attributes or restored them since
69 // doing this
70 bool m_usingDefaultAttrs;
71
72protected:
73 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
74};
75
76#endif // _WX_GTK_DVRENDERER_H_
77