]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/gridctrl.h
Fix bug in GetTimeZone where timezone wasn't set.
[wxWidgets.git] / include / wx / generic / gridctrl.h
CommitLineData
d10f4bf9
VZ
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)
65571936 9// Licence: wxWindows licence
d10f4bf9
VZ
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GENERIC_GRIDCTRL_H_
13#define _WX_GENERIC_GRIDCTRL_H_
14
f7556ff0 15#if wxUSE_GRID
b53dc7d6 16
d10f4bf9
VZ
17#include "wx/grid.h"
18#include "wx/string.h"
2da2f941 19#include "wx/arrstr.h"
d10f4bf9
VZ
20#include "wx/datetime.h"
21
22#define wxGRID_VALUE_CHOICEINT _T("choiceint")
23#define wxGRID_VALUE_DATETIME _T("datetime")
24
e2b87f38
VZ
25#if wxUSE_DATETIME
26
d10f4bf9 27// the default renderer for the cells containing Time and dates..
12f190b0 28class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
29{
30public:
fbfb8bcc
VZ
31 wxGridCellDateTimeRenderer(const wxString& outformat = wxDefaultDateTimeFormat,
32 const wxString& informat = wxDefaultDateTimeFormat);
d10f4bf9
VZ
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
52protected:
fbfb8bcc 53 wxString GetString(const wxGrid& grid, int row, int col);
d10f4bf9
VZ
54
55 wxString m_iformat;
56 wxString m_oformat;
57 wxDateTime m_dateDef;
58 wxDateTime::TimeZone m_tz;
59};
60
e2b87f38 61#endif // wxUSE_DATETIME
d10f4bf9
VZ
62
63// the default renderer for the cells containing Time and dates..
12f190b0 64class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
65{
66public:
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
87protected:
fbfb8bcc 88 wxString GetString(const wxGrid& grid, int row, int col);
d10f4bf9
VZ
89
90 wxArrayString m_choices;
91};
92
93
3379ed37
VZ
94#if wxUSE_COMBOBOX
95
12f190b0 96class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
d10f4bf9
VZ
97{
98public:
99 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
6fb99eb3 100 virtual ~wxGridCellEnumEditor() {}
d10f4bf9
VZ
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
107private:
108 long int m_startint;
fc7a2a60
VZ
109
110 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
d10f4bf9
VZ
111};
112
3379ed37 113#endif // wxUSE_COMBOBOX
d10f4bf9 114
12f190b0 115class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
d10f4bf9
VZ
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; }
fc7a2a60
VZ
125
126 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
d10f4bf9
VZ
127};
128
12f190b0 129class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
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,
fbfb8bcc 152 const wxGridCellAttr& attr,
d10f4bf9
VZ
153 const wxRect& rect,
154 int row, int col);
155
156};
157
f7556ff0 158#endif // #if wxUSE_GRID
b53dc7d6 159
d10f4bf9
VZ
160#endif //_WX_GENERIC_GRIDCTRL_H_
161