Instances of this class implement the OpenTK.INativeWindow interface on the current platform. More...
Public Member Functions | |
| NativeWindow () | |
| Constructs a new NativeWindow with default attributes without enabling events. | |
| NativeWindow (int width, int height, string title, GameWindowFlags options, GraphicsMode mode, DisplayDevice device) | |
| Constructs a new centered NativeWindow with the specified attributes. | |
| 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. | |
| void | Close () |
| Closes the NativeWindow. | |
| Point | PointToClient (Point point) |
| Transforms the specified point from screen to client coordinates. | |
| Point | PointToScreen (Point point) |
| Transforms the specified point from client to screen coordinates. | |
| void | ProcessEvents () |
| Processes operating system events until the NativeWindow becomes idle. | |
| virtual void | Dispose () |
| Releases all non-managed resources belonging to this NativeWindow. | |
Protected Member Functions | |
| void | EnsureUndisposed () |
| Ensures that this NativeWindow has not been disposed. | |
| virtual void | OnClosed (EventArgs e) |
| Called when the NativeWindow has closed. | |
| virtual void | OnClosing (CancelEventArgs e) |
| Called when the NativeWindow is about to close. | |
| virtual void | OnDisposed (EventArgs e) |
| Called when the NativeWindow is disposed. | |
| virtual void | OnFocusedChanged (EventArgs e) |
| Called when the OpenTK.INativeWindow.Focused property of the NativeWindow has changed. | |
| virtual void | OnIconChanged (EventArgs e) |
| Called when the OpenTK.INativeWindow.Icon property of the NativeWindow has changed. | |
| virtual void | OnKeyPress (KeyPressEventArgs e) |
| Called when a character is typed. | |
| virtual void | OnMove (EventArgs e) |
| Called when the NativeWindow is moved. | |
| virtual void | OnMouseEnter (EventArgs e) |
| Called whenever the mouse cursor reenters the window Bounds. | |
| virtual void | OnMouseLeave (EventArgs e) |
| Called whenever the mouse cursor leaves the window Bounds. | |
| virtual void | OnResize (EventArgs e) |
| Called when the NativeWindow is resized. | |
| virtual void | OnTitleChanged (EventArgs e) |
| Called when the OpenTK.INativeWindow.Title property of the NativeWindow has changed. | |
| virtual void | OnVisibleChanged (EventArgs e) |
| Called when the OpenTK.INativeWindow.Visible property of the NativeWindow has changed. | |
| virtual void | OnWindowBorderChanged (EventArgs e) |
| Called when the WindowBorder of this NativeWindow has changed. | |
| virtual void | OnWindowStateChanged (EventArgs e) |
| Called when the WindowState of this NativeWindow has changed. | |
| void | ProcessEvents (bool retainEvents) |
| Processes operating system events until the NativeWindow becomes idle. | |
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. | |
| 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. | |
| Size | ClientSize [get, set] |
| Gets or sets a System.Drawing.Size structure that contains the internal size this window. | |
| bool | Exists [get] |
| Gets a value indicating whether a render window exists. | |
| bool | Focused [get] |
| Gets a System.Boolean that indicates whether this NativeWindow has input focus. | |
| int | Height [get, set] |
| Gets or sets the external height of this window. | |
| Icon | Icon [get, set] |
| Gets or sets the System.Drawing.Icon for this GameWindow. | |
| IInputDriver | InputDriver [get] |
| This property is deprecated. | |
| Point | Location [get, set] |
| Gets or sets a System.Drawing.Point structure that contains the location of this window on the desktop. | |
| Size | Size [get, set] |
| Gets or sets a System.Drawing.Size structure that contains the external size of this window. | |
| string | Title [get, set] |
| Gets or sets the NativeWindow title. | |
| bool | Visible [get, set] |
| Gets or sets a System.Boolean that indicates whether this NativeWindow is visible. | |
| int | Width [get, set] |
| Gets or sets the external width of this window. | |
| WindowBorder | WindowBorder [get, set] |
| Gets or states the border of the NativeWindow. | |
| IWindowInfo | WindowInfo [get] |
| Gets the OpenTK.Platform.IWindowInfo of this window. | |
| virtual WindowState | WindowState [get, set] |
| Gets or states the state of the NativeWindow. | |
| int | X [get, set] |
| Gets or sets the horizontal location of this window on the desktop. | |
| int | Y [get, set] |
| Gets or sets the vertical location of this window on the desktop. | |
| bool | IsDisposed [get, set] |
| Gets or sets a System.Boolean, which indicates whether this instance has been disposed. | |
Events | |
| EventHandler< EventArgs > | Closed |
| Occurs after the window has closed. | |
| EventHandler< CancelEventArgs > | Closing |
| Occurs when the window is about to close. | |
| EventHandler< EventArgs > | Disposed |
| Occurs when the window is disposed. | |
| EventHandler< EventArgs > | FocusedChanged |
| Occurs when the Focused property of the window changes. | |
| EventHandler< EventArgs > | IconChanged |
| Occurs when the Icon property of the window changes. | |
| EventHandler< KeyPressEventArgs > | KeyPress |
| Occurs whenever a character is typed. | |
| EventHandler< EventArgs > | Move |
| Occurs whenever the window is moved. | |
| EventHandler< EventArgs > | MouseEnter |
| Occurs whenever the mouse cursor enters the window Bounds. | |
| EventHandler< EventArgs > | MouseLeave |
| Occurs whenever the mouse cursor leaves the window Bounds. | |
| EventHandler< EventArgs > | Resize |
| Occurs whenever the window is resized. | |
| EventHandler< EventArgs > | TitleChanged |
| Occurs when the Title property of the window changes. | |
| EventHandler< EventArgs > | VisibleChanged |
| Occurs when the Visible property of the window changes. | |
| EventHandler< EventArgs > | WindowBorderChanged |
| Occurs when the WindowBorder property of the window changes. | |
| EventHandler< EventArgs > | WindowStateChanged |
| Occurs when the WindowState property of the window changes. | |
Instances of this class implement the OpenTK.INativeWindow interface on the current platform.
Definition at line 41 of file NativeWindow.cs.
| OpenTK.NativeWindow.NativeWindow | ( | ) |
Constructs a new NativeWindow with default attributes without enabling events.
Definition at line 58 of file NativeWindow.cs.
00059 : this(640, 480, "OpenTK Native Window", GameWindowFlags.Default, GraphicsMode.Default, DisplayDevice.Default) { }
| OpenTK.NativeWindow.NativeWindow | ( | int | width, | |
| int | height, | |||
| string | title, | |||
| GameWindowFlags | options, | |||
| GraphicsMode | mode, | |||
| DisplayDevice | device | |||
| ) |
Constructs a new centered NativeWindow with the specified attributes.
| width | The width of the NativeWindow in pixels. | |
| height | The height of the NativeWindow in pixels. | |
| title | The title of the NativeWindow. | |
| options | GameWindow options specifying window appearance and behavior. | |
| mode | The OpenTK.Graphics.GraphicsMode of the NativeWindow. | |
| device | The OpenTK.Graphics.DisplayDevice to construct the NativeWindow in. |
| System.ArgumentOutOfRangeException | If width or height is less than 1. | |
| System.ArgumentNullException | If mode or device is null. |
Definition at line 72 of file NativeWindow.cs.
| 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.
| x | Horizontal screen space coordinate of the NativeWindow's origin. | |
| y | Vertical screen space coordinate of the NativeWindow's origin. | |
| width | The width of the NativeWindow in pixels. | |
| height | The height of the NativeWindow in pixels. | |
| title | The title of the NativeWindow. | |
| options | GameWindow options specifying window appearance and behavior. | |
| mode | The OpenTK.Graphics.GraphicsMode of the NativeWindow. | |
| device | The OpenTK.Graphics.DisplayDevice to construct the NativeWindow in. |
| System.ArgumentOutOfRangeException | If width or height is less than 1. | |
| System.ArgumentNullException | If mode or device is null. |
Definition at line 88 of file NativeWindow.cs.
00089 { 00090 // TODO: Should a constraint be added for the position? 00091 if (width < 1) 00092 throw new ArgumentOutOfRangeException("width", "Must be greater than zero."); 00093 if (height < 1) 00094 throw new ArgumentOutOfRangeException("height", "Must be greater than zero."); 00095 if (mode == null) 00096 throw new ArgumentNullException("mode"); 00097 if (device == null) 00098 throw new ArgumentNullException("device"); 00099 00100 this.options = options; 00101 this.device = device; 00102 00103 implementation = Factory.Default.CreateNativeWindow(x, y, width, height, title, mode, options, this.device); 00104 00105 if ((options & GameWindowFlags.Fullscreen) != 0) 00106 { 00107 this.device.ChangeResolution(width, height, mode.ColorFormat.BitsPerPixel, 0); 00108 WindowState = WindowState.Fullscreen; 00109 } 00110 }
| void OpenTK.NativeWindow.Close | ( | ) |
Closes the NativeWindow.
Implements OpenTK.INativeWindow.
Definition at line 123 of file NativeWindow.cs.
00124 { 00125 EnsureUndisposed(); 00126 implementation.Close(); 00127 }
| virtual void OpenTK.NativeWindow.Dispose | ( | ) | [virtual] |
Releases all non-managed resources belonging to this NativeWindow.
Reimplemented in OpenTK.GameWindow.
Definition at line 629 of file NativeWindow.cs.
00630 { 00631 if (!IsDisposed) 00632 { 00633 if ((options & GameWindowFlags.Fullscreen) != 0) 00634 { 00635 //if (WindowState == WindowState.Fullscreen) WindowState = WindowState.Normal; // TODO: Revise. 00636 device.RestoreResolution(); 00637 } 00638 implementation.Dispose(); 00639 GC.SuppressFinalize(this); 00640 00641 IsDisposed = true; 00642 } 00643 }
| void OpenTK.NativeWindow.EnsureUndisposed | ( | ) | [protected] |
Ensures that this NativeWindow has not been disposed.
| System.ObjectDisposedException | If this NativeWindow has been disposed. |
Definition at line 661 of file NativeWindow.cs.
00662 { 00663 if (IsDisposed) throw new ObjectDisposedException(GetType().Name); 00664 }
| virtual void OpenTK.NativeWindow.OnClosed | ( | EventArgs | e | ) | [protected, virtual] |
Called when the NativeWindow has closed.
| e | Not used. |
Definition at line 688 of file NativeWindow.cs.
| virtual void OpenTK.NativeWindow.OnClosing | ( | CancelEventArgs | e | ) | [protected, virtual] |
Called when the NativeWindow is about to close.
| e | The System.ComponentModel.CancelEventArgs for this event. Set e.Cancel to true in order to stop the NativeWindow from closing. |
Definition at line 703 of file NativeWindow.cs.
| virtual void OpenTK.NativeWindow.OnDisposed | ( | EventArgs | e | ) | [protected, virtual] |
Called when the NativeWindow is disposed.
| e | Not used. |
Definition at line 716 of file NativeWindow.cs.
| virtual void OpenTK.NativeWindow.OnFocusedChanged | ( | EventArgs | e | ) | [protected, virtual] |
Called when the OpenTK.INativeWindow.Focused property of the NativeWindow has changed.
| e | Not used. |
Definition at line 729 of file NativeWindow.cs.
00730 { 00731 if (FocusedChanged != null) FocusedChanged(this, e); 00732 }
| virtual void OpenTK.NativeWindow.OnIconChanged | ( | EventArgs | e | ) | [protected, virtual] |
Called when the OpenTK.INativeWindow.Icon property of the NativeWindow has changed.
| e | Not used. |
Definition at line 742 of file NativeWindow.cs.
00743 { 00744 if (IconChanged != null) IconChanged(this, e); 00745 }
| virtual void OpenTK.NativeWindow.OnKeyPress | ( | KeyPressEventArgs | e | ) | [protected, virtual] |
Called when a character is typed.
| e | The OpenTK.KeyPressEventArgs for this event. |
Definition at line 755 of file NativeWindow.cs.
| virtual void OpenTK.NativeWindow.OnMouseEnter | ( | EventArgs | e | ) | [protected, virtual] |
Called whenever the mouse cursor reenters the window Bounds.
| e | Not used. |
Definition at line 781 of file NativeWindow.cs.
00782 { 00783 if (MouseEnter != null) MouseEnter(this, e); 00784 }
| virtual void OpenTK.NativeWindow.OnMouseLeave | ( | EventArgs | e | ) | [protected, virtual] |
Called whenever the mouse cursor leaves the window Bounds.
| e | Not used. |
Definition at line 794 of file NativeWindow.cs.
00795 { 00796 if (MouseLeave != null) MouseLeave(this, e); 00797 }
| virtual void OpenTK.NativeWindow.OnMove | ( | EventArgs | e | ) | [protected, virtual] |
Called when the NativeWindow is moved.
| e | Not used. |
Definition at line 768 of file NativeWindow.cs.
| virtual void OpenTK.NativeWindow.OnResize | ( | EventArgs | e | ) | [protected, virtual] |
Called when the NativeWindow is resized.
| e | Not used. |
Reimplemented in OpenTK.GameWindow.
Definition at line 807 of file NativeWindow.cs.
| virtual void OpenTK.NativeWindow.OnTitleChanged | ( | EventArgs | e | ) | [protected, virtual] |
Called when the OpenTK.INativeWindow.Title property of the NativeWindow has changed.
| e | Not used. |
Definition at line 820 of file NativeWindow.cs.
00821 { 00822 if (TitleChanged != null) TitleChanged(this, e); 00823 }
| virtual void OpenTK.NativeWindow.OnVisibleChanged | ( | EventArgs | e | ) | [protected, virtual] |
Called when the OpenTK.INativeWindow.Visible property of the NativeWindow has changed.
| e | Not used. |
Definition at line 833 of file NativeWindow.cs.
00834 { 00835 if (VisibleChanged != null) VisibleChanged(this, e); 00836 }
| virtual void OpenTK.NativeWindow.OnWindowBorderChanged | ( | EventArgs | e | ) | [protected, virtual] |
Called when the WindowBorder of this NativeWindow has changed.
| e | Not used. |
Definition at line 846 of file NativeWindow.cs.
00847 { 00848 if (WindowBorderChanged != null) WindowBorderChanged(this, e); 00849 }
| virtual void OpenTK.NativeWindow.OnWindowStateChanged | ( | EventArgs | e | ) | [protected, virtual] |
Called when the WindowState of this NativeWindow has changed.
| e | Not used. |
Definition at line 859 of file NativeWindow.cs.
00860 { 00861 if (WindowStateChanged != null) WindowStateChanged(this, e); 00862 }
| Point OpenTK.NativeWindow.PointToClient | ( | Point | point | ) |
Transforms the specified point from screen to client coordinates.
| point | A System.Drawing.Point to transform. |
Implements OpenTK.INativeWindow.
Definition at line 142 of file NativeWindow.cs.
| Point OpenTK.NativeWindow.PointToScreen | ( | Point | point | ) |
Transforms the specified point from client to screen coordinates.
| point | A System.Drawing.Point to transform. |
Implements OpenTK.INativeWindow.
Definition at line 160 of file NativeWindow.cs.
00161 { 00162 // Here we use the fact that PointToClient just translates the point, and PointToScreen 00163 // should perform the inverse operation. 00164 Point trans = PointToClient(Point.Empty); 00165 point.X -= trans.X; 00166 point.Y -= trans.Y; 00167 return point; 00168 }
| void OpenTK.NativeWindow.ProcessEvents | ( | bool | retainEvents | ) | [protected] |
Processes operating system events until the NativeWindow becomes idle.
| 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. |
Definition at line 872 of file NativeWindow.cs.
00873 { 00874 EnsureUndisposed(); 00875 if (!retainEvents && !events) Events = true; 00876 implementation.ProcessEvents(); 00877 }
| void OpenTK.NativeWindow.ProcessEvents | ( | ) |
Processes operating system events until the NativeWindow becomes idle.
Implements OpenTK.INativeWindow.
Definition at line 177 of file NativeWindow.cs.
00178 { 00179 ProcessEvents(false); 00180 }
Rectangle OpenTK.NativeWindow.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.
Implements OpenTK.INativeWindow.
Definition at line 195 of file NativeWindow.cs.
Rectangle OpenTK.NativeWindow.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.
Implements OpenTK.INativeWindow.
Definition at line 217 of file NativeWindow.cs.
Size OpenTK.NativeWindow.ClientSize [get, set] |
Gets or sets a System.Drawing.Size structure that contains the internal size this window.
Implements OpenTK.INativeWindow.
Definition at line 238 of file NativeWindow.cs.
bool OpenTK.NativeWindow.Exists [get] |
Gets a value indicating whether a render window exists.
Implements OpenTK.INativeWindow.
Definition at line 259 of file NativeWindow.cs.
bool OpenTK.NativeWindow.Focused [get] |
Gets a System.Boolean that indicates whether this NativeWindow has input focus.
Implements OpenTK.INativeWindow.
Definition at line 274 of file NativeWindow.cs.
int OpenTK.NativeWindow.Height [get, set] |
Gets or sets the external height of this window.
Implements OpenTK.INativeWindow.
Definition at line 290 of file NativeWindow.cs.
Icon OpenTK.NativeWindow.Icon [get, set] |
Gets or sets the System.Drawing.Icon for this GameWindow.
Implements OpenTK.INativeWindow.
Definition at line 311 of file NativeWindow.cs.
IInputDriver OpenTK.NativeWindow.InputDriver [get] |
This property is deprecated.
Implements OpenTK.INativeWindow.
Definition at line 333 of file NativeWindow.cs.
bool OpenTK.NativeWindow.IsDisposed [get, set, protected] |
Gets or sets a System.Boolean, which indicates whether this instance has been disposed.
Definition at line 675 of file NativeWindow.cs.
Point OpenTK.NativeWindow.Location [get, set] |
Gets or sets a System.Drawing.Point structure that contains the location of this window on the desktop.
Implements OpenTK.INativeWindow.
Definition at line 349 of file NativeWindow.cs.
Size OpenTK.NativeWindow.Size [get, set] |
Gets or sets a System.Drawing.Size structure that contains the external size of this window.
Implements OpenTK.INativeWindow.
Definition at line 370 of file NativeWindow.cs.
string OpenTK.NativeWindow.Title [get, set] |
Gets or sets the NativeWindow title.
Implements OpenTK.INativeWindow.
Definition at line 391 of file NativeWindow.cs.
bool OpenTK.NativeWindow.Visible [get, set] |
Gets or sets a System.Boolean that indicates whether this NativeWindow is visible.
Implements OpenTK.INativeWindow.
Definition at line 412 of file NativeWindow.cs.
int OpenTK.NativeWindow.Width [get, set] |
Gets or sets the external width of this window.
Implements OpenTK.INativeWindow.
Definition at line 433 of file NativeWindow.cs.
WindowBorder OpenTK.NativeWindow.WindowBorder [get, set] |
Gets or states the border of the NativeWindow.
Implements OpenTK.INativeWindow.
Definition at line 454 of file NativeWindow.cs.
IWindowInfo OpenTK.NativeWindow.WindowInfo [get] |
Gets the OpenTK.Platform.IWindowInfo of this window.
Implements OpenTK.INativeWindow.
Definition at line 473 of file NativeWindow.cs.
virtual WindowState OpenTK.NativeWindow.WindowState [get, set] |
Gets or states the state of the NativeWindow.
Implements OpenTK.INativeWindow.
Reimplemented in OpenTK.GameWindow.
Definition at line 489 of file NativeWindow.cs.
int OpenTK.NativeWindow.X [get, set] |
Gets or sets the horizontal location of this window on the desktop.
Implements OpenTK.INativeWindow.
Definition at line 508 of file NativeWindow.cs.
int OpenTK.NativeWindow.Y [get, set] |
Gets or sets the vertical location of this window on the desktop.
Implements OpenTK.INativeWindow.
Definition at line 529 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.Closed |
Occurs after the window has closed.
Implements OpenTK.INativeWindow.
Definition at line 551 of file NativeWindow.cs.
| EventHandler<CancelEventArgs> OpenTK.NativeWindow.Closing |
Occurs when the window is about to close.
Implements OpenTK.INativeWindow.
Definition at line 556 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.Disposed |
Occurs when the window is disposed.
Implements OpenTK.INativeWindow.
Definition at line 561 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.FocusedChanged |
Occurs when the Focused property of the window changes.
Implements OpenTK.INativeWindow.
Definition at line 566 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.IconChanged |
Occurs when the Icon property of the window changes.
Implements OpenTK.INativeWindow.
Definition at line 571 of file NativeWindow.cs.
| EventHandler<KeyPressEventArgs> OpenTK.NativeWindow.KeyPress |
Occurs whenever a character is typed.
Implements OpenTK.INativeWindow.
Definition at line 576 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.MouseEnter |
Occurs whenever the mouse cursor enters the window Bounds.
Implements OpenTK.INativeWindow.
Definition at line 586 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.MouseLeave |
Occurs whenever the mouse cursor leaves the window Bounds.
Implements OpenTK.INativeWindow.
Definition at line 591 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.Move |
Occurs whenever the window is moved.
Implements OpenTK.INativeWindow.
Definition at line 581 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.Resize |
Occurs whenever the window is resized.
Implements OpenTK.INativeWindow.
Definition at line 596 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.TitleChanged |
Occurs when the Title property of the window changes.
Implements OpenTK.INativeWindow.
Definition at line 601 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.VisibleChanged |
Occurs when the Visible property of the window changes.
Implements OpenTK.INativeWindow.
Definition at line 606 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.WindowBorderChanged |
Occurs when the WindowBorder property of the window changes.
Implements OpenTK.INativeWindow.
Definition at line 611 of file NativeWindow.cs.
| EventHandler<EventArgs> OpenTK.NativeWindow.WindowStateChanged |
Occurs when the WindowState property of the window changes.
Implements OpenTK.INativeWindow.
Definition at line 616 of file NativeWindow.cs.
1.6.1