2004-04-13 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
[mono.git] / mcs / class / System.Windows.Forms / System.Windows.Forms / ScrollableControl.cs
1 //
2 // System.Windows.Forms.ScrollableControl.cs
3 //
4 // Author:
5 //   Miguel de Icaza (miguel@ximian.com)
6 //   stubbed out by Daniel Carrera (dcarrera@math.toronto.edu)
7 //   ScrollableControl.DockPaddingEdges stub added by Jaak Simm (jaaksimm@firm.ee)
8 //      Dennis Hayes (dennish@raytek.com)
9 //   WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
10 //      CE Complete.
11 // (C) 2002/3 Ximian, Inc
12 //
13
14 using System;
15 using System.Drawing;
16 using System.ComponentModel;
17 namespace System.Windows.Forms {
18
19         public class ScrollableControl : Control {
20
21                 private ScrollableControl.DockPaddingEdges dockPadding;
22                 protected  const int ScrollStateAutoScrolling = 1;
23                 protected  const int ScrollStateFullDrag = 16;
24                 protected  const int ScrollStateHScrollVisible = 2;
25                 
26                 protected  const int ScrollStateUserHasScrolled = 8;
27                 protected  const int ScrollStateVScrollVisible = 4;
28
29
30                 //
31                 //  --- Constructor
32                 //
33                 public ScrollableControl () : base () {
34                         dockPadding = new ScrollableControl.DockPaddingEdges();
35                         TabStop = false;
36                 }
37
38                 //
39                 //  --- Public Properties
40                 //
41                 [MonoTODO]
42                 public virtual bool AutoScroll {
43                         get {
44                                 throw new NotImplementedException ();
45                         }
46                         set {
47                                 //FIXME:
48                         }
49                 }
50
51                 [MonoTODO]
52                 public Size AutoScrollMargin {
53                         get {
54                                 throw new NotImplementedException ();
55                         }
56                         set {
57                                 //FIXME:
58                         }
59                 }
60
61                 [MonoTODO]
62                 public Size AutoScrollMinSize {
63                         get {
64                                 throw new NotImplementedException ();
65                         }
66                         set {
67                                 //FIXME:
68                         }
69                 }
70
71                 [MonoTODO]
72                 public Point AutoScrollPosition {
73                         get {
74                                 throw new NotImplementedException ();
75                         }
76                         set {
77                                 //FIXME:
78                         }
79                 }
80
81                 public override Rectangle DisplayRectangle {
82                         get {
83                                 return base.DisplayRectangle;
84                         }
85                 }
86
87                 [MonoTODO]
88                 public ScrollableControl.DockPaddingEdges DockPadding {
89                         get {
90                                 return dockPadding;
91                         }
92                 }
93
94                 //
95                 //  --- public methods
96                 //
97
98                 [MonoTODO]
99                 public void ScrollControlIntoView (Control activeControl) {
100                 }
101
102                 //
103                 //  --- Protected Properties
104                 //
105
106                 protected override CreateParams CreateParams {
107                         get {
108                                 RegisterDefaultWindowClass ( );
109
110                                 CreateParams createParams = base.CreateParams;
111                                 createParams.Caption = "Hello World";
112                                 createParams.ClassName = Win32.DEFAULT_WINDOW_CLASS;
113                                 
114                                 createParams.Style = (int) (WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CHILD);
115                                 //test version with scroll bars.
116                                 //createParams.Style = (int) (WindowStyles.WS_OVERLAPPEDWINDOW | WindowStyles.WS_HSCROLL | WindowStyles.WS_VSCROLL);
117                                 
118                                 return createParams;                    
119                         }
120                 }
121
122                 [MonoTODO]
123                 protected bool HScroll {
124                         get {
125                                 throw new NotImplementedException ();
126                         }
127                         set {
128                                 //FIXME:
129                         }
130                 }
131
132                 [MonoTODO]
133                 protected bool VScroll {
134                         get {
135                                 throw new NotImplementedException ();
136                         }
137                         set {
138                                 //FIXME:
139                         }
140                 }
141
142                 //
143                 //  --- Protected Methods
144                 //
145                 static private IntPtr WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) {
146                         Message message = new Message();
147
148                         message.HWnd = hWnd;
149                         message.Msg = (int) msg;
150                         message.WParam = wParam;
151                         message.LParam = lParam;
152                         message.Result = (IntPtr)0;
153
154                         return (IntPtr)0;
155                 }
156                 
157                 [MonoTODO]
158                 protected virtual void AdjustFormScrollbars (
159                         bool displayScrollbars) {
160                         //FIXME:
161                 }
162
163                 protected bool GetScrollState(int bit){
164                         throw new NotImplementedException ();
165                 }
166
167                 protected override void OnLayout (LayoutEventArgs levent) {
168                         //FIXME:
169                         base.OnLayout (levent);
170                 }
171
172                 protected override void OnMouseWheel (MouseEventArgs e) {
173                         //FIXME:
174                         base.OnMouseWheel (e);
175                 }
176
177                 protected override void OnVisibleChanged (EventArgs e) {
178                         //FIXME:
179                         base.OnVisibleChanged (e);
180                 }
181
182                 protected override void ScaleCore (float dx, float dy) {
183                         //FIXME:
184                         base.ScaleCore (dx, dy);
185                 }
186
187                 [MonoTODO]
188                 public void SetAutoScrollMargin(int x,int y){
189                 }
190
191                 [MonoTODO]
192                 protected void SetScrollState(int bit,bool value){
193                 }
194
195                 [MonoTODO]
196                 protected void SetDisplayRectLocation(int x,int y){
197                 }
198
199                 protected override void WndProc (ref Message m) {
200                         //FIXME:
201                         base.WndProc (ref m);
202                 }
203                 
204
205                 /// ScrollableControl.DockPaddingEdges
206                 /// Determines the border padding for docked controls.
207                 
208                 public class DockPaddingEdges : ICloneable {
209                         // --- Fields ---
210                         private int all;
211                         private int bottom;
212                         private int left;
213                         private int right;
214                         private int top;
215                         
216                         
217                         // --- public Properties ---
218                         public int All {
219                                 get {
220                                         return all;
221                                 }
222                                 set {
223                                         all = value;
224                                         left = value;
225                                         right = value;
226                                         bottom = value;
227                                         top = value;
228                                 }
229                         }
230                         
231                         public int Bottom {
232                                 get { return bottom; }
233                                 set { bottom = value; }
234                         }
235                         
236                         public int Left {
237                                 get { return left; }
238                                 set { left = value; }
239                         }
240                         
241                         public int Right {
242                                 get { return right; }
243                                 set { right = value; }
244                         }
245                         
246                         public int Top {
247                                 get { return top; }
248                                 set { top = value; }
249                         }
250                         
251                         
252                         /// --- public Methods ---
253
254                         /// <summary>
255                         ///     Equality Operator
256                         /// </summary>
257                         ///
258                         /// <remarks>
259                         ///     Compares two DockPaddingEdges objects. The return value is
260                         ///     based on the equivalence of the  
261                         ///     properties of the two DockPaddingEdges.
262                         /// </remarks>
263
264                         public static bool operator == (DockPaddingEdges objA, DockPaddingEdges objB) {
265                                 return ((objA.left == objB.left) && 
266                                         (objA.right == objB.right) && 
267                                         (objA.top == objB.top) && 
268                                         (objA.bottom == objB.bottom) && 
269                                         (objA.all == objB.all));
270                         }                       
271                         /// <summary>
272                         ///     Equals Method
273                         /// </summary>
274                         ///
275                         /// <remarks>
276                         ///     Checks equivalence of this DockPaddingEdges and another object.
277                         /// </remarks>
278                 
279                         public override bool Equals (object obj) {
280                                 if (!(obj is DockPaddingEdges))
281                                         return false;
282
283                                 return (this == (DockPaddingEdges) obj);
284                         }
285
286                         /// <summary>
287                         ///     Inequality Operator
288                         /// </summary>
289                         ///
290                         /// <remarks>
291                         ///     Compares two DockPaddingEdges objects. The return value is
292                         ///     based on the equivalence of the  
293                         ///     properties of the two Sizes.
294                         /// </remarks>
295
296                         public static bool operator != (DockPaddingEdges objA, DockPaddingEdges objB) {
297                                 return ((objA.left != objB.left) ||
298                                         (objA.right != objB.right) ||
299                                         (objA.top != objB.top) ||
300                                         (objA.bottom != objB.bottom) ||
301                                         (objA.all != objB.all));
302                         }               
303                         /// <summary>
304                         ///     GetHashCode Method
305                         /// </summary>
306                         ///
307                         /// <remarks>
308                         ///     Calculates a hashing value.
309                         /// </remarks>
310                 
311                         public override int GetHashCode () {
312                                 unchecked{
313                                         return all * top * bottom * right * left;
314                                 }
315                         }
316
317                         
318                         /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
319                         object ICloneable.Clone () {
320                                 DockPaddingEdges dpe = new DockPaddingEdges();
321                                 dpe.all = all;
322                                 dpe.top = top;
323                                 dpe.right = right;
324                                 dpe.bottom = bottom;
325                                 dpe.left = left;
326                                 return (object) dpe;
327                         }
328                         
329                         /// <summary>
330                         ///     ToString Method
331                         /// </summary>
332                         ///
333                         /// <remarks>
334                         ///     Formats the DockPaddingEdges as a string.
335                         /// </remarks>
336                 
337                         public override string ToString () {
338                                 return "All = " + all.ToString() + " Top = " + top.ToString() + 
339                                         " Right = " + right.ToString() + " Bottom = " + bottom.ToString() + 
340                                         " Left = " + left.ToString();
341                         }
342                 }
343                 public class DockPaddingEdgeConverter : TypeConverter {
344                 }
345         }
346 }
347