]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/gridctrl.h
Corrected copyright
[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)
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GENERIC_GRIDCTRL_H_
13#define _WX_GENERIC_GRIDCTRL_H_
14
af49c4b8 15#if defined(__GNUG__) && !defined(__APPLE__)
d10f4bf9
VZ
16 #pragma interface "gridctrl.h"
17#endif
18
b53dc7d6
GT
19#if wxUSE_GRID || wxUSE_NEW_GRID
20
d10f4bf9
VZ
21#include "wx/grid.h"
22#include "wx/string.h"
23#include "wx/datetime.h"
24
25#define wxGRID_VALUE_CHOICEINT _T("choiceint")
26#define wxGRID_VALUE_DATETIME _T("datetime")
27
e2b87f38
VZ
28#if wxUSE_DATETIME
29
d10f4bf9
VZ
30// the default renderer for the cells containing Time and dates..
31class WXDLLEXPORT wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
32{
33public:
34 wxGridCellDateTimeRenderer(wxString outformat = _T("%c"),
35 wxString informat = _T("%c"));
36
37 // draw the string right aligned
38 virtual void Draw(wxGrid& grid,
39 wxGridCellAttr& attr,
40 wxDC& dc,
41 const wxRect& rect,
42 int row, int col,
43 bool isSelected);
44
45 virtual wxSize GetBestSize(wxGrid& grid,
46 wxGridCellAttr& attr,
47 wxDC& dc,
48 int row, int col);
49
50 virtual wxGridCellRenderer *Clone() const;
51
52 // parameters string format is "width[,precision]"
53 virtual void SetParameters(const wxString& params);
54
55protected:
56 wxString GetString(wxGrid& grid, int row, int col);
57
58 wxString m_iformat;
59 wxString m_oformat;
60 wxDateTime m_dateDef;
61 wxDateTime::TimeZone m_tz;
62};
63
e2b87f38 64#endif // wxUSE_DATETIME
d10f4bf9
VZ
65
66// the default renderer for the cells containing Time and dates..
67class WXDLLEXPORT wxGridCellEnumRenderer : public wxGridCellStringRenderer
68{
69public:
70 wxGridCellEnumRenderer( const wxString& choices = wxEmptyString );
71
72 // draw the string right aligned
73 virtual void Draw(wxGrid& grid,
74 wxGridCellAttr& attr,
75 wxDC& dc,
76 const wxRect& rect,
77 int row, int col,
78 bool isSelected);
79
80 virtual wxSize GetBestSize(wxGrid& grid,
81 wxGridCellAttr& attr,
82 wxDC& dc,
83 int row, int col);
84
85 virtual wxGridCellRenderer *Clone() const;
86
87 // parameters string format is "item1[,item2[...,itemN]]"
88 virtual void SetParameters(const wxString& params);
89
90protected:
91 wxString GetString(wxGrid& grid, int row, int col);
92
93 wxArrayString m_choices;
94};
95
96
3379ed37
VZ
97#if wxUSE_COMBOBOX
98
d10f4bf9
VZ
99class WXDLLEXPORT wxGridCellEnumEditor : public wxGridCellChoiceEditor
100{
101public:
102 wxGridCellEnumEditor( const wxString& choices = wxEmptyString );
103 virtual ~wxGridCellEnumEditor() {};
104
105 virtual wxGridCellEditor* Clone() const;
106
107 virtual bool EndEdit(int row, int col, wxGrid* grid);
108 virtual void BeginEdit(int row, int col, wxGrid* grid);
109
110private:
111 long int m_startint;
112};
113
3379ed37 114#endif // wxUSE_COMBOBOX
d10f4bf9 115
f35719ef 116class WXDLLEXPORT wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
d10f4bf9
VZ
117{
118public:
119 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
120 virtual void Create(wxWindow* parent,
121 wxWindowID id,
122 wxEvtHandler* evtHandler);
123
124 virtual wxGridCellEditor *Clone() const
125 { return new wxGridCellAutoWrapStringEditor; }
126};
127
f35719ef 128class WXDLLEXPORT wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
129{
130public:
131 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
132
133 virtual void Draw(wxGrid& grid,
134 wxGridCellAttr& attr,
135 wxDC& dc,
136 const wxRect& rect,
137 int row, int col,
138 bool isSelected);
139
140 virtual wxSize GetBestSize(wxGrid& grid,
141 wxGridCellAttr& attr,
142 wxDC& dc,
143 int row, int col);
144
145 virtual wxGridCellRenderer *Clone() const
146 { return new wxGridCellAutoWrapStringRenderer; }
147
148private:
149 wxArrayString GetTextLines( wxGrid& grid,
150 wxDC& dc,
151 wxGridCellAttr& attr,
152 const wxRect& rect,
153 int row, int col);
154
155};
156
b53dc7d6
GT
157#endif // #if wxUSE_GRID || wxUSE_NEW_GRID
158
d10f4bf9
VZ
159#endif //_WX_GENERIC_GRIDCTRL_H_
160