]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/gridctrl.h
Fix wxCalendarEvent and wxTextUrlEvent event classes implementing Clone() correctly...
[wxWidgets.git] / include / wx / generic / gridctrl.h
... / ...
CommitLineData
1///////////////////////////////////////////////////////////////////////////
2// Name: generic/gridctrl.h
3// Purpose: wxGrid controls
4// Author: Paul Gammans, Roger Gammans
5// Modified by:
6// Created: 11/04/2001
7// RCS-ID: $Id$
8// Copyright: (c) The Computer Surgery (paul@compsurg.co.uk)
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GENERIC_GRIDCTRL_H_
13#define _WX_GENERIC_GRIDCTRL_H_
14
15#include "wx/grid.h"
16
17#if wxUSE_GRID
18
19#define wxGRID_VALUE_CHOICEINT _T("choiceint")
20#define wxGRID_VALUE_DATETIME _T("datetime")
21
22#if wxUSE_DATETIME
23
24#include "wx/datetime.h"
25
26// the default renderer for the cells containing Time and dates..
27class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
28{
29public:
30 wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
31 const wxString& informat = wxDefaultDateTimeFormat);
32
33 // draw the string right aligned
34 virtual void Draw(wxGrid& grid,
35 wxGridCellAttr& attr,
36 wxDC& dc,
37 const wxRect& rect,
38 int row, int col,
39 bool isSelected);
40
41 virtual wxSize GetBestSize(wxGrid& grid,
42 wxGridCellAttr& attr,
43 wxDC& dc,
44 int row, int col);
45
46 virtual wxGridCellRenderer *Clone() const;
47
48 // parameters string format is "width[,precision]"
49 virtual void SetParameters(const wxString& params);
50
51protected:
52 wxString GetString(const wxGrid& grid, int row, int col);
53
54 wxString m_iformat;
55 wxString m_oformat;
56 wxDateTime m_dateDef;
57 wxDateTime::TimeZone m_tz;
58};
59
60#endif // wxUSE_DATETIME
61
62// the default renderer for the cells containing Time and dates..
63class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
64{
65public:
66 wxGridCellEnumRenderer( const wxString& choices = wxEmptyString );
67
68 // draw the string right aligned
69 virtual void Draw(wxGrid& grid,
70 wxGridCellAttr& attr,
71 wxDC& dc,
72 const wxRect& rect,
73 int row, int col,
74 bool isSelected);
75
76 virtual wxSize GetBestSize(wxGrid& grid,
77 wxGridCellAttr& attr,
78 wxDC& dc,
79 int row, int col);
80
81 virtual wxGridCellRenderer *Clone() const;
82
83 // parameters string format is "item1[,item2[...,itemN]]"
84 virtual void SetParameters(const wxString& params);
85
86protected:
87 wxString GetString(const wxGrid& grid, int row, int col);
88
89 wxArrayString m_choices;
90};
91
92
93#if wxUSE_COMBOBOX
94
95class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
96{
97public:
98 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
99 virtual ~wxGridCellEnumEditor() {}
100
101 virtual wxGridCellEditor* Clone() const;
102
103 virtual void BeginEdit(int row, int col, wxGrid* grid);
104 virtual bool EndEdit(const wxString& oldval, wxString *newval);
105 virtual void ApplyEdit(int row, int col, wxGrid* grid);
106
107private:
108 long m_index;
109
110 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
111};
112
113#endif // wxUSE_COMBOBOX
114
115class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
116{
117public:
118 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
119 virtual void Create(wxWindow* parent,
120 wxWindowID id,
121 wxEvtHandler* evtHandler);
122
123 virtual wxGridCellEditor *Clone() const
124 { return new wxGridCellAutoWrapStringEditor; }
125
126 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
127};
128
129class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
130{
131public:
132 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
133
134 virtual void Draw(wxGrid& grid,
135 wxGridCellAttr& attr,
136 wxDC& dc,
137 const wxRect& rect,
138 int row, int col,
139 bool isSelected);
140
141 virtual wxSize GetBestSize(wxGrid& grid,
142 wxGridCellAttr& attr,
143 wxDC& dc,
144 int row, int col);
145
146 virtual wxGridCellRenderer *Clone() const
147 { return new wxGridCellAutoWrapStringRenderer; }
148
149private:
150 wxArrayString GetTextLines( wxGrid& grid,
151 wxDC& dc,
152 const wxGridCellAttr& attr,
153 const wxRect& rect,
154 int row, int col);
155
156};
157
158#endif // wxUSE_GRID
159#endif // _WX_GENERIC_GRIDCTRL_H_