The Open Toolkit library  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
OpenTK.NativeWindow Class Reference

Instances of this class implement the OpenTK.INativeWindow interface on the current platform. More...

+ Inheritance diagram for OpenTK.NativeWindow:

Public Member Functions

 NativeWindow ()
 Constructs a new NativeWindow with default attributes without enabling events. More...
 
 NativeWindow (int width, int height, string title, GameWindowFlags options, GraphicsMode mode, DisplayDevice device)
 Constructs a new centered NativeWindow with the specified attributes. More...
 
 NativeWindow (int x, int y, int width, int height, string title, GameWindowFlags options, GraphicsMode mode, DisplayDevice device)
 Constructs a new NativeWindow with the specified attributes. More...
 
void Close ()
 Closes the NativeWindow. More...
 
Point PointToClient (Point point)
 Transforms the specified point from screen to client coordinates. More...
 
Point PointToScreen (Point point)
 Transforms the specified point from client to screen coordinates. More...
 
void ProcessEvents ()
 Processes operating system events until the NativeWindow becomes idle. More...
 
virtual void Dispose ()
 Releases all non-managed resources belonging to this NativeWindow. More...
 

Protected Member Functions

void EnsureUndisposed ()
 Ensures that this NativeWindow has not been disposed. More...
 
virtual void OnClosed (EventArgs e)
 Called when the NativeWindow has closed. More...
 
virtual void OnClosing (CancelEventArgs e)
 Called when the NativeWindow is about to close. More...
 
virtual void OnDisposed (EventArgs e)
 Called when the NativeWindow is disposed. More...
 
virtual void OnFocusedChanged (EventArgs e)
 Called when the OpenTK.INativeWindow.Focused property of the NativeWindow has changed. More...
 
virtual void OnIconChanged (EventArgs e)
 Called when the OpenTK.INativeWindow.Icon property of the NativeWindow has changed. More...
 
virtual void OnKeyDown (KeyboardKeyEventArgs e)
 Occurs whenever a keybord key is pressed. More...
 
virtual void OnKeyPress (KeyPressEventArgs e)
 Called when a character is typed. More...
 
virtual void OnKeyUp (KeyboardKeyEventArgs e)
 Called when a keybord key is released. More...
 
virtual void OnMove (EventArgs e)
 Called when the NativeWindow is moved. More...
 
virtual void OnMouseEnter (EventArgs e)
 Called whenever the mouse cursor reenters the window Bounds. More...
 
virtual void OnMouseLeave (EventArgs e)
 Called whenever the mouse cursor leaves the window Bounds. More...
 
virtual void OnResize (EventArgs e)
 Called when the NativeWindow is resized. More...
 
virtual void OnTitleChanged (EventArgs e)
 Called when the OpenTK.INativeWindow.Title property of the NativeWindow has changed. More...
 
virtual void OnVisibleChanged (EventArgs e)
 Called when the OpenTK.INativeWindow.Visible property of the NativeWindow has changed. More...
 
virtual void OnWindowBorderChanged (EventArgs e)
 Called when the WindowBorder of this NativeWindow has changed. More...
 
virtual void OnWindowStateChanged (EventArgs e)
 Called when the WindowState of this NativeWindow has changed. More...
 
void ProcessEvents (bool retainEvents)
 Processes operating system events until the NativeWindow becomes idle. More...
 

Properties

Rectangle Bounds [get, set]
 Gets or sets a System.Drawing.Rectangle structure that contains the external bounds of this window, in screen coordinates. External bounds include the title bar, borders and drawing area of the window. More...
 
Rectangle ClientRectangle [get, set]
 Gets or sets a System.Drawing.Rectangle structure that contains the internal bounds of this window, in client coordinates. The internal bounds include the drawing area of the window, but exclude the titlebar and window borders. More...
 
Size ClientSize [get, set]
 Gets or sets a System.Drawing.Size structure that contains the internal size this window. More...
 
bool Exists [get]
 Gets a value indicating whether a render window exists. More...
 
bool Focused [get]
 Gets a System.Boolean that indicates whether this NativeWindow has input focus. More...
 
int Height [get, set]
 Gets or sets the external height of this window. More...
 
Icon Icon [get, set]
 Gets or sets the System.Drawing.Icon for this GameWindow. More...
 
IInputDriver InputDriver [get]
 This property is deprecated. More...
 
Point Location [get, set]
 Gets or sets a System.Drawing.Point structure that contains the location of this window on the desktop. More...
 
Size Size [get, set]
 Gets or sets a System.Drawing.Size structure that contains the external size of this window. More...
 
string Title [get, set]
 Gets or sets the NativeWindow title. More...
 
bool Visible [get, set]
 Gets or sets a System.Boolean that indicates whether this NativeWindow is visible. More...
 
int Width [get, set]
 Gets or sets the external width of this window. More...
 
WindowBorder WindowBorder [get, set]
 Gets or states the border of the NativeWindow. More...
 
IWindowInfo WindowInfo [get]
 Gets the OpenTK.Platform.IWindowInfo of this window. More...
 
virtual WindowState WindowState [get, set]
 Gets or states the state of the NativeWindow. More...
 
int X [get, set]
 Gets or sets the horizontal location of this window on the desktop. More...
 
int Y [get, set]
 Gets or sets the vertical location of this window on the desktop. More...
 
bool CursorVisible [get, set]
 Gets or sets a value indicating whether the mouse cursor is visible. More...
 
bool IsDisposed [get, set]
 Gets or sets a System.Boolean, which indicates whether this instance has been disposed. More...
 
- Properties inherited from OpenTK.INativeWindow
Icon Icon [get, set]
 Gets or sets the System.Drawing.Icon of the window. More...
 
string Title [get, set]
 Gets or sets the title of the window. More...
 
bool Focused [get]
 Gets a System.Boolean that indicates whether this window has input focus. More...
 
bool Visible [get, set]
 Gets or sets a System.Boolean that indicates whether the window is visible. More...
 
bool Exists [get]
 Gets a System.Boolean that indicates whether the window has been created and has not been destroyed. More...
 
IWindowInfo WindowInfo [get]
 Gets the OpenTK.Platform.IWindowInfo for this window. More...
 
WindowState WindowState [get, set]
 Gets or sets the OpenTK.WindowState for this window. More...
 
WindowBorder WindowBorder [get, set]
 Gets or sets the OpenTK.WindowBorder for this window. More...
 
Rectangle Bounds [get, set]
 Gets or sets a System.Drawing.Rectangle structure the contains the external bounds of this window, in screen coordinates. External bounds include the title bar, borders and drawing area of the window. More...
 
Point Location [get, set]
 Gets or sets a System.Drawing.Point structure that contains the location of this window on the desktop. More...
 
Size Size [get, set]
 Gets or sets a System.Drawing.Size structure that contains the external size of this window. More...
 
int X [get, set]
 Gets or sets the horizontal location of this window on the desktop. More...
 
int Y [get, set]
 Gets or sets the vertical location of this window on the desktop. More...
 
int Width [get, set]
 Gets or sets the external width of this window. More...
 
int Height [get, set]
 Gets or sets the external height of this window. More...
 
Rectangle ClientRectangle [get, set]
 Gets or sets a System.Drawing.Rectangle structure that contains the internal bounds of this window, in client coordinates. The internal bounds include the drawing area of the window, but exclude the titlebar and window borders. More...
 
Size ClientSize [get, set]
 Gets or sets a System.Drawing.Size structure that contains the internal size this window. More...
 
OpenTK.Input.IInputDriver InputDriver [get]
 This property is deprecated and should not be used. More...
 
bool CursorVisible [get, set]
 Gets or sets a value, indicating whether the mouse cursor is visible. More...
 

Events

EventHandler< EventArgs > Closed = delegate { }
 Occurs after the window has closed. More...
 
EventHandler< CancelEventArgs > Closing = delegate { }
 Occurs when the window is about to close. More...
 
EventHandler< EventArgs > Disposed = delegate { }
 Occurs when the window is disposed. More...
 
EventHandler< EventArgs > FocusedChanged = delegate { }
 Occurs when the Focused property of the window changes. More...
 
EventHandler< EventArgs > IconChanged = delegate { }
 Occurs when the Icon property of the window changes. More...
 
EventHandler
< OpenTK.Input.KeyboardKeyEventArgs
KeyDown = delegate { }
 Occurs whenever a keybord key is pressed. More...
 
EventHandler< KeyPressEventArgsKeyPress = delegate { }
 Occurs whenever a character is typed. More...
 
EventHandler
< OpenTK.Input.KeyboardKeyEventArgs
KeyUp = delegate { }
 Occurs whenever a keyboard key is released. More...
 
EventHandler< EventArgs > Move = delegate { }
 Occurs whenever the window is moved. More...
 
EventHandler< EventArgs > MouseEnter = delegate { }
 Occurs whenever the mouse cursor enters the window Bounds. More...
 
EventHandler< EventArgs > MouseLeave = delegate { }
 Occurs whenever the mouse cursor leaves the window Bounds. More...
 
EventHandler< EventArgs > Resize = delegate { }
 Occurs whenever the window is resized. More...
 
EventHandler< EventArgs > TitleChanged = delegate { }
 Occurs when the Title property of the window changes. More...
 
EventHandler< EventArgs > VisibleChanged = delegate { }
 Occurs when the Visible property of the window changes. More...
 
EventHandler< EventArgs > WindowBorderChanged = delegate { }
 Occurs when the WindowBorder property of the window changes. More...
 
EventHandler< EventArgs > WindowStateChanged = delegate { }
 Occurs when the WindowState property of the window changes. More...
 
- Events inherited from OpenTK.INativeWindow
EventHandler< EventArgs > Move
 Occurs whenever the window is moved. More...
 
EventHandler< EventArgs > Resize
 Occurs whenever the window is resized. More...
 
EventHandler< CancelEventArgs > Closing
 Occurs when the window is about to close. More...
 
EventHandler< EventArgs > Closed
 Occurs after the window has closed. More...
 
EventHandler< EventArgs > Disposed
 Occurs when the window is disposed. More...
 
EventHandler< EventArgs > IconChanged
 Occurs when the Icon property of the window changes. More...
 
EventHandler< EventArgs > TitleChanged
 Occurs when the Title property of the window changes. More...
 
EventHandler< EventArgs > VisibleChanged
 Occurs when the Visible property of the window changes. More...
 
EventHandler< EventArgs > FocusedChanged
 Occurs when the Focused property of the window changes. More...
 
EventHandler< EventArgs > WindowBorderChanged
 Occurs when the WindowBorder property of the window changes. More...
 
EventHandler< EventArgs > WindowStateChanged
 Occurs when the WindowState property of the window changes. More...
 
EventHandler
< OpenTK.Input.KeyboardKeyEventArgs
KeyDown
 Occurs whenever a keybord key is pressed. More...
 
EventHandler< KeyPressEventArgsKeyPress
 Occurs whenever a character is typed. More...
 
EventHandler
< OpenTK.Input.KeyboardKeyEventArgs
KeyUp
 Occurs whenever a keyboard key is released. More...
 
EventHandler< EventArgs > MouseLeave
 Occurs whenever the mouse cursor leaves the window Bounds. More...
 
EventHandler< EventArgs > MouseEnter
 Occurs whenever the mouse cursor enters the window Bounds. More...
 

Detailed Description

Instances of this class implement the OpenTK.INativeWindow interface on the current platform.

Constructor & Destructor Documentation

OpenTK.NativeWindow.NativeWindow ( )

Constructs a new NativeWindow with default attributes without enabling events.

OpenTK.NativeWindow.NativeWindow ( int  width,
int  height,
string  title,
GameWindowFlags  options,
GraphicsMode  mode,
DisplayDevice  device 
)

Constructs a new centered NativeWindow with the specified attributes.

Parameters
widthThe width of the NativeWindow in pixels.
heightThe height of the NativeWindow in pixels.
titleThe title of the NativeWindow.
optionsGameWindow options specifying window appearance and behavior.
modeThe OpenTK.Graphics.GraphicsMode of the NativeWindow.
deviceThe OpenTK.Graphics.DisplayDevice to construct the NativeWindow in.
Exceptions
System.ArgumentOutOfRangeExceptionIf width or height is less than 1.
System.ArgumentNullExceptionIf mode or device is null.
OpenTK.NativeWindow.NativeWindow ( int  x,
int  y,
int  width,
int  height,
string  title,
GameWindowFlags  options,
GraphicsMode  mode,
DisplayDevice  device 
)

Constructs a new NativeWindow with the specified attributes.

Parameters
xHorizontal screen space coordinate of the NativeWindow's origin.
yVertical screen space coordinate of the NativeWindow's origin.
widthThe width of the NativeWindow in pixels.
heightThe height of the NativeWindow in pixels.
titleThe title of the NativeWindow.
optionsGameWindow options specifying window appearance and behavior.
modeThe OpenTK.Graphics.GraphicsMode of the NativeWindow.
deviceThe OpenTK.Graphics.DisplayDevice to construct the NativeWindow in.
Exceptions
System.ArgumentOutOfRangeExceptionIf width or height is less than 1.
System.ArgumentNullExceptionIf mode or device is null.

Member Function Documentation

void OpenTK.NativeWindow.Close ( )

Closes the NativeWindow.

Implements OpenTK.INativeWindow.

virtual void OpenTK.NativeWindow.Dispose ( )
virtual

Releases all non-managed resources belonging to this NativeWindow.

Reimplemented in OpenTK.GameWindow.

void OpenTK.NativeWindow.EnsureUndisposed ( )
protected

Ensures that this NativeWindow has not been disposed.

Exceptions
System.ObjectDisposedExceptionIf this NativeWindow has been disposed.
virtual void OpenTK.NativeWindow.OnClosed ( EventArgs  e)
protectedvirtual

Called when the NativeWindow has closed.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnClosing ( CancelEventArgs  e)
protectedvirtual

Called when the NativeWindow is about to close.

Parameters
eThe System.ComponentModel.CancelEventArgs for this event. Set e.Cancel to true in order to stop the NativeWindow from closing.
virtual void OpenTK.NativeWindow.OnDisposed ( EventArgs  e)
protectedvirtual

Called when the NativeWindow is disposed.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnFocusedChanged ( EventArgs  e)
protectedvirtual

Called when the OpenTK.INativeWindow.Focused property of the NativeWindow has changed.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnIconChanged ( EventArgs  e)
protectedvirtual

Called when the OpenTK.INativeWindow.Icon property of the NativeWindow has changed.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnKeyDown ( KeyboardKeyEventArgs  e)
protectedvirtual

Occurs whenever a keybord key is pressed.

virtual void OpenTK.NativeWindow.OnKeyPress ( KeyPressEventArgs  e)
protectedvirtual

Called when a character is typed.

Parameters
eThe OpenTK.KeyPressEventArgs for this event.
virtual void OpenTK.NativeWindow.OnKeyUp ( KeyboardKeyEventArgs  e)
protectedvirtual

Called when a keybord key is released.

Parameters
eThe OpenTK.Input.KeyboardKeyEventArgs for this event.
virtual void OpenTK.NativeWindow.OnMouseEnter ( EventArgs  e)
protectedvirtual

Called whenever the mouse cursor reenters the window Bounds.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnMouseLeave ( EventArgs  e)
protectedvirtual

Called whenever the mouse cursor leaves the window Bounds.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnMove ( EventArgs  e)
protectedvirtual

Called when the NativeWindow is moved.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnResize ( EventArgs  e)
protectedvirtual

Called when the NativeWindow is resized.

Parameters
eNot used.

Reimplemented in OpenTK.GameWindow.

virtual void OpenTK.NativeWindow.OnTitleChanged ( EventArgs  e)
protectedvirtual

Called when the OpenTK.INativeWindow.Title property of the NativeWindow has changed.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnVisibleChanged ( EventArgs  e)
protectedvirtual

Called when the OpenTK.INativeWindow.Visible property of the NativeWindow has changed.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnWindowBorderChanged ( EventArgs  e)
protectedvirtual

Called when the WindowBorder of this NativeWindow has changed.

Parameters
eNot used.
virtual void OpenTK.NativeWindow.OnWindowStateChanged ( EventArgs  e)
protectedvirtual

Called when the WindowState of this NativeWindow has changed.

Parameters
eNot used.
Point OpenTK.NativeWindow.PointToClient ( Point  point)

Transforms the specified point from screen to client coordinates.

Parameters
pointA System.Drawing.Point to transform.
Returns
The point transformed to client coordinates.

Implements OpenTK.INativeWindow.

Point OpenTK.NativeWindow.PointToScreen ( Point  point)

Transforms the specified point from client to screen coordinates.

Parameters
pointA System.Drawing.Point to transform.
Returns
The point transformed to screen coordinates.

Implements OpenTK.INativeWindow.

void OpenTK.NativeWindow.ProcessEvents ( )

Processes operating system events until the NativeWindow becomes idle.

Implements OpenTK.INativeWindow.

void OpenTK.NativeWindow.ProcessEvents ( bool  retainEvents)
protected

Processes operating system events until the NativeWindow becomes idle.

Parameters
retainEventsIf true, the state of underlying system event propagation will be preserved, otherwise event propagation will be enabled if it has not been already.

Property Documentation

Rectangle OpenTK.NativeWindow.Bounds
getset

Gets or sets a System.Drawing.Rectangle structure that contains the external bounds of this window, in screen coordinates. External bounds include the title bar, borders and drawing area of the window.

Rectangle OpenTK.NativeWindow.ClientRectangle
getset

Gets or sets a System.Drawing.Rectangle structure that contains the internal bounds of this window, in client coordinates. The internal bounds include the drawing area of the window, but exclude the titlebar and window borders.

Size OpenTK.NativeWindow.ClientSize
getset

Gets or sets a System.Drawing.Size structure that contains the internal size this window.

bool OpenTK.NativeWindow.CursorVisible
getset

Gets or sets a value indicating whether the mouse cursor is visible.

bool OpenTK.NativeWindow.Exists
get

Gets a value indicating whether a render window exists.

bool OpenTK.NativeWindow.Focused
get

Gets a System.Boolean that indicates whether this NativeWindow has input focus.

int OpenTK.NativeWindow.Height
getset

Gets or sets the external height of this window.

Icon OpenTK.NativeWindow.Icon
getset

Gets or sets the System.Drawing.Icon for this GameWindow.

IInputDriver OpenTK.NativeWindow.InputDriver
get

This property is deprecated.

bool OpenTK.NativeWindow.IsDisposed
getsetprotected

Gets or sets a System.Boolean, which indicates whether this instance has been disposed.

Point OpenTK.NativeWindow.Location
getset

Gets or sets a System.Drawing.Point structure that contains the location of this window on the desktop.

Size OpenTK.NativeWindow.Size
getset

Gets or sets a System.Drawing.Size structure that contains the external size of this window.

string OpenTK.NativeWindow.Title
getset

Gets or sets the NativeWindow title.

bool OpenTK.NativeWindow.Visible
getset

Gets or sets a System.Boolean that indicates whether this NativeWindow is visible.

int OpenTK.NativeWindow.Width
getset

Gets or sets the external width of this window.

WindowBorder OpenTK.NativeWindow.WindowBorder
getset

Gets or states the border of the NativeWindow.

IWindowInfo OpenTK.NativeWindow.WindowInfo
get

Gets the OpenTK.Platform.IWindowInfo of this window.

virtual WindowState OpenTK.NativeWindow.WindowState
getset

Gets or states the state of the NativeWindow.

int OpenTK.NativeWindow.X
getset

Gets or sets the horizontal location of this window on the desktop.

int OpenTK.NativeWindow.Y
getset

Gets or sets the vertical location of this window on the desktop.

Event Documentation

EventHandler<EventArgs> OpenTK.NativeWindow.Closed = delegate { }

Occurs after the window has closed.

EventHandler<CancelEventArgs> OpenTK.NativeWindow.Closing = delegate { }

Occurs when the window is about to close.

EventHandler<EventArgs> OpenTK.NativeWindow.Disposed = delegate { }

Occurs when the window is disposed.

EventHandler<EventArgs> OpenTK.NativeWindow.FocusedChanged = delegate { }

Occurs when the Focused property of the window changes.

EventHandler<EventArgs> OpenTK.NativeWindow.IconChanged = delegate { }

Occurs when the Icon property of the window changes.

EventHandler<OpenTK.Input.KeyboardKeyEventArgs> OpenTK.NativeWindow.KeyDown = delegate { }

Occurs whenever a keybord key is pressed.

EventHandler<KeyPressEventArgs> OpenTK.NativeWindow.KeyPress = delegate { }

Occurs whenever a character is typed.

EventHandler<OpenTK.Input.KeyboardKeyEventArgs> OpenTK.NativeWindow.KeyUp = delegate { }

Occurs whenever a keyboard key is released.

EventHandler<EventArgs> OpenTK.NativeWindow.MouseEnter = delegate { }

Occurs whenever the mouse cursor enters the window Bounds.

EventHandler<EventArgs> OpenTK.NativeWindow.MouseLeave = delegate { }

Occurs whenever the mouse cursor leaves the window Bounds.

EventHandler<EventArgs> OpenTK.NativeWindow.Move = delegate { }

Occurs whenever the window is moved.

EventHandler<EventArgs> OpenTK.NativeWindow.Resize = delegate { }

Occurs whenever the window is resized.

EventHandler<EventArgs> OpenTK.NativeWindow.TitleChanged = delegate { }

Occurs when the Title property of the window changes.

EventHandler<EventArgs> OpenTK.NativeWindow.VisibleChanged = delegate { }

Occurs when the Visible property of the window changes.

EventHandler<EventArgs> OpenTK.NativeWindow.WindowBorderChanged = delegate { }

Occurs when the WindowBorder property of the window changes.

EventHandler<EventArgs> OpenTK.NativeWindow.WindowStateChanged = delegate { }

Occurs when the WindowState property of the window changes.