* ImageList.cs: When the image stream is set pull all the images
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / DataGrid.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2004 Novell, Inc. (http://www.novell.com)
21 //
22 // Authors:
23 //      Peter Bartok    (pbartok@novell.com)
24 //
25 //
26
27 // NOT COMPLETE - Empty, has wrong signature (and is partially stubbed for dependend assemblies) until DataGrid is implemented
28
29 using System.ComponentModel;
30 using System.Drawing;
31
32 namespace System.Windows.Forms {
33         public class DataGrid : Control {
34                 #region Local Variables
35                 internal bool                           allow_sorting;
36                 internal bool                           caption_visible;
37                 internal string                         data_member;
38                 internal object                         data_source;
39                 internal Color                          header_forecolor;
40                 internal GridTableStylesCollection      table_styles;
41                 #endregion      // Local Variables
42
43                 #region Public Constructors
44                 [MonoTODO]
45                 public DataGrid() {
46                         allow_sorting = false;
47                         caption_visible = true;
48                         data_member = string.Empty;
49                         header_forecolor = Color.Black;
50                         table_styles = new GridTableStylesCollection();
51                 }
52                 #endregion      // Public Constructors
53
54                 #region Public Instance Properties
55                 public bool AllowSorting {
56                         get {
57                                 return allow_sorting;
58                         }
59
60                         set {
61                                 if (allow_sorting != value) {
62                                         allow_sorting = value;
63                                 }
64                         }
65                 }
66
67                 public bool CaptionVisible {
68                         get {
69                                 return caption_visible;
70                         }
71
72                         set {
73                                 if (caption_visible != value) {
74                                         caption_visible = value;
75
76                                         OnCaptionVisibleChanged(EventArgs.Empty);
77                                 }
78                         }
79                 }
80
81                 public string DataMember {
82                         get {
83                                 return data_member;
84                         }
85
86                         set {
87                                 if (data_member != value) {
88                                         data_member = value;
89                                 }
90                         }
91                 }
92
93                 public object DataSource {
94                         get {
95                                 return data_source;
96                         }
97
98                         set {
99                                 if (data_source != value) {
100                                         data_source = value;
101
102                                         OnDataSourceChanged(EventArgs.Empty);
103                                 }
104                         }
105                 }
106
107                 public Color HeaderForeColor {
108                         get {
109                                 return header_forecolor;
110                         }
111
112                         set {
113                                 if (header_forecolor != value) {
114                                         header_forecolor = value;
115                                 }
116                         }
117                 }
118
119                 public GridTableStylesCollection TableStyles {
120                         get {
121                                 return table_styles;
122                         }
123                 }
124                 #endregion      // Public Instance Properties
125
126                 #region Protected Instance Properties
127                 #endregion      // Protected Instance Properties
128
129                 #region Public Instance Methods
130                 [MonoTODO]
131                 public void Expand(int Row) {
132                         throw new NotImplementedException();
133                 }
134                 #endregion      // Public Instance Methods
135
136                 #region Protected Instance Methods
137                 protected virtual void OnCaptionVisibleChanged(EventArgs e) {
138                         if (CaptionVisibleChanged != null) {
139                                 CaptionVisibleChanged(this, e);
140                         }
141                 }
142
143                 protected virtual void OnDataSourceChanged(EventArgs e) {
144                         if (DataSourceChanged != null) {
145                                 DataSourceChanged(this, e);
146                         }
147                 }
148                 #endregion      // Protected Instance Methods
149
150                 #region Events
151                 public event EventHandler CaptionVisibleChanged;
152                 public event EventHandler DataSourceChanged;
153                 #endregion      // Events
154         }
155 }