Class NativeWindow
Instances of this class implement the INativeWindow interface on the current platform.
Inherited Members
Namespace: OpenTK
Assembly: cs.temp.dll.dll
Syntax
public class NativeWindow : INativeWindow, IDisposable
Constructors
NativeWindow()
Constructs a new NativeWindow with default attributes without enabling events.
Declaration
public NativeWindow()
NativeWindow(Int32, Int32, Int32, Int32, String, GameWindowFlags, GraphicsMode, DisplayDevice)
Constructs a new NativeWindow with the specified attributes.
Declaration
public NativeWindow(int x, int y, int width, int height, string title, GameWindowFlags options, GraphicsMode mode, DisplayDevice device)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | Horizontal screen space coordinate of the NativeWindow's origin. |
System.Int32 | y | Vertical screen space coordinate of the NativeWindow's origin. |
System.Int32 | width | The width of the NativeWindow in pixels. |
System.Int32 | height | The height of the NativeWindow in pixels. |
System.String | title | The title of the NativeWindow. |
GameWindowFlags | options | GameWindow options specifying window appearance and behavior. |
GraphicsMode | mode | The OpenTK.Graphics.GraphicsMode of the NativeWindow. |
DisplayDevice | device | The OpenTK.Graphics.DisplayDevice to construct the NativeWindow in. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | If width or height is less than 1. |
System.ArgumentNullException | If mode or device is null. |
NativeWindow(Int32, Int32, String, GameWindowFlags, GraphicsMode, DisplayDevice)
Constructs a new centered NativeWindow with the specified attributes.
Declaration
public NativeWindow(int width, int height, string title, GameWindowFlags options, GraphicsMode mode, DisplayDevice device)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width of the NativeWindow in pixels. |
System.Int32 | height | The height of the NativeWindow in pixels. |
System.String | title | The title of the NativeWindow. |
GameWindowFlags | options | GameWindow options specifying window appearance and behavior. |
GraphicsMode | mode | The OpenTK.Graphics.GraphicsMode of the NativeWindow. |
DisplayDevice | device | The OpenTK.Graphics.DisplayDevice to construct the NativeWindow in. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | If width or height is less than 1. |
System.ArgumentNullException | If mode or device is null. |
Properties
Bounds
Gets or sets a
Declaration
public Rectangle Bounds { get; set; }
Property Value
Type | Description |
---|---|
Rectangle |
ClientRectangle
Gets or sets a
Declaration
public Rectangle ClientRectangle { get; set; }
Property Value
Type | Description |
---|---|
Rectangle |
ClientSize
Gets or sets a
Declaration
public Size ClientSize { get; set; }
Property Value
Type | Description |
---|---|
Size |
Cursor
Gets or sets the MouseCursor for this window.
Declaration
public MouseCursor Cursor { get; set; }
Property Value
Type | Description |
---|---|
MouseCursor |
CursorVisible
Gets or sets a value indicating whether the mouse cursor is visible.
Declaration
public bool CursorVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Exists
Gets a value indicating whether a render window exists.
Declaration
public bool Exists { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Focused
Gets a System.Boolean that indicates whether this NativeWindow has input focus.
Declaration
public bool Focused { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Height
Gets or sets the height of the OpenGL surface in window coordinates. The coordinates are specified in device-dependent pixels.
Declaration
public int Height { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Icon
Gets or sets the System.Drawing.Icon for this GameWindow.
Declaration
public Icon Icon { get; set; }
Property Value
Type | Description |
---|---|
Icon |
IsDisposed
Gets or sets a System.Boolean, which indicates whether this instance has been disposed.
Declaration
protected bool IsDisposed { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Location
Gets or sets a
Declaration
public Point Location { get; set; }
Property Value
Type | Description |
---|---|
Point |
Size
Gets or sets a
Declaration
public Size Size { get; set; }
Property Value
Type | Description |
---|---|
Size |
Title
Gets or sets the NativeWindow title.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Visible
Gets or sets a System.Boolean that indicates whether this NativeWindow is visible.
Declaration
public bool Visible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Width
Gets or sets the width of the OpenGL surface in window coordinates. The coordinates are specified in device-dependent pixels.
Declaration
public int Width { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
WindowBorder
Gets or sets the border of the NativeWindow.
Declaration
public WindowBorder WindowBorder { get; set; }
Property Value
Type | Description |
---|---|
WindowBorder |
WindowInfo
Gets the IWindowInfo of this window.
Declaration
public IWindowInfo WindowInfo { get; }
Property Value
Type | Description |
---|---|
IWindowInfo |
WindowState
Gets or sets the state of the NativeWindow.
Declaration
public virtual WindowState WindowState { get; set; }
Property Value
Type | Description |
---|---|
WindowState |
X
Gets or sets the horizontal location of this window in screen coordinates. The coordinates are specified in device-independent points.
Declaration
public int X { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Y
Gets or sets the vertical location of this window in screen coordinates. The coordinates are specified in device-independent points.
Declaration
public int Y { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Close()
Closes the NativeWindow.
Declaration
public void Close()
Dispose()
Releases all non-managed resources belonging to this NativeWindow.
Declaration
public virtual void Dispose()
EnsureUndisposed()
Ensures that this NativeWindow has not been disposed.
Declaration
protected void EnsureUndisposed()
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | If this NativeWindow has been disposed. |
OnClosed(EventArgs)
Called when the NativeWindow has closed.
Declaration
protected virtual void OnClosed(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnClosing(CancelEventArgs)
Called when the NativeWindow is about to close.
Declaration
protected virtual void OnClosing(CancelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
CancelEventArgs | e | The |
OnDisposed(EventArgs)
Called when the NativeWindow is disposed.
Declaration
protected virtual void OnDisposed(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnFileDrop(FileDropEventArgs)
Raises the FileDrop event.
Declaration
protected virtual void OnFileDrop(FileDropEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
FileDropEventArgs | e | A |
OnFocusedChanged(EventArgs)
Called when the Focused property of the NativeWindow has changed.
Declaration
protected virtual void OnFocusedChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnIconChanged(EventArgs)
Called when the Icon property of the NativeWindow has changed.
Declaration
protected virtual void OnIconChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnKeyDown(KeyboardKeyEventArgs)
Occurs whenever a keyboard key is pressed.
Declaration
protected virtual void OnKeyDown(KeyboardKeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyboardKeyEventArgs | e |
OnKeyPress(KeyPressEventArgs)
Called when a character is typed.
Declaration
protected virtual void OnKeyPress(KeyPressEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyPressEventArgs | e | The KeyPressEventArgs for this event. |
OnKeyUp(KeyboardKeyEventArgs)
Called when a keyboard key is released.
Declaration
protected virtual void OnKeyUp(KeyboardKeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
KeyboardKeyEventArgs | e | The KeyboardKeyEventArgs for this event. |
OnMouseDown(MouseButtonEventArgs)
Raises the MouseDown event.
Declaration
protected virtual void OnMouseDown(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseButtonEventArgs | e | A |
OnMouseEnter(EventArgs)
Called whenever the mouse cursor reenters the window Bounds.
Declaration
protected virtual void OnMouseEnter(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnMouseLeave(EventArgs)
Called whenever the mouse cursor leaves the window Bounds.
Declaration
protected virtual void OnMouseLeave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnMouseMove(MouseMoveEventArgs)
Raises the MouseMove event.
Declaration
protected virtual void OnMouseMove(MouseMoveEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseMoveEventArgs | e | A |
OnMouseUp(MouseButtonEventArgs)
Raises the MouseUp event.
Declaration
protected virtual void OnMouseUp(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseButtonEventArgs | e | A |
OnMouseWheel(MouseWheelEventArgs)
Raises the MouseWheel event.
Declaration
protected virtual void OnMouseWheel(MouseWheelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
MouseWheelEventArgs | e | A |
OnMove(EventArgs)
Called when the NativeWindow is moved.
Declaration
protected virtual void OnMove(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnResize(EventArgs)
Called when the NativeWindow is resized.
Declaration
protected virtual void OnResize(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnTitleChanged(EventArgs)
Called when the Title property of the NativeWindow has changed.
Declaration
protected virtual void OnTitleChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnVisibleChanged(EventArgs)
Called when the Visible property of the NativeWindow has changed.
Declaration
protected virtual void OnVisibleChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnWindowBorderChanged(EventArgs)
Called when the WindowBorder of this NativeWindow has changed.
Declaration
protected virtual void OnWindowBorderChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
OnWindowStateChanged(EventArgs)
Called when the WindowState of this NativeWindow has changed.
Declaration
protected virtual void OnWindowStateChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Not used. |
PointToClient(Point)
Transforms the specified point from screen to client coordinates.
Declaration
public Point PointToClient(Point point)
Parameters
Type | Name | Description |
---|---|---|
Point | point | A |
Returns
Type | Description |
---|---|
Point | The point transformed to client coordinates. |
PointToScreen(Point)
Transforms the specified point from client to screen coordinates.
Declaration
public Point PointToScreen(Point point)
Parameters
Type | Name | Description |
---|---|---|
Point | point | A |
Returns
Type | Description |
---|---|
Point | The point transformed to screen coordinates. |
ProcessEvents()
Processes operating system events until the NativeWindow becomes idle.
Declaration
public void ProcessEvents()
ProcessEvents(Boolean)
Processes operating system events until the NativeWindow becomes idle.
Declaration
protected void ProcessEvents(bool retainEvents)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | retainEvents | If true, the state of underlying system event propagation will be preserved, otherwise event propagation will be enabled if it has not been already. |
Events
Closed
Occurs after the window has closed.
Declaration
public event EventHandler<EventArgs> Closed
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
Closing
Occurs when the window is about to close.
Declaration
public event EventHandler<CancelEventArgs> Closing
Event Type
Type | Description |
---|---|
System.EventHandler<CancelEventArgs> |
Disposed
Occurs when the window is disposed.
Declaration
public event EventHandler<EventArgs> Disposed
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
FileDrop
Occurs whenever a file dropped on window;
Declaration
public event EventHandler<FileDropEventArgs> FileDrop
Event Type
Type | Description |
---|---|
System.EventHandler<FileDropEventArgs> |
FocusedChanged
Occurs when the Focused property of the window changes.
Declaration
public event EventHandler<EventArgs> FocusedChanged
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
IconChanged
Occurs when the Icon property of the window changes.
Declaration
public event EventHandler<EventArgs> IconChanged
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
KeyDown
Occurs whenever a keyboard key is pressed.
Declaration
public event EventHandler<KeyboardKeyEventArgs> KeyDown
Event Type
Type | Description |
---|---|
System.EventHandler<KeyboardKeyEventArgs> |
KeyPress
Occurs whenever a character is typed.
Declaration
public event EventHandler<KeyPressEventArgs> KeyPress
Event Type
Type | Description |
---|---|
System.EventHandler<KeyPressEventArgs> |
KeyUp
Occurs whenever a keyboard key is released.
Declaration
public event EventHandler<KeyboardKeyEventArgs> KeyUp
Event Type
Type | Description |
---|---|
System.EventHandler<KeyboardKeyEventArgs> |
MouseDown
Occurs when a
Declaration
public event EventHandler<MouseButtonEventArgs> MouseDown
Event Type
Type | Description |
---|---|
System.EventHandler<MouseButtonEventArgs> |
MouseEnter
Occurs whenever the mouse cursor enters the window Bounds.
Declaration
public event EventHandler<EventArgs> MouseEnter
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
MouseLeave
Occurs whenever the mouse cursor leaves the window Bounds.
Declaration
public event EventHandler<EventArgs> MouseLeave
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
MouseMove
Occurs whenever the mouse is moved.
Declaration
public event EventHandler<MouseMoveEventArgs> MouseMove
Event Type
Type | Description |
---|---|
System.EventHandler<MouseMoveEventArgs> |
MouseUp
Occurs when a
Declaration
public event EventHandler<MouseButtonEventArgs> MouseUp
Event Type
Type | Description |
---|---|
System.EventHandler<MouseButtonEventArgs> |
MouseWheel
Occurs whenever a mouse wheel is moved;
Declaration
public event EventHandler<MouseWheelEventArgs> MouseWheel
Event Type
Type | Description |
---|---|
System.EventHandler<MouseWheelEventArgs> |
Move
Occurs whenever the window is moved.
Declaration
public event EventHandler<EventArgs> Move
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
Resize
Occurs whenever the window is resized.
Declaration
public event EventHandler<EventArgs> Resize
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
TitleChanged
Occurs when the Title property of the window changes.
Declaration
public event EventHandler<EventArgs> TitleChanged
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
VisibleChanged
Occurs when the Visible property of the window changes.
Declaration
public event EventHandler<EventArgs> VisibleChanged
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
WindowBorderChanged
Occurs when the WindowBorder property of the window changes.
Declaration
public event EventHandler<EventArgs> WindowBorderChanged
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |
WindowStateChanged
Occurs when the WindowState property of the window changes.
Declaration
public event EventHandler<EventArgs> WindowStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<System.EventArgs> |