2 // System.Windows.Forms.DataGridColumnStyle
5 // stubbed out by Jaak Simm (jaaksimm@firm.ee)
6 // Dennis Hayes (dennish@Raytek.com)
8 // (C) Ximian, Inc., 2002
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System
.ComponentModel
;
34 using System
.Collections
;
36 namespace System
.Windows
.Forms
{
39 /// Specifies the appearance and text formatting and behavior of a System.Windows.Forms.DataGrid control column. This class is abstract.
43 public abstract class DataGridColumnStyle
: Component
, IDataGridColumnStyleEditingNotificationService
{
46 HorizontalAlignment alignment
;
47 DataGridTableStyle dataGridTableStyle
;
52 PropertyDescriptor propertyDescriptor
;
59 public DataGridColumnStyle() {
60 alignment
=HorizontalAlignment
.Left
;
61 dataGridTableStyle
=null;
68 public DataGridColumnStyle(PropertyDescriptor prop
) : this() {
69 propertyDescriptor
=prop
;
74 public virtual HorizontalAlignment Alignment
{
75 get { return alignment; }
76 set { alignment=value; }
79 public virtual DataGridTableStyle DataGridTableStyle
{
80 get { return dataGridTableStyle; }
83 protected int FontHeight
{
84 get { return fontHeight; }
87 // This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
88 [MonoTODO
] public AccessibleObject HeaderAccessibleObject
{
90 throw new NotImplementedException ();
94 public virtual string HeaderText
{
95 get { return headerText; }
96 set { headerText=value; }
99 public string MappingName
{
100 get { return mappingName; }
101 set { mappingName=value; }
104 public virtual string NullText
{
105 get { return nullText; }
106 set { nullText=value; }
109 public virtual PropertyDescriptor PropertyDescriptor
{
110 get { return propertyDescriptor; }
111 set { propertyDescriptor=value; }
114 public virtual bool ReadOnly
{
115 get { return readOnly; }
116 set { readOnly=value; }
119 public virtual int Width
{
120 get { return width; }
126 protected internal abstract void Abort(int rowNum
);
129 protected void BeginUpdate() {
134 protected void CheckValidDataSource(CurrencyManager
value) {
139 protected internal virtual void ColumnStartedEditing(Control editingControl
) {
143 protected internal abstract bool Commit(CurrencyManager dataSource
,int rowNum
);
147 protected internal virtual void ConcedeFocus() {
151 //This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
153 protected virtual AccessibleObject
CreateHeaderAccessibleObject(){
154 throw new NotImplementedException ();
159 protected internal virtual void Edit(CurrencyManager source
) {
164 protected internal virtual void Edit(CurrencyManager source
, int rowNum
) {
169 protected internal abstract void Edit(CurrencyManager source
, int rowNum
, Rectangle bounds
,
170 bool readOnly
, string instantText
, bool cellIsVisible
);
173 protected void EndUpdate() {
178 protected internal virtual void EnterNullValue() {
183 protected internal virtual object GetColumnValueAtRow(CurrencyManager source
,int rowNum
) {
184 throw new NotImplementedException ();
187 protected internal abstract int GetMinimumHeight();
189 protected internal abstract int GetPreferredHeight(Graphics g
,object value);
191 protected internal abstract Size
GetPreferredSize(Graphics g
,object value);
194 * This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
197 void IDataGridColumnStyleEditingNotificationService
.ColumnStartedEditing(Control editingControl
) {
202 protected virtual void Invalidate() {
206 protected internal abstract void Paint(Graphics g
,Rectangle bounds
,CurrencyManager source
,int rowNum
);
208 protected internal abstract void Paint(Graphics g
,Rectangle bounds
,CurrencyManager source
,int rowNum
,bool alignToRight
);
211 protected internal virtual void Paint(Graphics g
, Rectangle bounds
, CurrencyManager source
,
212 int rowNum
, Brush backBrush
, Brush foreBrush
, bool alignToRight
) {
217 public void ResetHeaderText() {
222 protected internal virtual void SetColumnValueAtRow(CurrencyManager source
,int rowNum
,object value) {
227 protected virtual void SetDataGrid(DataGrid
value) {
232 protected virtual void SetDataGridInColumn(DataGrid
value) {
237 protected internal virtual void UpdateUI(CurrencyManager source
,int rowNum
,string instantText
) {
244 public event EventHandler AlignmentChanged
;
246 // This member supports the .NET Framework infrastructure and is not intended to be used directly from your code
247 public event EventHandler FontChanged
;
250 public event EventHandler HeaderTextChanged
;
251 public event EventHandler MappingNameChanged
;
252 public event EventHandler NullTextChanged
;
253 public event EventHandler PropertyDescriptorChanged
;
254 public event EventHandler ReadOnlyChanged
;
255 public event EventHandler WidthChanged
;
259 /// This type supports the .NET Framework infrastructure and is not intended to be used directly from your code.
261 protected class CompModSwitches
{
263 protected class DataGridColumnHeaderAccessibleObject
: AccessibleObject
{