PlatformWindow Class Reference

#include <platformWindow.h>

Inheritance diagram for PlatformWindow:

Inheritance graph
[legend]
List of all members.

Detailed Description

Abstract representation of a native OS window.

Every windowing system has its own representations and conventions as regards the windows on-screen. In order to provide Torque with means for interfacing with multiple windows, tracking their state, etc. we provide this interface.

This interface also allows the app to access the render target for the window it represents, as well as control mode switches, get mode info, and so on.

See also:
PlatformWindowManager


Public Member Functions

virtual ~PlatformWindow ()
 To get rid of a window, just delete it.
virtual void setInputController (IProcessInput *controller)
 Get the WindowController associated with this window.
virtual WindowId getWindowId ()
 Get the ID that uniquely identifies this window in the context of its window manager.
void setSuppressReset (bool suppress)
 Set the flag that determines whether to suppress a GFXDevice reset.
virtual PlatformWindowgetNextWindow () const =0
virtual voidgetPlatformDrawable () const =0
 Get the platform specific object needed to create or attach an accelerated graohics drawing context on or to the window Win32 D3D and OpenGL typically needs an HWND Mac Cocoa OpenGL typically needs an NSOpenGLView Mac Carbon OpenGL typically needs a WindowRef.
GFX State Management
virtual GFXDevicegetGFXDevice ()=0
 Return a pointer to the GFX device this window is bound to.
virtual GFXWindowTargetgetGFXTarget ()=0
 Return a pointer to this window's render target.
virtual void setVideoMode (const GFXVideoMode &mode)=0
 Set the video mode for this window.
virtual const GFXVideoModegetVideoMode ()=0
 Get our current video mode - if the window has been resized, it will reflect this.
virtual bool clearFullscreen ()=0
 If we're fullscreen, this function returns us to desktop mode.
virtual bool isFullscreen ()=0
void setFullscreen (const bool fullscreen)
 Acquire the entire screen.
virtual void setBackground (bool val)
 Set Idle State (Background).
virtual bool getBackground ()
 Get Idle State (Background).
Caption
virtual bool setCaption (const char *cap)=0
 Set the window's caption.
virtual const char * getCaption ()=0
 Get the window's caption.
Visibility
Control how the window is displayed

virtual void minimize ()=0
 Minimize the window on screen.
virtual void maximize ()=0
 Maximize the window on screen.
virtual void hide ()=0
 Hide the window on screen.
virtual void show ()=0
 Show the window on screen.
virtual void close ()=0
 Destroy the window on screen.
virtual void restore ()=0
 Restore the window from a Maximized or Minimized state.
Window Bounds
virtual void setClientExtent (const Point2I newExtent)=0
 Set the Client Area Extent (Resolution) of this window.
virtual const Point2I getClientExtent ()=0
 Get the Client Area Extent (Resolution) of this window.
virtual void setBounds (const RectI &newBounds)=0
 Resize the window to have some new bounds.
virtual const RectI getBounds () const =0
 Get the position and size (fullscreen windows are always at (0,0)).
virtual void setPosition (const Point2I newPosition)=0
 Set the position of this window.
virtual const Point2I getPosition ()=0
 Get the position of this window.
virtual void centerWindow ()
virtual bool setSize (const Point2I &newSize)=0
 Resize the window to have a new size (but be in the same position).
Windowed state
This is only really meaningful if the window is not fullscreen.

virtual bool isOpen ()=0
 Returns true if the window is instantiated in the OS.
virtual bool isVisible ()=0
 Returns true if the window is visible.
virtual bool isFocused ()=0
 Returns true if the window has input focus.
virtual void setKeyboardTranslation (const bool enabled)
 Set if we want to process key events into appropriate character events as well.
virtual bool getKeyboardTranslation () const
 Returns true if keyboard translation is enabled.
virtual void setAcceleratorsEnabled (const bool enabled)
 Used to disable native OS keyboard accelerators.
virtual bool getAcceleratorsEnabled () const
 Returns true if native OS keyboard accelerators are enabled.
virtual void setMinimumWindowSize (Point2I minSize)
 Sets a minimum window size.
virtual Point2I getMinimumWindowSize ()
 Returns the current minimum window size for this window.
Window Cursor
Accessors to control a windows cursor shape and visibility

Get the CursorController that this window owns.

virtual PlatformCursorControllergetCursorController ()
virtual void setCursorPosition (S32 x, S32 y)
 Set the cursor position based on logical coordinates from the upper-right corner.
virtual void getCursorPosition (Point2I &point)
 Get the cursor position based on logical coordinates from the upper-right corner.
virtual void setCursorVisible (bool visible)
 Set the cursor visibility on this window.
virtual bool isCursorVisible ()
 Get the cursor visibility on this window.
virtual void setMouseLocked (bool enable)=0
 Lock the mouse to this window.
virtual bool isMouseLocked () const =0
 Is the mouse locked ?
virtual bool shouldLockMouse () const =0
 Should the mouse be locked at the next opportunity ?

Public Attributes

Event Handlers
Various events that this window receives. These are all subclasses of JournaledSignal, so you can subscribe to them and receive notifications per the documentation for that class.

AppEvent appEvent
MouseEvent mouseEvent
MouseWheelEvent wheelEvent
ButtonEvent buttonEvent
LinearEvent linearEvent
KeyEvent keyEvent
CharEvent charEvent
DisplayEvent displayEvent
ResizeEvent resizeEvent
IdleEvent idleEvent

Protected Member Functions

 PlatformWindow ()
 Protected constructor so that the win.
virtual void _setFullscreen (const bool fullScreen)

Protected Attributes

bool mEnableKeyboardTranslation
 Are we enabling IME or other keyboard input translation services, or concerned about raw input?
bool mEnableAccelerators
 When Torque GuiText input controls have focus they need to disable native OS keyboard accelerator translation.
Point2I mMinimumSize
 Minimum allowed size for this window.
bool mIsBackground
 Is Idle?
PlatformCursorControllermCursorController
 Cursor Controller for this Window.
WindowId mWindowId
 An opaque ID used to resolve references to this Window.
WindowInputGeneratormWindowInputGenerator
 Window Mouse/Key input Controller for this Window.
bool mSuppressReset
 Suppress device resets.

Friends

class PlatformWindowManager


Constructor & Destructor Documentation

PlatformWindow::PlatformWindow (  )  [inline, protected]

Protected constructor so that the win.

virtual PlatformWindow::~PlatformWindow (  )  [inline, virtual]

To get rid of a window, just delete it.

Make sure the GFXDevice is done with it first!


Member Function Documentation

virtual void PlatformWindow::setInputController ( IProcessInput controller  )  [inline, virtual]

Get the WindowController associated with this window.

virtual WindowId PlatformWindow::getWindowId (  )  [inline, virtual]

Get the ID that uniquely identifies this window in the context of its window manager.

Reimplemented in MacWindow, and Win32Window.

void PlatformWindow::setSuppressReset ( bool  suppress  )  [inline]

Set the flag that determines whether to suppress a GFXDevice reset.

virtual GFXDevice* PlatformWindow::getGFXDevice (  )  [pure virtual]

Return a pointer to the GFX device this window is bound to.

A GFX device may use many windows, but a window can only be used by a single GFX device.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual GFXWindowTarget* PlatformWindow::getGFXTarget (  )  [pure virtual]

Return a pointer to this window's render target.

By setting window targets from different windows, we can effect rendering to multiple windows from a single device.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual void PlatformWindow::setVideoMode ( const GFXVideoMode mode  )  [pure virtual]

Set the video mode for this window.

Implemented in MacWindow, and Win32Window.

virtual const GFXVideoMode& PlatformWindow::getVideoMode (  )  [pure virtual]

Get our current video mode - if the window has been resized, it will reflect this.

Implemented in MacWindow, and Win32Window.

virtual bool PlatformWindow::clearFullscreen (  )  [pure virtual]

If we're fullscreen, this function returns us to desktop mode.

This will be either the last mode that we had that was not fullscreen, or the equivalent mode, windowed.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual bool PlatformWindow::isFullscreen (  )  [pure virtual]

Returns:
true if this window is fullscreen, false otherwise.

Implemented in MacWindow, and Win32Window.

void PlatformWindow::setFullscreen ( const bool  fullscreen  ) 

Acquire the entire screen.

virtual void PlatformWindow::setBackground ( bool  val  )  [inline, virtual]

Set Idle State (Background).

This is called to put a window into idle state, which causes it's rendering priority to be toned down to prefer performance

virtual bool PlatformWindow::getBackground (  )  [inline, virtual]

Get Idle State (Background).

This is called to poll the window as to it's idle state.

virtual bool PlatformWindow::setCaption ( const char *  cap  )  [pure virtual]

Set the window's caption.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual const char* PlatformWindow::getCaption (  )  [pure virtual]

Get the window's caption.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual void PlatformWindow::minimize (  )  [pure virtual]

Minimize the window on screen.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual void PlatformWindow::maximize (  )  [pure virtual]

Maximize the window on screen.

Implemented in MacWindow, and Win32Window.

virtual void PlatformWindow::hide (  )  [pure virtual]

Hide the window on screen.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual void PlatformWindow::show (  )  [pure virtual]

Show the window on screen.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual void PlatformWindow::close (  )  [pure virtual]

Destroy the window on screen.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual void PlatformWindow::restore (  )  [pure virtual]

Restore the window from a Maximized or Minimized state.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual void PlatformWindow::setClientExtent ( const Point2I  newExtent  )  [pure virtual]

Set the Client Area Extent (Resolution) of this window.

This does not include the area occupied by a title-bar, menu, borders or other non-client elements.

Implemented in MacWindow, and Win32Window.

virtual const Point2I PlatformWindow::getClientExtent (  )  [pure virtual]

Get the Client Area Extent (Resolution) of this window.

Implemented in MacWindow, and Win32Window.

virtual void PlatformWindow::setBounds ( const RectI newBounds  )  [pure virtual]

Resize the window to have some new bounds.

This includes the area needed for a title-bar, menu, borders, and other non-client elements.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual const RectI PlatformWindow::getBounds (  )  const [pure virtual]

Get the position and size (fullscreen windows are always at (0,0)).

Implemented in MacWindow, and Win32Window.

virtual void PlatformWindow::setPosition ( const Point2I  newPosition  )  [pure virtual]

Set the position of this window.

This means that saying setPosition at 0,0 will put the position of the window title-bar (if one exists) at 0,0 and the Client area will be offset from that point by the space needed for the Non-Client area.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual const Point2I PlatformWindow::getPosition (  )  [pure virtual]

Get the position of this window.

Implemented in MacWindow, and Win32Window.

virtual void PlatformWindow::centerWindow (  )  [inline, virtual]

Reimplemented in MacWindow, and Win32Window.

virtual bool PlatformWindow::setSize ( const Point2I newSize  )  [pure virtual]

Resize the window to have a new size (but be in the same position).

Implemented in XB360Window, MacWindow, and Win32Window.

virtual bool PlatformWindow::isOpen (  )  [pure virtual]

Returns true if the window is instantiated in the OS.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual bool PlatformWindow::isVisible (  )  [pure virtual]

Returns true if the window is visible.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual bool PlatformWindow::isFocused (  )  [pure virtual]

Returns true if the window has input focus.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual void PlatformWindow::setKeyboardTranslation ( const bool  enabled  )  [inline, virtual]

Set if we want to process key events into appropriate character events as well.

virtual bool PlatformWindow::getKeyboardTranslation (  )  const [inline, virtual]

Returns true if keyboard translation is enabled.

virtual void PlatformWindow::setAcceleratorsEnabled ( const bool  enabled  )  [inline, virtual]

Used to disable native OS keyboard accelerators.

virtual bool PlatformWindow::getAcceleratorsEnabled (  )  const [inline, virtual]

Returns true if native OS keyboard accelerators are enabled.

virtual void PlatformWindow::setMinimumWindowSize ( Point2I  minSize  )  [inline, virtual]

Sets a minimum window size.

We'll work with the OS to prevent user from sizing the window to less than this. Setting to (0,0) means user has complete freedom of resize.

virtual Point2I PlatformWindow::getMinimumWindowSize (  )  [inline, virtual]

Returns the current minimum window size for this window.

virtual PlatformCursorController* PlatformWindow::getCursorController (  )  [inline, virtual]

virtual void PlatformWindow::setCursorPosition ( S32  x,
S32  y 
) [inline, virtual]

Set the cursor position based on logical coordinates from the upper-right corner.

Parameters:
x The X position of the cursor
y The Y position of the cursor

virtual void PlatformWindow::getCursorPosition ( Point2I point  )  [inline, virtual]

Get the cursor position based on logical coordinates from the upper-right corner.

Parameters:
point A reference to a Point2I to store the coordinates

virtual void PlatformWindow::setCursorVisible ( bool  visible  )  [inline, virtual]

Set the cursor visibility on this window.

Parameters:
visible Whether the cursor should be visible or not

virtual bool PlatformWindow::isCursorVisible (  )  [inline, virtual]

Get the cursor visibility on this window.

Returns:
true if the cursor is visible or false if it's hidden

virtual void PlatformWindow::setMouseLocked ( bool  enable  )  [pure virtual]

Lock the mouse to this window.

When this is set, the mouse will always be returned to the center of the client area after every mouse event. The mouse will also be hidden while it is locked.

The mouse cannot be moved out of the bounds of the window, but the window may lose focus (for instance by an alt-tab or other event). While the window lacks focus, no mouse events will be reported.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual bool PlatformWindow::isMouseLocked (  )  const [pure virtual]

Is the mouse locked ?

Implemented in XB360Window, MacWindow, and Win32Window.

virtual bool PlatformWindow::shouldLockMouse (  )  const [pure virtual]

Should the mouse be locked at the next opportunity ?

This flag is set to the current state of the mouse lock on a window, to specify the preferred lock status of the mouse in a platform window.

This is important for situations where a call is made to setMouseLocked, and the window is not in a state that it can be cleanly locked. Take for example if it was called while the window is in the background, then it is not appropriate to lock the window, but rather the window should query this state at it's next opportunity and lock the mouse if requested.

Implemented in XB360Window, MacWindow, and Win32Window.

virtual PlatformWindow* PlatformWindow::getNextWindow (  )  const [pure virtual]

Implemented in XB360Window, MacWindow, and Win32Window.

virtual void* PlatformWindow::getPlatformDrawable (  )  const [pure virtual]

Get the platform specific object needed to create or attach an accelerated graohics drawing context on or to the window Win32 D3D and OpenGL typically needs an HWND Mac Cocoa OpenGL typically needs an NSOpenGLView Mac Carbon OpenGL typically needs a WindowRef.

Implemented in MacWindow, and Win32Window.

virtual void PlatformWindow::_setFullscreen ( const bool  fullScreen  )  [inline, protected, virtual]

Reimplemented in MacWindow, and Win32Window.


Friends And Related Function Documentation

friend class PlatformWindowManager [friend]


Member Data Documentation

Are we enabling IME or other keyboard input translation services, or concerned about raw input?

When Torque GuiText input controls have focus they need to disable native OS keyboard accelerator translation.

Minimum allowed size for this window.

When possible, we will communicate this to the OS.

Is Idle?

Cursor Controller for this Window.

An opaque ID used to resolve references to this Window.

Window Mouse/Key input Controller for this Window.

Suppress device resets.

Reimplemented in Win32Window.