X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Windows.Forms%2FSystem.Windows.Forms%2FCursor.cs;h=5cf620f041b504e9c477fd996d6f40fdd4ba37bf;hb=bab786ade5ca79aef61cc8fb98607e606464612e;hp=a8baeb441bf42c31698bd640b0fba7492781c606;hpb=ccc8fa54980718d5794f0f6d9f64d8e79345612c;p=mono.git diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursor.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursor.cs index a8baeb441bf..5cf620f041b 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursor.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/Cursor.cs @@ -1,178 +1,232 @@ -// -// System.Windows.Forms.Cursor.cs -// -// Author: -// stubbed out by Jaak Simm (jaaksimm@firm.ee) -// Dennis Hayes (dennish@Raytek.com) -// -// (C) Ximian, Inc., 2002 -// - -using System.ComponentModel; -using System.Runtime.Serialization; -using System.IO; -using System.Drawing; - -namespace System.Windows.Forms { - - /// - /// Represents the image used to paint the mouse pointer. - /// - - [MonoTODO] - [Serializable] - public sealed class Cursor : IDisposable, ISerializable { - - #region Fields - #endregion - - #region Constructors - [MonoTODO] - public Cursor(IntPtr handle) - { - - } - - [MonoTODO] - public Cursor(Stream stream) - { - - } - - [MonoTODO] - public Cursor(string fileName) - { - - } - - [MonoTODO] - public Cursor(Type type,string resource) - { - - } - #endregion - - #region Properties - [MonoTODO] - public static Rectangle Clip { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public static Cursor Current { - get { - throw new NotImplementedException (); - } - set { - throw new NotImplementedException (); - } - } - - [MonoTODO] - public IntPtr Handle { - get { throw new NotImplementedException (); } - } - - [MonoTODO] - public static Point Position { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } - } - - [MonoTODO] - public Size Size { - get { throw new NotImplementedException (); } - } - #endregion - - #region Methods - [MonoTODO] - public IntPtr CopyHandle() - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void Dispose() - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void Draw(Graphics g,Rectangle targetRect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public void DrawStretched(Graphics g,Rectangle targetRect) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public override bool Equals(object obj) - { - //FIXME: - return base.Equals(obj); - } - - [MonoTODO] - ~Cursor() { - throw new NotImplementedException (); - } - - [MonoTODO] - public override int GetHashCode() - { - //FIXME: - return base.GetHashCode(); - } - - [MonoTODO] - public static void Hide() - { - throw new NotImplementedException (); - } - - /// ISerializable.GetObjectData only supports .NET framework: - [MonoTODO] - void ISerializable.GetObjectData(SerializationInfo si,StreamingContext context) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public static void Show() - { - throw new NotImplementedException (); - } - - [MonoTODO] - public override string ToString() - { - //FIXME: - return base.ToString(); - } - #endregion - - #region Operators - [MonoTODO] - public static bool operator ==(Cursor left, Cursor right) - { - throw new NotImplementedException (); - } - - [MonoTODO] - public static bool operator !=(Cursor left, Cursor right) - { - throw new NotImplementedException (); - } - #endregion - } -} +// +// System.Windows.Forms.Cursor.cs +// +// Author: +// stubbed out by Jaak Simm (jaaksimm@firm.ee) +// Dennis Hayes (dennish@Raytek.com) +// Aleksey Ryabchuk (ryabchuk@yahoo.com) +// +// (C) Ximian, Inc., 2002 +// + +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +using System; +using System.ComponentModel; +using System.Runtime.Serialization; +using System.IO; +using System.Drawing; + +namespace System.Windows.Forms { + + /// + /// Represents the image used to paint the mouse pointer. + /// + + [MonoTODO] + [Serializable] + 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 + private Cursor(){ + } + internal Cursor ( CursorType type )//For signiture compatablity. + { + handle = Win32.LoadCursor ( IntPtr.Zero, type ); + fromResource = true; + ctype = type; + } + + [MonoTODO] + public Cursor( IntPtr handle ) + { + this.handle = handle; + } + + [MonoTODO] + public Cursor(Stream stream) + { + + } + + [MonoTODO] + public Cursor(string fileName) + { + + } + + [MonoTODO] + public Cursor(Type type,string resource) + { + + } + #endregion + + #region Properties + [MonoTODO] + public static Rectangle Clip { + get { + throw new NotImplementedException (); + } + set { + throw new NotImplementedException (); + } + } + + [MonoTODO] + public static Cursor Current { + get { + throw new NotImplementedException (); + } + set { + throw new NotImplementedException (); + } + } + + [MonoTODO] + public IntPtr Handle { + get { return handle; } + } + + [MonoTODO] + public static Point Position { + get { throw new NotImplementedException (); } + set { throw new NotImplementedException (); } + } + + [MonoTODO] + public Size Size { + get { throw new NotImplementedException (); } + } + #endregion + + #region Methods + + public IntPtr CopyHandle() + { + return Win32_WineLess.CopyCursor ( Handle ); + } + + public void Dispose() + { + 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) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public void DrawStretched(Graphics g,Rectangle targetRect) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool Equals(object 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; + } + + ~Cursor() { + Dispose ( false ); + } + + [MonoTODO] + public override int GetHashCode() + { + //FIXME: + return base.GetHashCode(); + } + + public static void Hide() + { + Win32.ShowCursor ( false ); + } + + /// ISerializable.GetObjectData only supports .NET framework: + [MonoTODO] + void ISerializable.GetObjectData(SerializationInfo si,StreamingContext context) + { + throw new NotImplementedException (); + } + + public static void Show() + { + Win32.ShowCursor ( true ); + } + + [MonoTODO] + public override string ToString() + { + //FIXME: + return base.ToString(); + } + #endregion + + #region Operators + [MonoTODO] + public static bool operator ==(Cursor left, Cursor right) + { + return Object.Equals ( left, right ); + } + + [MonoTODO] + public static bool operator !=(Cursor left, Cursor right) + { + return ! ( left == right ); + } + #endregion + } +}