]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/gridctrl.h
Added CanApplyParentThemeBackground and use it in wxMSW's
[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
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
d10f4bf9
VZ
16 #pragma interface "gridctrl.h"
17#endif
18
f7556ff0 19#if wxUSE_GRID
b53dc7d6 20
d10f4bf9
VZ
21#include "wx/grid.h"
22#include "wx/string.h"
2da2f941 23#include "wx/arrstr.h"
d10f4bf9
VZ
24#include "wx/datetime.h"
25
26#define wxGRID_VALUE_CHOICEINT _T("choiceint")
27#define wxGRID_VALUE_DATETIME _T("datetime")
28
e2b87f38
VZ
29#if wxUSE_DATETIME
30
d10f4bf9 31// the default renderer for the cells containing Time and dates..
12f190b0 32class WXDLLIMPEXP_ADV wxGridCellDateTimeRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
33{
34public:
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
56protected:
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
e2b87f38 65#endif // wxUSE_DATETIME
d10f4bf9
VZ
66
67// the default renderer for the cells containing Time and dates..
12f190b0 68class WXDLLIMPEXP_ADV wxGridCellEnumRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
69{
70public:
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
91protected:
92 wxString GetString(wxGrid& grid, int row, int col);
93
94 wxArrayString m_choices;
95};
96
97
3379ed37
VZ
98#if wxUSE_COMBOBOX
99
12f190b0 100class WXDLLIMPEXP_ADV wxGridCellEnumEditor : public wxGridCellChoiceEditor
d10f4bf9
VZ
101{
102public:
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
111private:
112 long int m_startint;
fc7a2a60
VZ
113
114 DECLARE_NO_COPY_CLASS(wxGridCellEnumEditor)
d10f4bf9
VZ
115};
116
3379ed37 117#endif // wxUSE_COMBOBOX
d10f4bf9 118
12f190b0 119class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringEditor : public wxGridCellTextEditor
d10f4bf9
VZ
120{
121public:
122 wxGridCellAutoWrapStringEditor() : wxGridCellTextEditor() { }
123 virtual void Create(wxWindow* parent,
124 wxWindowID id,
125 wxEvtHandler* evtHandler);
126
127 virtual wxGridCellEditor *Clone() const
128 { return new wxGridCellAutoWrapStringEditor; }
fc7a2a60
VZ
129
130 DECLARE_NO_COPY_CLASS(wxGridCellAutoWrapStringEditor)
d10f4bf9
VZ
131};
132
12f190b0 133class WXDLLIMPEXP_ADV wxGridCellAutoWrapStringRenderer : public wxGridCellStringRenderer
d10f4bf9
VZ
134{
135public:
136 wxGridCellAutoWrapStringRenderer() : wxGridCellStringRenderer() { }
137
138 virtual void Draw(wxGrid& grid,
139 wxGridCellAttr& attr,
140 wxDC& dc,
141 const wxRect& rect,
142 int row, int col,
143 bool isSelected);
144
145 virtual wxSize GetBestSize(wxGrid& grid,
146 wxGridCellAttr& attr,
147 wxDC& dc,
148 int row, int col);
149
150 virtual wxGridCellRenderer *Clone() const
151 { return new wxGridCellAutoWrapStringRenderer; }
152
153private:
154 wxArrayString GetTextLines( wxGrid& grid,
155 wxDC& dc,
156 wxGridCellAttr& attr,
157 const wxRect& rect,
158 int row, int col);
159
160};
161
f7556ff0 162#endif // #if wxUSE_GRID
b53dc7d6 163
d10f4bf9
VZ
164#endif //_WX_GENERIC_GRIDCTRL_H_
165