// Author:
// stubbed out by Jaak Simm (jaaksimm@firm.ee)
// Dennis Hayes (dennish@Raytek.com)
+// Aleksey Ryabchuk (ryabchuk@yahoo.com)
//
// (C) Ximian, Inc., 2002
//
-
+using System;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.IO;
public sealed class Cursor : IDisposable, ISerializable {
#region Fields
+ private IntPtr handle;
+ private bool fromResource = false;
+ private bool disposed = false;
+ private CursorType ctype;
#endregion
#region Constructors
+ internal Cursor ( CursorType type )
+ {
+ handle = Win32.LoadCursor ( IntPtr.Zero, type );
+ fromResource = true;
+ ctype = type;
+ }
+
[MonoTODO]
- public Cursor(IntPtr handle)
+ public Cursor( IntPtr handle )
{
-
+ this.handle = handle;
}
[MonoTODO]
[MonoTODO]
public IntPtr Handle {
- get { throw new NotImplementedException (); }
+ get { return handle; }
}
[MonoTODO]
throw new NotImplementedException ();
}
- [MonoTODO]
public void Dispose()
{
- throw new NotImplementedException ();
+ GC.SuppressFinalize( this );
+ Dispose( true );
}
+ private void Dispose( bool disposing )
+ {
+ lock ( this ) {
+ if ( disposing ) {
+ // dispose managed resources
+ }
+ if ( !this.disposed ) {
+ // release all unmanaged resources
+ // shared cursor should not be destroyed
+ if ( !fromResource )
+ Win32.DestroyCursor ( handle );
+ handle = IntPtr.Zero;
+ }
+ disposed = true;
+ }
+ }
+
[MonoTODO]
public void Draw(Graphics g,Rectangle targetRect)
{
[MonoTODO]
public override bool Equals(object obj)
{
- //FIXME:
- return base.Equals(obj);
+ if ( obj == null ) return false;
+ if ( this.GetType ( ) != obj.GetType ( ) ) return false;
+ Cursor other = ( Cursor ) obj;
+ if ( !fromResource.Equals ( other.fromResource ) ) return false;
+ if ( !ctype.Equals ( other.ctype ) ) return false;
+
+ return true;
}
- [MonoTODO]
~Cursor() {
- throw new NotImplementedException ();
+ Dispose ( false );
}
[MonoTODO]
[MonoTODO]
public static bool operator ==(Cursor left, Cursor right)
{
- throw new NotImplementedException ();
+ return Object.Equals ( left, right );
}
[MonoTODO]
public static bool operator !=(Cursor left, Cursor right)
{
- throw new NotImplementedException ();
+ return ! ( left == right );
}
#endregion
}
// Author:
// stubbed out by Jaak Simm (jaaksimm@firm.ee)
// Dennis Hayes (dennish@Raytek.com)
+// Aleksey Ryabchuk (ryabchuk@yahoo.com)
//
// (C) Ximian, Inc., 2002
//
/// Provides a collection of Cursor objects for use by a Windows Forms application.
/// </summary>
- [MonoTODO]
- public sealed class Cursors {
+ public sealed class Cursors{
- #region Properties
- [MonoTODO]
public static Cursor AppStarting {
-
- get {
-//HANDLE LoadImage(
-// HINSTANCE hinst, // handle to instance // = null
-// LPCTSTR lpszName, // image to load // = IDC_APPSTARTING
-// UINT uType, // image type //= IMAGE_CURSOR
-// int cxDesired, // desired width // = 0
-// int cyDesired, // desired height // = 0
-// UINT fuLoad // load options // = LR_DEFAULTSIZE || ??
-//);
- //Cursor cursor = new Cursor(
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_APPSTARTING ); }
}
- [MonoTODO]
public static Cursor Arrow {
- // LPCTSTR lpszName, // image to load // = IDC_ARROW
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_ARROW ); }
}
- [MonoTODO]
public static Cursor Cross {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_CROSS ); }
}
[MonoTODO]
public static Cursor Default {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_ARROW ); }
}
- [MonoTODO]
public static Cursor Hand {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_HAND ); }
}
- [MonoTODO]
public static Cursor Help {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_HELP ); }
}
[MonoTODO]
}
}
- [MonoTODO]
public static Cursor IBeam {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_IBEAM ); }
}
- [MonoTODO]
public static Cursor No {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_NO ); }
}
[MonoTODO]
}
}
- [MonoTODO]
public static Cursor SizeAll {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_SIZEALL ); }
}
- [MonoTODO]
public static Cursor SizeNESW {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_SIZENESW ); }
}
- [MonoTODO]
public static Cursor SizeNS {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_SIZENS ); }
}
- [MonoTODO]
public static Cursor SizeNWSE {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_SIZENWSE ); }
}
- [MonoTODO]
public static Cursor SizeWE {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_SIZEWE ); }
}
- [MonoTODO]
public static Cursor UpArrow {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_UPARROW ); }
}
[MonoTODO]
}
}
- [MonoTODO]
public static Cursor WaitCursor {
- get {
- throw new NotImplementedException ();
- }
+ get { return new Cursor ( CursorType.IDC_WAIT ); }
}
- #endregion
}
}