ToolMap
Loading...
Searching...
No Matches
tocrenderer.h
1#ifndef FEATURE_TOC_TOCRENDERER_H
2#define FEATURE_TOC_TOCRENDERER_H
3
4#include "wx/wxprec.h"
5#ifndef WX_PRECOMP
6#include "wx/wx.h"
7#endif
8#include <wx/dataview.h>
9
13class tocRendererData : public wxVariantData {
14 public:
16 virtual tocRendererData* Clone() const;
17 virtual bool Eq(wxVariantData& data) const;
18 virtual wxString GetType() const;
19
20 wxString m_layer_name;
21 int m_ImageIndex;
22 bool m_IsEditing;
23 bool m_IsVisible;
24
25 protected:
26 virtual ~tocRendererData();
27};
28
32class tocRenderer : public wxDataViewCustomRenderer {
33 public:
34 // This renderer can be either activatable or editable, for demonstration
35 // purposes. In real programs, you should select whether the user should be
36 // able to activate or edit the cell and it doesn't make sense to switch
37 // between the two -- but this is just an example, so it doesn't stop us.
38 explicit tocRenderer(wxDataViewCellMode mode, wxDataViewTreeCtrl* parent);
39
40 virtual bool Render(wxRect rect, wxDC* dc, int state) wxOVERRIDE;
41
42 virtual bool ActivateCell(const wxRect& cell, wxDataViewModel* model, const wxDataViewItem& item,
43 unsigned int WXUNUSED(col), const wxMouseEvent* mouseEvent) wxOVERRIDE;
44
45 virtual wxSize GetSize() const wxOVERRIDE;
46
47 virtual bool SetValue(const wxVariant& value) wxOVERRIDE;
48
49 virtual bool GetValue(wxVariant& value) const wxOVERRIDE;
50
51 virtual bool HasEditorCtrl() const wxOVERRIDE;
52
53 virtual wxWindow* CreateEditorCtrl(wxWindow* parent, wxRect labelRect, const wxVariant& value) wxOVERRIDE;
54
55 virtual bool GetValueFromEditorCtrl(wxWindow* ctrl, wxVariant& value) wxOVERRIDE;
56
57 private:
58 void _CreateBitmaps();
59
60 wxString m_LayerName;
61 int m_ImageIndex;
62 bool m_IsEditing;
63 bool m_IsVisible;
64
65 wxImageList m_ImageList;
66 wxDataViewCtrl* m_ParentCtrl;
67};
68
69#endif // FEATURE_TOC_TOCRENDERER_H
Used for data exchange between tocRenderer and TocCtrlModel.
Definition tocrenderer.h:13
Custom renderer for TocCtrl.
Definition tocrenderer.h:32