2 // System.Windows.Forms.ScrollableControl.cs
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)
11 // (C) 2002/3 Ximian, Inc
16 using System.ComponentModel;
17 namespace System.Windows.Forms {
19 public class ScrollableControl : Control {
21 private ScrollableControl.DockPaddingEdges dockPadding;
22 protected const int ScrollStateAutoScrolling = 1;
23 protected const int ScrollStateFullDrag = 16;
24 protected const int ScrollStateHScrollVisible = 2;
26 protected const int ScrollStateUserHasScrolled = 8;
27 protected const int ScrollStateVScrollVisible = 4;
33 public ScrollableControl () : base () {
34 dockPadding = new ScrollableControl.DockPaddingEdges();
39 // --- Public Properties
42 public virtual bool AutoScroll {
44 throw new NotImplementedException ();
52 public Size AutoScrollMargin {
54 throw new NotImplementedException ();
62 public Size AutoScrollMinSize {
64 throw new NotImplementedException ();
72 public Point AutoScrollPosition {
74 throw new NotImplementedException ();
81 public override Rectangle DisplayRectangle {
83 return base.DisplayRectangle;
88 public ScrollableControl.DockPaddingEdges DockPadding {
99 public void ScrollControlIntoView (Control activeControl) {
103 // --- Protected Properties
106 protected override CreateParams CreateParams {
108 RegisterDefaultWindowClass ( );
110 CreateParams createParams = base.CreateParams;
111 createParams.Caption = "Hello World";
112 createParams.ClassName = Win32.DEFAULT_WINDOW_CLASS;
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);
123 protected bool HScroll {
125 throw new NotImplementedException ();
133 protected bool VScroll {
135 throw new NotImplementedException ();
143 // --- Protected Methods
145 static private IntPtr WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) {
146 Message message = new Message();
149 message.Msg = (int) msg;
150 message.WParam = wParam;
151 message.LParam = lParam;
152 message.Result = (IntPtr)0;
158 protected virtual void AdjustFormScrollbars (
159 bool displayScrollbars) {
163 protected bool GetScrollState(int bit){
164 throw new NotImplementedException ();
167 protected override void OnLayout (LayoutEventArgs levent) {
169 base.OnLayout (levent);
172 protected override void OnMouseWheel (MouseEventArgs e) {
174 base.OnMouseWheel (e);
177 protected override void OnVisibleChanged (EventArgs e) {
179 base.OnVisibleChanged (e);
182 protected override void ScaleCore (float dx, float dy) {
184 base.ScaleCore (dx, dy);
188 public void SetAutoScrollMargin(int x,int y){
192 protected void SetScrollState(int bit,bool value){
196 protected void SetDisplayRectLocation(int x,int y){
199 protected override void WndProc (ref Message m) {
201 base.WndProc (ref m);
205 /// ScrollableControl.DockPaddingEdges
206 /// Determines the border padding for docked controls.
208 public class DockPaddingEdges : ICloneable {
217 // --- public Properties ---
232 get { return bottom; }
233 set { bottom = value; }
238 set { left = value; }
242 get { return right; }
243 set { right = value; }
252 /// --- public Methods ---
255 /// Equality Operator
259 /// Compares two DockPaddingEdges objects. The return value is
260 /// based on the equivalence of the
261 /// properties of the two DockPaddingEdges.
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));
276 /// Checks equivalence of this DockPaddingEdges and another object.
279 public override bool Equals (object obj) {
280 if (!(obj is DockPaddingEdges))
283 return (this == (DockPaddingEdges) obj);
287 /// Inequality Operator
291 /// Compares two DockPaddingEdges objects. The return value is
292 /// based on the equivalence of the
293 /// properties of the two Sizes.
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));
304 /// GetHashCode Method
308 /// Calculates a hashing value.
311 public override int GetHashCode () {
313 return all * top * bottom * right * left;
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();
334 /// Formats the DockPaddingEdges as a string.
337 public override string ToString () {
338 return "All = " + all.ToString() + " Top = " + top.ToString() +
339 " Right = " + right.ToString() + " Bottom = " + bottom.ToString() +
340 " Left = " + left.ToString();
343 public class DockPaddingEdgeConverter : TypeConverter {