2 // System.Windows.Forms.Cursor.cs
5 // stubbed out by Jaak Simm (jaaksimm@firm.ee)
6 // Dennis Hayes (dennish@Raytek.com)
7 // Aleksey Ryabchuk (ryabchuk@yahoo.com)
9 // (C) Ximian, Inc., 2002
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System.ComponentModel;
34 using System.Runtime.Serialization;
38 namespace System.Windows.Forms {
41 /// Represents the image used to paint the mouse pointer.
46 public sealed class Cursor : IDisposable, ISerializable {
49 private IntPtr handle;
50 private bool fromResource = false;
51 private bool disposed = false;
52 private CursorType ctype;
58 internal Cursor ( CursorType type )//For signiture compatablity.
60 handle = Win32.LoadCursor ( IntPtr.Zero, type );
66 public Cursor( IntPtr handle )
72 public Cursor(Stream stream)
78 public Cursor(string fileName)
84 public Cursor(Type type,string resource)
92 public static Rectangle Clip {
94 throw new NotImplementedException ();
97 throw new NotImplementedException ();
102 public static Cursor Current {
104 throw new NotImplementedException ();
107 throw new NotImplementedException ();
112 public IntPtr Handle {
113 get { return handle; }
117 public static Point Position {
118 get { throw new NotImplementedException (); }
119 set { throw new NotImplementedException (); }
124 get { throw new NotImplementedException (); }
130 public IntPtr CopyHandle()
132 return Win32_WineLess.CopyCursor ( Handle );
135 public void Dispose()
137 GC.SuppressFinalize( this );
141 private void Dispose( bool disposing )
145 // dispose managed resources
147 if ( !this.disposed ) {
148 // release all unmanaged resources
149 // shared cursor should not be destroyed
151 Win32.DestroyCursor ( handle );
152 handle = IntPtr.Zero;
159 public void Draw(Graphics g,Rectangle targetRect)
161 throw new NotImplementedException ();
165 public void DrawStretched(Graphics g,Rectangle targetRect)
167 throw new NotImplementedException ();
171 public override bool Equals(object obj)
173 if ( obj == null ) return false;
174 if ( this.GetType ( ) != obj.GetType ( ) ) return false;
175 Cursor other = ( Cursor ) obj;
176 if ( !fromResource.Equals ( other.fromResource ) ) return false;
177 if ( !ctype.Equals ( other.ctype ) ) return false;
187 public override int GetHashCode()
190 return base.GetHashCode();
193 public static void Hide()
195 Win32.ShowCursor ( false );
198 /// ISerializable.GetObjectData only supports .NET framework:
200 void ISerializable.GetObjectData(SerializationInfo si,StreamingContext context)
202 throw new NotImplementedException ();
205 public static void Show()
207 Win32.ShowCursor ( true );
211 public override string ToString()
214 return base.ToString();
220 public static bool operator ==(Cursor left, Cursor right)
222 return Object.Equals ( left, right );
226 public static bool operator !=(Cursor left, Cursor right)
228 return ! ( left == right );