]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dvrenderer.h
No real changes, just make wxWindow::CanScroll() virtual.
[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)
6eec70b9
VZ
6// Copyright: (c) 2006 Robert Roebling
7// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_GTK_DVRENDERER_H_
12#define _WX_GTK_DVRENDERER_H_
13
17cbc244 14typedef struct _GtkCellRendererText GtkCellRendererText;
6eec70b9
VZ
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
29e461a2 50 virtual void GtkOnTextEdited(const char *itempath, const wxString& value);
6eec70b9
VZ
51
52 GtkCellRenderer* GetGtkHandle() { return m_renderer; }
53 void GtkInitHandlers();
3e81bbbf 54 void GtkUpdateAlignment() { GtkApplyAlignment(m_renderer); }
6eec70b9 55
c2a738e3
VZ
56 // should be overridden to return true if the renderer supports properties
57 // corresponding to wxDataViewItemAttr field, see wxGtkTreeCellDataFunc()
58 // for details
59 virtual bool GtkSupportsAttrs() const { return false; }
60
c80cde00
VZ
61 // if GtkSupportsAttrs() returns true, this function will be called to
62 // effectively set the attribute to use for rendering the next item
63 //
64 // it should return true if the attribute had any non-default properties
65 virtual bool GtkSetAttr(const wxDataViewItemAttr& WXUNUSED(attr))
66 { return false; }
67
68
c2a738e3
VZ
69 // these functions are only called if GtkSupportsAttrs() returns true and
70 // are used to remember whether the renderer currently uses the default
71 // attributes or if we changed (and not reset them)
6eec70b9
VZ
72 bool GtkIsUsingDefaultAttrs() const { return m_usingDefaultAttrs; }
73 void GtkSetUsingDefaultAttrs(bool def) { m_usingDefaultAttrs = def; }
74
17cbc244
VZ
75 // return the text renderer used by this renderer for setting text cell
76 // specific attributes: can return NULL if this renderer doesn't render any
77 // text
78 virtual GtkCellRendererText *GtkGetTextRenderer() const { return NULL; }
9fc221aa
RR
79
80 wxDataViewCellMode GtkGetMode() { return m_mode; }
17cbc244 81
6eec70b9
VZ
82protected:
83 virtual void GtkOnCellChanged(const wxVariant& value,
84 const wxDataViewItem& item,
85 unsigned col);
86
3e81bbbf
VZ
87 // Apply our effective alignment (i.e. m_alignment if specified or the
88 // associated column alignment by default) to the given renderer.
89 void GtkApplyAlignment(GtkCellRenderer *renderer);
6eec70b9 90
9fc221aa
RR
91 GtkCellRenderer *m_renderer;
92 int m_alignment;
93 wxDataViewCellMode m_mode;
6eec70b9
VZ
94
95 // true if we hadn't changed any visual attributes or restored them since
96 // doing this
97 bool m_usingDefaultAttrs;
98
99protected:
100 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer)
101};
102
103#endif // _WX_GTK_DVRENDERER_H_
104