]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/gridctrl.h
Implement dc mirroring for RTL.
[wxWidgets.git] / include / wx / generic / gridctrl.h
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 #if wxUSE_GRID
16
17 #include "wx/grid.h"
18 #include "wx/string.h"
19 #include "wx/arrstr.h"
20 #include "wx/datetime.h"
21
22 #define wxGRID_VALUE_CHOICEINT _T("choiceint")
23 #define wxGRID_VALUE_DATETIME _T("datetime")
24
25 #if wxUSE_DATETIME
26
27 // the default renderer for the cells containing Time and dates..
28 class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
29 {
30 public:
31 wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
32 const wxString& informat = wxDefaultDateTimeFormat);
33
34 // draw the string right aligned
35 virtual void Draw(wxGrid& grid,
36 wxGridCellAttr& attr,
37 wxDC& dc,
38 const wxRect& rect,
39 int row, int col,
40 bool isSelected);
41
42 virtual wxSize GetBestSize(wxGrid& grid,
43 wxGridCellAttr& attr,
44 wxDC& dc,
45 int row, int col);
46
47 virtual wxGridCellRenderer *Clone() const;
48
49 // parameters string format is "width[,precision]"
50 virtual void SetParameters(const wxString& params);
51
52 protected:
53 wxString GetString(const wxGrid& grid, int row, int col);
54
55 wxString m_iformat;
56 wxString m_oformat;
57 wxDateTime m_dateDef;
58 wxDateTime::TimeZone m_tz;
59 };
60
61 #endif // wxUSE_DATETIME
62
63 // the default renderer for the cells containing Time and dates..
64 class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
65 {
66 public:
67 wxGridCellEnumRenderer( const wxString& choices = wxEmptyString );
68
69 // draw the string right aligned
70 virtual void Draw(wxGrid& grid,
71 wxGridCellAttr& attr,
72 wxDC& dc,
73 const wxRect& rect,
74 int row, int col,
75 bool isSelected);
76
77 virtual wxSize GetBestSize(wxGrid& grid,
78 wxGridCellAttr& attr,
79 wxDC& dc,
80 int row, int col);
81
82 virtual wxGridCellRenderer *Clone() const;
83
84 // parameters string format is "item1[,item2[...,itemN]]"
85 virtual void SetParameters(const wxString& params);
86
87 protected:
88 wxString GetString(const wxGrid& grid, int row, int col);
89
90 wxArrayString m_choices;
91 };
92
93
94 #if wxUSE_COMBOBOX
95
96 class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
97 {
98 public:
99 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
100 virtual ~wxGridCellEnumEditor() {}
101
102 virtual wxGridCellEditor* Clone() const;
103
104 virtual bool EndEdit(int row, int col, wxGrid* grid);
105 virtual void BeginEdit(int row, int col, wxGrid* grid);
106
107 private:
108 long int m_startint;
109
110 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
111 };
112
113 #endif // wxUSE_COMBOBOX
114
115 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
116 {
117 public:
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
129 class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
130 {
131 public:
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
149 private:
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 // #if wxUSE_GRID
159
160 #endif //_WX_GENERIC_GRIDCTRL_H_
161