using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Platform.Windows
{
///
/// Describes a win32 window.
internal sealed class WinWindowInfo : IWindowInfo
{
IntPtr handle;
WinWindowInfo parent;
#region --- Constructors ---
internal WinWindowInfo()
{
}
internal WinWindowInfo(IntPtr handle, WinWindowInfo parent)
{
this.handle = handle;
this.parent = parent;
}
#endregion
#region --- Methods ---
internal IntPtr Handle { get { return handle; } set { handle = value; } }
internal WinWindowInfo Parent { get { return parent; } set { parent = value; } }
#region public override string ToString()
/// Returns a System.String that represents the current window.
/// A System.String that represents the current window.
public override string ToString()
{
return String.Format("Windows.WindowInfo: Handle {0}, Parent ({1})",
this.Handle, this.Parent != null ? this.Parent.ToString() : "null");
}
/// Checks if this and obj reference the same win32 window.
/// The object to check against.
/// True if this and obj reference the same win32 window; false otherwise.
public override bool Equals(object obj)
{
if (obj == null) return false;
if (this.GetType() != obj.GetType()) return false;
WinWindowInfo info = (WinWindowInfo)obj;
if (info == null) return false;
// TODO: Assumes windows will always have unique handles.
return handle.Equals(info.handle);
}
/// Returns the hash code for this instance.
/// A hash code for the current WinWindowInfo.
public override int GetHashCode()
{
return handle.GetHashCode();
}
#endregion
#endregion
}
}