* ImageList.cs: When the image stream is set pull all the images
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ListControl.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-2005 Novell, Inc.
21 //
22 // Authors:
23 //      Jordi Mas i Hernandez, jordi@ximian.com
24 //
25 //
26
27 // NOT COMPLETE
28
29 using System;
30 using System.Drawing;
31 using System.Collections;
32 using System.ComponentModel;
33 using System.Reflection;
34
35 namespace System.Windows.Forms 
36 {
37         public abstract class ListControl : Control
38         {
39                 string display_member;
40                 
41                 protected ListControl ()
42                 {
43                         display_member = string.Empty;
44                 }
45
46                 #region Events          
47                 public event EventHandler DataSourceChanged;            
48                 public event EventHandler DisplayMemberChanged;
49                 public event EventHandler SelectedValueChanged;
50                 public event EventHandler ValueMemberChanged;
51                 #endregion // Events
52
53                 #region Public Properties
54                 //protected CurrencyManager DataManager {
55                 //get {throw new NotImplementedException (); };
56                 //}
57
58                 [DefaultValue(null)]
59                 [RefreshProperties(RefreshProperties.Repaint)]
60                 [TypeConverter("System.Windows.Forms.Design.DataSourceConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
61                 public object DataSource {
62                         get {throw new NotImplementedException (); }
63                         set {throw new NotImplementedException (); }
64                 }
65                 
66                 [DefaultValue("")]
67                 [Editor("System.Windows.Forms.Design.DataMemberFieldEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
68                 [TypeConverter("System.Windows.Forms.Design.DataMemberFieldConverter, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
69                 public string DisplayMember {
70                         get { return display_member; } 
71                         set { display_member = value; }
72                 }
73                                 
74                 public abstract int SelectedIndex {
75                         get; 
76                         set;
77                 }
78
79                 [Bindable(BindableSupport.Yes)]
80                 [Browsable(false)]
81                 [DefaultValue(null)]
82                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
83                 public object SelectedValue {
84                         get {throw new NotImplementedException (); }                     
85                         set {throw new NotImplementedException (); }
86                 }
87
88                 [DefaultValue("")]
89                 [Editor("System.Windows.Forms.Design.DataMemberFieldEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
90                 public string ValueMember  {
91                         get {throw new NotImplementedException (); }
92                         set {throw new NotImplementedException (); }
93                 }
94                 
95                 #endregion Public Properties
96
97                 #region Public Methods
98
99                 protected object FilterItemOnProperty (object item)
100                 {
101                         throw new NotImplementedException ();
102                 }
103
104                 protected object FilterItemOnProperty (object item, string field)
105                 {
106                         throw new NotImplementedException (); 
107                 }
108
109                 public string GetItemText (object item)
110                 {
111                          throw new NotImplementedException ();
112                 }
113
114                 // Used only by ListBox to avoid to break Listbox's member signature
115                 protected override bool IsInputKey (Keys keyData)
116                 {
117                         switch (keyData) {
118                         case Keys.Up:
119                         case Keys.Down:
120                         case Keys.PageUp:
121                         case Keys.PageDown:
122                         case Keys.Right:
123                         case Keys.Left:
124                         case Keys.End:
125                         case Keys.Home:
126                         case Keys.ControlKey:
127                         case Keys.Space:
128                         case Keys.ShiftKey:
129                                 return true;
130                         
131                         default:                                        
132                                 return false;
133                         }
134                 }
135
136                 protected override void OnBindingContextChanged (EventArgs e)
137                 {
138                         
139                 }
140
141                 protected virtual void OnDataSourceChanged (EventArgs e)
142                 {
143
144                 }
145
146                 protected virtual void OnDisplayMemberChanged (EventArgs e)
147                 {
148
149                 }
150
151                 protected virtual void OnSelectedIndexChanged (EventArgs e)
152                 {
153                 
154                 }
155
156                 protected virtual void OnSelectedValueChanged (EventArgs e)
157                 {
158
159                 }
160
161                 protected virtual void OnValueMemberChanged (EventArgs e)
162                 {
163
164                 }
165
166                 protected abstract void RefreshItem (int index);
167
168                 protected virtual void SetItemCore (int index,  object value)
169                 {
170
171                 }
172
173                 protected abstract void SetItemsCore (IList items);
174
175                 
176                 #endregion Public Methods
177                 
178         }       
179
180 }
181