2008-02-28 13:46:44 +00:00
|
|
|
|
#region --- License ---
|
|
|
|
|
/* Licensed under the MIT/X11 license.
|
|
|
|
|
* Copyright (c) 2006-2008 the OpenTK Team.
|
|
|
|
|
* This notice may not be removed from any source distribution.
|
|
|
|
|
* See license.txt for licensing detailed licensing details.
|
|
|
|
|
*/
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace OpenTK.Platform.Windows
|
|
|
|
|
{
|
|
|
|
|
/// <internal />
|
2008-03-03 12:44:56 +00:00
|
|
|
|
/// <summary>Utility to obtain IWindowInfo from a System.Windows.Forms.Control on win32.</summary>
|
2008-02-28 13:46:44 +00:00
|
|
|
|
internal sealed class WinGLControlHelper : IGLControlHelper
|
|
|
|
|
{
|
|
|
|
|
MSG msg = new MSG();
|
2008-03-03 12:44:56 +00:00
|
|
|
|
Control control;
|
2008-02-28 13:46:44 +00:00
|
|
|
|
|
|
|
|
|
#region --- Constructors ---
|
|
|
|
|
|
2008-03-03 12:44:56 +00:00
|
|
|
|
public WinGLControlHelper(Control c)
|
2008-02-28 13:46:44 +00:00
|
|
|
|
{
|
2008-03-03 12:44:56 +00:00
|
|
|
|
control = c;
|
2008-02-28 13:46:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region --- IGLControlHelper Members ---
|
|
|
|
|
|
|
|
|
|
/// <summary>Returns an OpenTK.Platform.IWindowInfo describing this control.</summary>
|
2008-03-03 12:44:56 +00:00
|
|
|
|
public IWindowInfo WindowInfo { get { return new WinWindowInfo(control.Handle, null); } }
|
2008-02-28 13:46:44 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>Returns true if no messages are pending in the event loop.</summary>
|
|
|
|
|
public bool IsIdle
|
|
|
|
|
{
|
|
|
|
|
get { return !OpenTK.Platform.Windows.Functions.PeekMessage(ref msg, IntPtr.Zero, 0, 0, 0); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|