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