Win32Window Class Reference

#include <win32Window.h>

Inheritance diagram for Win32Window:

Inheritance graph
[legend]
List of all members.

Detailed Description

Implementation of a window on Win32.


Public Types

typedef Vector< AcceleratorAcceleratorList

Public Member Functions

 Win32Window ()
 ~Win32Window ()
HWND & getHWND ()
 Return the HWND (win32 window handle) for this window.
HMENU & getMenuHandle ()
void setMenuHandle (HMENU menuHandle)
void addAccelerators (AcceleratorList &list)
 Add a list of accelerators to this window.
void removeAccelerators (AcceleratorList &list)
 Remove a list of accelerators from this window.
bool isAccelerator (const InputEventInfo &info)
 Returns true if info matches an accelerator.
bool translateMessage (MSG &msg)
 Allow windows to translate messages. Used for accelerators.
virtual GFXDevicegetGFXDevice ()
 Return a pointer to the GFX device this window is bound to.
virtual GFXWindowTargetgetGFXTarget ()
 Return a pointer to this window's render target.
virtual void setVideoMode (const GFXVideoMode &mode)
 Set the video mode for this window.
virtual const GFXVideoModegetVideoMode ()
 Get our current video mode - if the window has been resized, it will reflect this.
virtual bool clearFullscreen ()
 If we're fullscreen, this function returns us to desktop mode.
virtual bool isFullscreen ()
virtual void _setFullscreen (const bool fullscreen)
virtual bool setCaption (const char *cap)
 Set the window's caption.
virtual const char * getCaption ()
 Get the window's caption.
virtual void setClientExtent (const Point2I newExtent)
 Set the Client Area Extent (Resolution) of this window.
virtual const Point2I getClientExtent ()
 Get the Client Area Extent (Resolution) of this window.
virtual void setBounds (const RectI &newBounds)
 Resize the window to have some new bounds.
virtual const RectI getBounds () const
 Get the position and size (fullscreen windows are always at (0,0)).
virtual void setPosition (const Point2I newPosition)
 Set the position of this window.
virtual const Point2I getPosition ()
 Get the position of this window.
virtual void centerWindow ()
virtual bool setSize (const Point2I &newSize)
 Resize the window to have a new size (but be in the same position).
virtual bool isOpen ()
 Returns true if the window is instantiated in the OS.
virtual bool isVisible ()
 Returns true if the window is visible.
virtual bool isFocused ()
 Returns true if the window has input focus.
virtual void minimize ()
 Minimize the window on screen.
virtual void maximize ()
 Maximize the window on screen.
virtual void hide ()
 Hide the window on screen.
virtual void show ()
 Show the window on screen.
virtual void close ()
 Destroy the window on screen.
virtual void restore ()
 Restore the window from a Maximized or Minimized state.
virtual void setMouseLocked (bool enable)
 Lock the mouse to this window.
virtual bool isMouseLocked () const
 Is the mouse locked ?
virtual bool shouldLockMouse () const
 Should the mouse be locked at the next opportunity ?
virtual WindowId getWindowId ()
 Get the ID that uniquely identifies this window in the context of its window manager.
virtual PlatformWindowgetNextWindow () const
virtual void defaultRender ()
 Provide a simple GDI-based render for when the game is not rendering.
virtual voidgetPlatformDrawable () const
 Return the platform specific object needed to create or attach an accelerated graohics drawing context on or to the window.

Static Public Member Functions

static const UTF16getWindowClassName ()
 Return the class name for the windows we create with this class.
static const UTF16getCurtainWindowClassName ()
 Return the class name for the curtain window class.

Private Types

typedef Vector< ACCEL > WinAccelList

Private Member Functions

void _registerWindowClass ()
 Helper to allocate our Win32 window class.
void addAccelerator (Accelerator &accel)
 Add an accelerator to the list of accelerators for this window. Intended for use by addAccelerators().
void removeAccelerator (Accelerator &accel)
 Remove an accelerator from the list of accelerators for this window. Intended for use by removeAccelerators().

Static Private Member Functions

static LRESULT PASCAL WindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 Windows message handler callback.

Private Attributes

Active window list
Items used to track window instances.

Win32WindowManagermOwningManager
 Which manager created us?
Win32WindowmNextWindow
 Which window comes next in list?
Window Information
HWND mWindowHandle
 Our HWND - Win32 window handle.
DWORD mWindowedWindowStyle
 The Win32 window style we want to use when windowed.
GFXDevicemDevice
 The GFX device that we're tied to.
GFXWindowTargetRef mTarget
 Reference to the render target allocated on this window.
GFXVideoMode mVideoMode
 Our current size/resolution/fullscreen status.
Point2I mPosition
 Our position on the desktop.
HACCEL mAccelHandle
 Windows HACCEL for accelerators.
WinAccelList mWinAccelList
 Keyboard accelerators for menus.
bool mMouseLocked
 Is the mouse locked to this window?
Point2I mMouseLockPosition
 The position the cursor was at when a mouse lock occured.
bool mShouldLockMouse
 Determines whether this window should lock the mouse when it has an opportunity.
bool mSuppressReset
 When set, we don't trigger device resets due to sizing events.
HMENU mMenuHandle
 Menu associated with this window. This is a passive property of the window and is not required to be used at all.
bool mFullscreen
 Do we have a fullscreen window style set?

Friends

class Win32WindowManager
class GFXPCD3D9Device
class GFXPCD3D9WindowTarget
class GFXD3D8WindowTarget

Classes

struct  Accelerator


Member Typedef Documentation

typedef Vector<ACCEL> Win32Window::WinAccelList [private]


Constructor & Destructor Documentation

Win32Window::Win32Window (  ) 

Win32Window::~Win32Window (  ) 


Member Function Documentation

void Win32Window::_registerWindowClass (  )  [private]

Helper to allocate our Win32 window class.

static LRESULT PASCAL Win32Window::WindowProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
) [static, private]

Windows message handler callback.

void Win32Window::addAccelerator ( Accelerator accel  )  [private]

Add an accelerator to the list of accelerators for this window. Intended for use by addAccelerators().

void Win32Window::removeAccelerator ( Accelerator accel  )  [private]

Remove an accelerator from the list of accelerators for this window. Intended for use by removeAccelerators().

HWND& Win32Window::getHWND (  )  [inline]

Return the HWND (win32 window handle) for this window.

HMENU& Win32Window::getMenuHandle (  )  [inline]

void Win32Window::setMenuHandle ( HMENU  menuHandle  )  [inline]

void Win32Window::addAccelerators ( AcceleratorList list  ) 

Add a list of accelerators to this window.

void Win32Window::removeAccelerators ( AcceleratorList list  ) 

Remove a list of accelerators from this window.

bool Win32Window::isAccelerator ( const InputEventInfo info  ) 

Returns true if info matches an accelerator.

bool Win32Window::translateMessage ( MSG &  msg  ) 

Allow windows to translate messages. Used for accelerators.

virtual GFXDevice* Win32Window::getGFXDevice (  )  [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.

Implements PlatformWindow.

virtual GFXWindowTarget* Win32Window::getGFXTarget (  )  [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.

Implements PlatformWindow.

virtual void Win32Window::setVideoMode ( const GFXVideoMode mode  )  [virtual]

Set the video mode for this window.

Implements PlatformWindow.

virtual const GFXVideoMode& Win32Window::getVideoMode (  )  [virtual]

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

Implements PlatformWindow.

virtual bool Win32Window::clearFullscreen (  )  [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.

Implements PlatformWindow.

virtual bool Win32Window::isFullscreen (  )  [virtual]

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

Implements PlatformWindow.

virtual void Win32Window::_setFullscreen ( const bool  fullscreen  )  [virtual]

Reimplemented from PlatformWindow.

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

Set the window's caption.

Implements PlatformWindow.

virtual const char* Win32Window::getCaption (  )  [virtual]

Get the window's caption.

Implements PlatformWindow.

virtual void Win32Window::setClientExtent ( const Point2I  newExtent  )  [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.

Implements PlatformWindow.

virtual const Point2I Win32Window::getClientExtent (  )  [virtual]

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

Implements PlatformWindow.

virtual void Win32Window::setBounds ( const RectI newBounds  )  [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.

Implements PlatformWindow.

virtual const RectI Win32Window::getBounds (  )  const [virtual]

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

Implements PlatformWindow.

virtual void Win32Window::setPosition ( const Point2I  newPosition  )  [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.

Implements PlatformWindow.

virtual const Point2I Win32Window::getPosition (  )  [virtual]

Get the position of this window.

Implements PlatformWindow.

virtual void Win32Window::centerWindow (  )  [virtual]

Reimplemented from PlatformWindow.

virtual bool Win32Window::setSize ( const Point2I newSize  )  [virtual]

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

Implements PlatformWindow.

virtual bool Win32Window::isOpen (  )  [virtual]

Returns true if the window is instantiated in the OS.

Implements PlatformWindow.

virtual bool Win32Window::isVisible (  )  [virtual]

Returns true if the window is visible.

Implements PlatformWindow.

virtual bool Win32Window::isFocused (  )  [virtual]

Returns true if the window has input focus.

Implements PlatformWindow.

virtual void Win32Window::minimize (  )  [virtual]

Minimize the window on screen.

Implements PlatformWindow.

virtual void Win32Window::maximize (  )  [virtual]

Maximize the window on screen.

Implements PlatformWindow.

virtual void Win32Window::hide (  )  [virtual]

Hide the window on screen.

Implements PlatformWindow.

virtual void Win32Window::show (  )  [virtual]

Show the window on screen.

Implements PlatformWindow.

virtual void Win32Window::close (  )  [virtual]

Destroy the window on screen.

Implements PlatformWindow.

virtual void Win32Window::restore (  )  [virtual]

Restore the window from a Maximized or Minimized state.

Implements PlatformWindow.

virtual void Win32Window::setMouseLocked ( bool  enable  )  [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.

Implements PlatformWindow.

virtual bool Win32Window::isMouseLocked (  )  const [inline, virtual]

Is the mouse locked ?

Implements PlatformWindow.

virtual bool Win32Window::shouldLockMouse (  )  const [inline, 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.

Implements PlatformWindow.

virtual WindowId Win32Window::getWindowId (  )  [virtual]

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

Reimplemented from PlatformWindow.

virtual PlatformWindow* Win32Window::getNextWindow (  )  const [inline, virtual]

Implements PlatformWindow.

virtual void Win32Window::defaultRender (  )  [virtual]

Provide a simple GDI-based render for when the game is not rendering.

static const UTF16* Win32Window::getWindowClassName (  )  [static]

Return the class name for the windows we create with this class.

static const UTF16* Win32Window::getCurtainWindowClassName (  )  [static]

Return the class name for the curtain window class.

virtual void* Win32Window::getPlatformDrawable (  )  const [inline, virtual]

Return the platform specific object needed to create or attach an accelerated graohics drawing context on or to the window.

Implements PlatformWindow.


Friends And Related Function Documentation

friend class Win32WindowManager [friend]

friend class GFXPCD3D9Device [friend]

friend class GFXPCD3D9WindowTarget [friend]

friend class GFXD3D8WindowTarget [friend]


Member Data Documentation

Which manager created us?

Which window comes next in list?

Our HWND - Win32 window handle.

The Win32 window style we want to use when windowed.

The GFX device that we're tied to.

Reference to the render target allocated on this window.

Our current size/resolution/fullscreen status.

Our position on the desktop.

HACCEL Win32Window::mAccelHandle [private]

Windows HACCEL for accelerators.

Keyboard accelerators for menus.

Is the mouse locked to this window?

The position the cursor was at when a mouse lock occured.

Determines whether this window should lock the mouse when it has an opportunity.

When set, we don't trigger device resets due to sizing events.

Reimplemented from PlatformWindow.

HMENU Win32Window::mMenuHandle [private]

Menu associated with this window. This is a passive property of the window and is not required to be used at all.

Do we have a fullscreen window style set?