MacWindow Class Reference

#include <macWindow.h>

Inheritance diagram for MacWindow:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual ~MacWindow ()
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 WindowId getWindowId ()
 Get the ID that uniquely identifies this window in the context of its window manager.
void setDisplay (CGDirectDisplayID display)
CGDirectDisplayID getDisplay ()
CGRect getMainDisplayBounds ()
CGRect getDisplayBounds ()
virtual bool clearFullscreen ()
 If we're fullscreen, this function returns us to desktop mode.
virtual bool isFullscreen ()
virtual PlatformWindowgetNextWindow () const
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 bool setSize (const Point2I &newSize)
 Resize the window to have a new size (but be in the same position).
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 setCaption (const char *windowText)
 Set the window's caption.
virtual const char * getCaption ()
 Get the window's caption.
virtual bool setType (S32 windowType)
virtual void minimize ()
 Minimize the window on screen.
virtual void maximize ()
 Maximize the window on screen.
virtual void restore ()
 Restore the window from a Maximized or Minimized state.
virtual bool isMinimized ()
virtual void show ()
 Show the window on screen.
virtual void close ()
 Destroy the window on screen.
virtual void hide ()
 Hide the window on screen.
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 setFocus ()
virtual void clearFocus ()
virtual voidgetPlatformDrawable () const
 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.
bool _skipNextMouseEvent ()
void _skipAnotherMouseEvent ()
void _skippedMouseEvent ()
void _doMouseLockNow ()
 Does the work of actually locking or unlocking the mouse, based on the value of shouldLockMouse().
void _associateMouse ()
void _dissociateMouse ()
void _centerMouse ()

Protected Member Functions

virtual void _setFullscreen (bool fullScreen)

Private Member Functions

 MacWindow (U32 windowId, const char *windowText, Point2I clientExtent)
void _initCocoaWindow (const char *windowText, Point2I clientExtent)
void setWindowId (U32 newid)
void signalGainFocus ()

Private Attributes

NSWindow * mCocoaWindow
GFXDevicemDevice
GFXWindowTargetRef mTarget
GFXVideoMode mCurrentMode
MacWindowmNextWindow
bool mMouseLocked
bool mShouldMouseLock
const char * mTitle
bool mMouseCaptured
MacWindowManagermOwningWindowManager
U32 mSkipMouseEvents
bool mFullscreen
NSDictionary * mDefaultDisplayMode
CGDirectDisplayID mDisplay
CGRect mDisplayBounds
CGRect mMainDisplayBounds

Friends

class MacWindowManager
class MacCursorController

Constructor & Destructor Documentation

virtual MacWindow::~MacWindow (  )  [virtual]

MacWindow::MacWindow ( U32  windowId,
const char *  windowText,
Point2I  clientExtent 
) [private]


Member Function Documentation

virtual GFXDevice* MacWindow::getGFXDevice (  )  [inline, 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* MacWindow::getGFXTarget (  )  [inline, 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 MacWindow::setVideoMode ( const GFXVideoMode mode  )  [virtual]

Set the video mode for this window.

Implements PlatformWindow.

virtual const GFXVideoMode& MacWindow::getVideoMode (  )  [inline, virtual]

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

Implements PlatformWindow.

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

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

Reimplemented from PlatformWindow.

void MacWindow::setDisplay ( CGDirectDisplayID  display  ) 

CGDirectDisplayID MacWindow::getDisplay (  )  [inline]

CGRect MacWindow::getMainDisplayBounds (  )  [inline]

CGRect MacWindow::getDisplayBounds (  )  [inline]

virtual bool MacWindow::clearFullscreen (  )  [inline, 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 MacWindow::isFullscreen (  )  [inline, virtual]

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

Implements PlatformWindow.

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

Implements PlatformWindow.

virtual void MacWindow::setMouseLocked ( bool  enable  )  [inline, 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 MacWindow::isMouseLocked (  )  const [inline, virtual]

Is the mouse locked ?

Implements PlatformWindow.

virtual bool MacWindow::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 bool MacWindow::setSize ( const Point2I newSize  )  [virtual]

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

Implements PlatformWindow.

virtual void MacWindow::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 MacWindow::getClientExtent (  )  [virtual]

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

Implements PlatformWindow.

virtual void MacWindow::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 MacWindow::getBounds (  )  const [virtual]

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

Implements PlatformWindow.

virtual void MacWindow::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 MacWindow::getPosition (  )  [virtual]

Get the position of this window.

Implements PlatformWindow.

virtual void MacWindow::centerWindow (  )  [virtual]

Reimplemented from PlatformWindow.

virtual bool MacWindow::setCaption ( const char *  windowText  )  [virtual]

Set the window's caption.

Implements PlatformWindow.

virtual const char* MacWindow::getCaption (  )  [inline, virtual]

Get the window's caption.

Implements PlatformWindow.

virtual bool MacWindow::setType ( S32  windowType  )  [inline, virtual]

virtual void MacWindow::minimize (  )  [virtual]

Minimize the window on screen.

Implements PlatformWindow.

virtual void MacWindow::maximize (  )  [virtual]

Maximize the window on screen.

Implements PlatformWindow.

virtual void MacWindow::restore (  )  [virtual]

Restore the window from a Maximized or Minimized state.

Implements PlatformWindow.

virtual bool MacWindow::isMinimized (  )  [virtual]

virtual void MacWindow::show (  )  [virtual]

Show the window on screen.

Implements PlatformWindow.

virtual void MacWindow::close (  )  [virtual]

Destroy the window on screen.

Implements PlatformWindow.

virtual void MacWindow::hide (  )  [virtual]

Hide the window on screen.

Implements PlatformWindow.

virtual bool MacWindow::isOpen (  )  [virtual]

Returns true if the window is instantiated in the OS.

Implements PlatformWindow.

virtual bool MacWindow::isVisible (  )  [virtual]

Returns true if the window is visible.

Implements PlatformWindow.

virtual bool MacWindow::isFocused (  )  [virtual]

Returns true if the window has input focus.

Implements PlatformWindow.

virtual void MacWindow::setFocus (  )  [virtual]

virtual void MacWindow::clearFocus (  )  [virtual]

virtual void* MacWindow::getPlatformDrawable (  )  const [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.

Implements PlatformWindow.

bool MacWindow::_skipNextMouseEvent (  )  [inline]

void MacWindow::_skipAnotherMouseEvent (  )  [inline]

void MacWindow::_skippedMouseEvent (  )  [inline]

void MacWindow::_doMouseLockNow (  ) 

Does the work of actually locking or unlocking the mouse, based on the value of shouldLockMouse().

Disassociates the cursor movement from the mouse input and hides the mouse when locking. Re-associates cursor movement with mouse input and shows the mouse when unlocking.

Returns true if we locked or unlocked the mouse. Returns false if the mouse was already in the correct state.

void MacWindow::_associateMouse (  ) 

void MacWindow::_dissociateMouse (  ) 

void MacWindow::_centerMouse (  ) 

virtual void MacWindow::_setFullscreen ( bool  fullScreen  )  [protected, virtual]

Reimplemented from PlatformWindow.

void MacWindow::_initCocoaWindow ( const char *  windowText,
Point2I  clientExtent 
) [private]

void MacWindow::setWindowId ( U32  newid  )  [inline, private]

void MacWindow::signalGainFocus (  )  [private]


Friends And Related Function Documentation

friend class MacWindowManager [friend]

friend class MacCursorController [friend]


Member Data Documentation

NSWindow* MacWindow::mCocoaWindow [private]

const char* MacWindow::mTitle [private]

NSDictionary* MacWindow::mDefaultDisplayMode [private]

CGDirectDisplayID MacWindow::mDisplay [private]

CGRect MacWindow::mDisplayBounds [private]