2007-08-10 09:27:13 +00:00
|
|
|
|
#region --- License ---
|
|
|
|
|
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
|
|
|
|
|
* See license.txt for license info
|
|
|
|
|
*/
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
using System;
|
2007-08-05 13:42:31 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2007-09-09 11:52:09 +00:00
|
|
|
|
using System.Windows.Forms;
|
2007-08-05 13:42:31 +00:00
|
|
|
|
|
|
|
|
|
namespace OpenTK.Platform.X11
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2007-09-09 11:52:09 +00:00
|
|
|
|
/// Describes a Windows.Form.Control, Windows.Forms.NativeWindow or OpenTK.GameWindow on the X11 platform.
|
2007-08-05 13:42:31 +00:00
|
|
|
|
/// This class supports OpenTK, and is not intended for use by OpenTK programs.
|
|
|
|
|
/// </summary>
|
2007-09-09 11:52:09 +00:00
|
|
|
|
internal sealed class WindowInfo : IWindowInfo
|
2007-08-05 13:42:31 +00:00
|
|
|
|
{
|
2007-09-09 11:52:09 +00:00
|
|
|
|
private IntPtr rootWindow, handle, topLevelWindow, display;
|
|
|
|
|
private int screen;
|
|
|
|
|
private WindowInfo parent;
|
|
|
|
|
private XVisualInfo visinfo;
|
|
|
|
|
|
2007-08-21 09:01:24 +00:00
|
|
|
|
public WindowInfo()
|
2007-08-10 09:27:13 +00:00
|
|
|
|
{
|
2007-09-02 00:40:43 +00:00
|
|
|
|
visinfo = new XVisualInfo();
|
2007-08-07 20:32:26 +00:00
|
|
|
|
}
|
2007-08-21 09:01:24 +00:00
|
|
|
|
|
2007-09-09 11:52:09 +00:00
|
|
|
|
public WindowInfo(Control control)
|
2007-08-10 09:27:13 +00:00
|
|
|
|
{
|
2007-09-09 11:52:09 +00:00
|
|
|
|
throw new NotImplementedException();
|
2007-08-05 13:42:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-09-09 11:52:09 +00:00
|
|
|
|
public WindowInfo(NativeWindow window)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public WindowInfo(GameWindow window)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public WindowInfo(WindowInfo info)
|
|
|
|
|
{
|
|
|
|
|
this.GetInfoFrom(info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region --- IWindowInfo Members ---
|
|
|
|
|
|
|
|
|
|
public void GetInfoFrom(Control control)
|
|
|
|
|
{
|
|
|
|
|
if (control == null)
|
|
|
|
|
throw new ArgumentException("GameWindow cannot be null.");
|
|
|
|
|
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GetInfoFrom(NativeWindow window)
|
|
|
|
|
{
|
|
|
|
|
if (window == null)
|
|
|
|
|
throw new ArgumentException("GameWindow cannot be null.");
|
|
|
|
|
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GetInfoFrom(GameWindow window)
|
|
|
|
|
{
|
|
|
|
|
if (window == null)
|
|
|
|
|
throw new ArgumentException("GameWindow cannot be null.");
|
|
|
|
|
|
|
|
|
|
this.GetInfoFrom(window.WindowInfo as X11.WindowInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GetInfoFrom(IWindowInfo info)
|
|
|
|
|
{
|
|
|
|
|
if (info == null)
|
|
|
|
|
throw new ArgumentException("WindowInfo cannot be null");
|
|
|
|
|
|
|
|
|
|
WindowInfo winfo = info as WindowInfo;
|
|
|
|
|
|
|
|
|
|
this.Handle = info.Handle;
|
|
|
|
|
this.Parent = info.Parent;
|
|
|
|
|
|
|
|
|
|
this.RootWindow = winfo.RootWindow;
|
|
|
|
|
this.TopLevelWindow = winfo.TopLevelWindow;
|
|
|
|
|
this.Display = winfo.Display;
|
|
|
|
|
this.Screen = winfo.Screen;
|
|
|
|
|
this.VisualInfo = winfo.VisualInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IntPtr Handle { get { return handle; } internal set { handle = value; } }
|
|
|
|
|
public IWindowInfo Parent { get { return parent; } internal set { parent = value as WindowInfo; } }
|
2007-08-05 13:42:31 +00:00
|
|
|
|
|
2007-09-09 11:52:09 +00:00
|
|
|
|
#endregion
|
2007-08-05 13:42:31 +00:00
|
|
|
|
|
2007-09-09 11:52:09 +00:00
|
|
|
|
public IntPtr RootWindow { get { return rootWindow; } internal set { rootWindow = value; } }
|
|
|
|
|
public IntPtr TopLevelWindow { get { return topLevelWindow; } internal set { topLevelWindow = value; } }
|
|
|
|
|
public IntPtr Display { get { return display; } internal set { display = value; } }
|
|
|
|
|
public int Screen { get { return screen; } internal set { screen = value; } }
|
|
|
|
|
public XVisualInfo VisualInfo { get { return visinfo; } internal set { visinfo = value; } }
|
2007-08-05 16:44:31 +00:00
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2007-08-05 19:04:06 +00:00
|
|
|
|
return String.Format("X11.WindowInfo: Display {0}, Screen {1}, Handle {2}, Parent: ({3})",
|
2007-08-05 16:54:14 +00:00
|
|
|
|
this.Display, this.Screen, this.Handle, this.Parent != null ? this.Parent.ToString() : "null");
|
2007-08-05 16:44:31 +00:00
|
|
|
|
}
|
2007-08-05 13:42:31 +00:00
|
|
|
|
}
|
|
|
|
|
}
|