(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.Windows.Forms / System.Windows.Forms / Cursor.cs
blob5cf620f041b504e9c477fd996d6f40fdd4ba37bf
1 //
2 // System.Windows.Forms.Cursor.cs
3 //
4 // Author:
5 // stubbed out by Jaak Simm (jaaksimm@firm.ee)
6 // Dennis Hayes (dennish@Raytek.com)
7 // Aleksey Ryabchuk (ryabchuk@yahoo.com)
8 //
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:
20 //
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 //
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.
32 using System;
33 using System.ComponentModel;
34 using System.Runtime.Serialization;
35 using System.IO;
36 using System.Drawing;
38 namespace System.Windows.Forms {
40 /// <summary>
41 /// Represents the image used to paint the mouse pointer.
42 /// </summary>
44 [MonoTODO]
45 [Serializable]
46 public sealed class Cursor : IDisposable, ISerializable {
48 #region Fields
49 private IntPtr handle;
50 private bool fromResource = false;
51 private bool disposed = false;
52 private CursorType ctype;
53 #endregion
55 #region Constructors
56 private Cursor(){
58 internal Cursor ( CursorType type )//For signiture compatablity.
60 handle = Win32.LoadCursor ( IntPtr.Zero, type );
61 fromResource = true;
62 ctype = type;
65 [MonoTODO]
66 public Cursor( IntPtr handle )
68 this.handle = handle;
71 [MonoTODO]
72 public Cursor(Stream stream)
77 [MonoTODO]
78 public Cursor(string fileName)
83 [MonoTODO]
84 public Cursor(Type type,string resource)
88 #endregion
90 #region Properties
91 [MonoTODO]
92 public static Rectangle Clip {
93 get {
94 throw new NotImplementedException ();
96 set {
97 throw new NotImplementedException ();
101 [MonoTODO]
102 public static Cursor Current {
103 get {
104 throw new NotImplementedException ();
106 set {
107 throw new NotImplementedException ();
111 [MonoTODO]
112 public IntPtr Handle {
113 get { return handle; }
116 [MonoTODO]
117 public static Point Position {
118 get { throw new NotImplementedException (); }
119 set { throw new NotImplementedException (); }
122 [MonoTODO]
123 public Size Size {
124 get { throw new NotImplementedException (); }
126 #endregion
128 #region Methods
130 public IntPtr CopyHandle()
132 return Win32_WineLess.CopyCursor ( Handle );
135 public void Dispose()
137 GC.SuppressFinalize( this );
138 Dispose( true );
141 private void Dispose( bool disposing )
143 lock ( this ) {
144 if ( disposing ) {
145 // dispose managed resources
147 if ( !this.disposed ) {
148 // release all unmanaged resources
149 // shared cursor should not be destroyed
150 if ( !fromResource )
151 Win32.DestroyCursor ( handle );
152 handle = IntPtr.Zero;
154 disposed = true;
158 [MonoTODO]
159 public void Draw(Graphics g,Rectangle targetRect)
161 throw new NotImplementedException ();
164 [MonoTODO]
165 public void DrawStretched(Graphics g,Rectangle targetRect)
167 throw new NotImplementedException ();
170 [MonoTODO]
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;
179 return true;
182 ~Cursor() {
183 Dispose ( false );
186 [MonoTODO]
187 public override int GetHashCode()
189 //FIXME:
190 return base.GetHashCode();
193 public static void Hide()
195 Win32.ShowCursor ( false );
198 /// ISerializable.GetObjectData only supports .NET framework:
199 [MonoTODO]
200 void ISerializable.GetObjectData(SerializationInfo si,StreamingContext context)
202 throw new NotImplementedException ();
205 public static void Show()
207 Win32.ShowCursor ( true );
210 [MonoTODO]
211 public override string ToString()
213 //FIXME:
214 return base.ToString();
216 #endregion
218 #region Operators
219 [MonoTODO]
220 public static bool operator ==(Cursor left, Cursor right)
222 return Object.Equals ( left, right );
225 [MonoTODO]
226 public static bool operator !=(Cursor left, Cursor right)
228 return ! ( left == right );
230 #endregion