Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
cinder::app::Window Class Reference

#include <Window.h>

Inheritance diagram for cinder::app::Window:
[legend]

Classes

struct  Format
 

Public Member Functions

bool isFullScreen () const
 Returns whether the Window is full-screen or not. More...
 
void setFullScreen (bool fullScreen=true, const FullScreenOptions &options=FullScreenOptions())
 Sets the Window to be full-screen or not. More...
 
int32_t getWidth () const
 Returns the width of the Window in points. More...
 
int32_t getHeight () const
 Returns the height of the Window in points. More...
 
float getAspectRatio () const
 Returns the Window aspect ratio, which is its width / height. More...
 
Area getBounds () const
 Returns the bounding Area of the Window in points: [0,0]-(width,height) More...
 
virtual Vec2i getSize () const
 Gets the size of the Window measured in points. More...
 
void setSize (int32_t width, int32_t height)
 Sets the size of the Window to ( width, height ) measured in points. More...
 
void setSize (const Vec2i &size)
 Sets the size of the Window to size measured in points. More...
 
Vec2i getPos () const
 Gets the position of the Window's upper-left corner measured in points, relative to the primary display's upper-left corner. More...
 
void setPos (int32_t x, int32_t y) const
 Sets the position of the Window's upper-left corner relative to the primary display's upper-left corner to (x, y) measured in points. More...
 
void setPos (const Vec2i &pos) const
 Sets the position of the Window's upper-left corner relative to the primary display's upper-left to pos measured in points. More...
 
Vec2f getCenter () const
 Returns the center of the Window in its own coordinate system measured in points. More...
 
void spanAllDisplays ()
 Sets the position and size of the Window so that it spans all connected displays. More...
 
float getContentScale () const
 Returns the multiplier (typically 2 on high-density (Retina) displays, 1 otherwise) mapping points to pixels. More...
 
float toPixels (float s) const
 Returns a scalar mapped from points to pixels by multiplying by getContentScale() More...
 
Vec2f toPixels (Vec2f s) const
 Returns a Vec2f mapped from points to pixels by multiplying by getContentScale() More...
 
Vec2i toPixels (Vec2i s) const
 Returns a Vec2i mapped from points to pixels by multiplying by getContentScale() More...
 
Area toPixels (const Area &a) const
 Returns an Area mapped from points to pixels by multiplying by getContentScale() More...
 
Rectf toPixels (const Rectf &a) const
 Returns a Rectf mapped from points to pixels by multiplying by getContentScale() More...
 
float toPoints (float s) const
 Returns a scalar mapped from pixels to points by dividing by getContentScale() More...
 
Vec2f toPoints (Vec2f s) const
 Returns a Vec2f mapped from pixels to points by dividing by getContentScale() More...
 
Vec2i toPoints (Vec2i s) const
 Returns a Vec2i mapped from pixels to points by dividing by getContentScale() More...
 
Area toPoints (const Area &a) const
 Returns an Area mapped from pixels to points by dividing by getContentScale() More...
 
Rectf toPoints (const Rectf &a) const
 Returns a Rectf mapped from pixels to points by dividing by getContentScale() More...
 
std::string getTitle () const
 Returns the Window's title as a UTF-8 string. More...
 
void setTitle (const std::string &title)
 Sets the Window's title as a UTF-8 string. More...
 
bool isBorderless () const
 Returns whether the window has a border (chrome/frame) More...
 
void setBorderless (bool borderless=true)
 Sets whether the window has a border (chrome/frame) More...
 
bool isAlwaysOnTop () const
 Returns whether the window always remains above all other windows. More...
 
void setAlwaysOnTop (bool alwaysOnTop=true)
 Sets whether the window always remains above all other windows. More...
 
void hide ()
 Hides the window but does not destroy it. More...
 
void show ()
 Shows a window that was hidden with hide() More...
 
bool isHidden () const
 Returns whether the window has been hidden with hide() More...
 
void close ()
 Closes and destroys the Window. More...
 
DisplayRef getDisplay () const
 Returns the Display on which the Window resides. More...
 
RendererRef getRenderer () const
 Returns the Renderer associated with the Window. More...
 
voidgetNative () const
 Returns the associated NSView on Mac OS X, UIView on iOS, or HWND on MSW. More...
 
EventSignalMousegetSignalMouseDown ()
 
void emitMouseDown (MouseEvent *event)
 
template<typename T , typename Y >
signals::connection connectMouseDown (T fn, Y *inst)
 
EventSignalMousegetSignalMouseDrag ()
 
void emitMouseDrag (MouseEvent *event)
 
template<typename T , typename Y >
signals::connection connectMouseDrag (T fn, Y *inst)
 
EventSignalMousegetSignalMouseUp ()
 
void emitMouseUp (MouseEvent *event)
 
template<typename T , typename Y >
signals::connection connectMouseUp (T fn, Y *inst)
 
EventSignalMousegetSignalMouseMove ()
 
void emitMouseMove (MouseEvent *event)
 
template<typename T , typename Y >
signals::connection connectMouseMove (T fn, Y *inst)
 
EventSignalMousegetSignalMouseWheel ()
 
void emitMouseWheel (MouseEvent *event)
 
template<typename T , typename Y >
signals::connection connectMouseWheel (T fn, Y *inst)
 
EventSignalTouchgetSignalTouchesBegan ()
 
void emitTouchesBegan (TouchEvent *event)
 
template<typename T , typename Y >
signals::connection connectTouchesBegan (T fn, Y *inst)
 
EventSignalTouchgetSignalTouchesMoved ()
 
void emitTouchesMoved (TouchEvent *event)
 
template<typename T , typename Y >
signals::connection connectTouchesMoved (T fn, Y *inst)
 
EventSignalTouchgetSignalTouchesEnded ()
 
void emitTouchesEnded (TouchEvent *event)
 
template<typename T , typename Y >
signals::connection connectTouchesEnded (T fn, Y *inst)
 
const std::vector
< TouchEvent::Touch > & 
getActiveTouches () const
 Returns a std::vector of all active touches. More...
 
EventSignalKeygetSignalKeyDown ()
 
void emitKeyDown (KeyEvent *event)
 
template<typename T , typename Y >
signals::connection connectKeyDown (T fn, Y *inst)
 
EventSignalKeygetSignalKeyUp ()
 
void emitKeyUp (KeyEvent *event)
 
template<typename T , typename Y >
signals::connection connectKeyUp (T fn, Y *inst)
 
EventSignalWindow & getSignalDraw ()
 
void emitDraw ()
 Fires the 'draw' signal. Note in general this should not be called directly as it doesn't perform all necessary setup. More...
 
template<typename T , typename Y >
signals::connection connectDraw (T fn, Y *inst)
 
EventSignalWindow & getSignalPostDraw ()
 Returns the signal which is emitted after the draw signal and app's draw() virtual method. More...
 
template<typename T , typename Y >
signals::connection connectPostDraw (T fn, Y *inst)
 
EventSignalWindow & getSignalMove ()
 
void emitMove ()
 
template<typename T , typename Y >
signals::connection connectMove (T fn, Y *inst)
 
EventSignalWindow & getSignalResize ()
 
void emitResize ()
 
template<typename T , typename Y >
signals::connection connectResize (T fn, Y *inst)
 
EventSignalWindow & getSignalDisplayChange ()
 
void emitDisplayChange ()
 
template<typename T , typename Y >
signals::connection connectDisplayChange (T fn, Y *inst)
 
EventSignalWindow & getSignalClose ()
 Returns the Signal emitted whenever a Window is closing. The WindowRef parameter is still valid at this point but its renderer is not. More...
 
void emitClose ()
 Fires the 'close' signal. More...
 
template<typename T , typename Y >
signals::connection connectClose (T fn, Y *inst)
 
EventSignalFileDropgetSignalFileDrop ()
 
void emitFileDrop (FileDropEvent *event)
 
template<typename T , typename Y >
signals::connection connectFileDrop (T fn, Y *inst)
 
template<typename T >
T * getUserData ()
 Returns the window-specific data associated with this Window. More...
 
template<typename T >
void setUserData (T *userData)
 Sets the window-specific data associated with this Window. The variable is deleted upon destruction of the Window. More...
 
bool isValid () const
 Returns whether this Window is valid. false means it should no longer be used (neither read nor write) More...
 
void setInvalid ()
 
AppgetApp () const
 

Protected Member Functions

 Window ()
 
void testValid () const
 
void setApp (App *app)
 

Protected Attributes

AppmApp
 
bool mValid
 
std::shared_ptr< voidmUserData
 
EventSignalMouse mSignalMouseDown
 
EventSignalMouse mSignalMouseDrag
 
EventSignalMouse mSignalMouseUp
 
EventSignalMouse mSignalMouseWheel
 
EventSignalMouse mSignalMouseMove
 
EventSignalTouch mSignalTouchesBegan
 
EventSignalTouch mSignalTouchesMoved
 
EventSignalTouch mSignalTouchesEnded
 
EventSignalKey mSignalKeyDown
 
EventSignalKey mSignalKeyUp
 
EventSignalWindow mSignalDraw
 
EventSignalWindow mSignalPostDraw
 
EventSignalWindow mSignalMove
 
EventSignalWindow mSignalResize
 
EventSignalWindow mSignalDisplayChange
 
EventSignalWindow mSignalClose
 
EventSignalFileDrop mSignalFileDrop
 

Constructor & Destructor Documentation

cinder::app::Window::Window ( )
protected

Member Function Documentation

bool cinder::app::Window::isFullScreen ( ) const

Returns whether the Window is full-screen or not.

void cinder::app::Window::setFullScreen ( bool  fullScreen = true,
const FullScreenOptions options = FullScreenOptions() 
)

Sets the Window to be full-screen or not.

int32_t cinder::app::Window::getWidth ( ) const

Returns the width of the Window in points.

int32_t cinder::app::Window::getHeight ( ) const

Returns the height of the Window in points.

float cinder::app::Window::getAspectRatio ( ) const

Returns the Window aspect ratio, which is its width / height.

Area cinder::app::Window::getBounds ( ) const

Returns the bounding Area of the Window in points: [0,0]-(width,height)

Vec2i cinder::app::Window::getSize ( ) const
virtual

Gets the size of the Window measured in points.

void cinder::app::Window::setSize ( int32_t  width,
int32_t  height 
)

Sets the size of the Window to ( width, height ) measured in points.

void cinder::app::Window::setSize ( const Vec2i size)

Sets the size of the Window to size measured in points.

Vec2i cinder::app::Window::getPos ( ) const

Gets the position of the Window's upper-left corner measured in points, relative to the primary display's upper-left corner.

void cinder::app::Window::setPos ( int32_t  x,
int32_t  y 
) const

Sets the position of the Window's upper-left corner relative to the primary display's upper-left corner to (x, y) measured in points.

void cinder::app::Window::setPos ( const Vec2i pos) const

Sets the position of the Window's upper-left corner relative to the primary display's upper-left to pos measured in points.

Vec2f cinder::app::Window::getCenter ( ) const

Returns the center of the Window in its own coordinate system measured in points.

void cinder::app::Window::spanAllDisplays ( )

Sets the position and size of the Window so that it spans all connected displays.

float cinder::app::Window::getContentScale ( ) const

Returns the multiplier (typically 2 on high-density (Retina) displays, 1 otherwise) mapping points to pixels.

float cinder::app::Window::toPixels ( float  s) const

Returns a scalar mapped from points to pixels by multiplying by getContentScale()

Vec2f cinder::app::Window::toPixels ( Vec2f  s) const

Returns a Vec2f mapped from points to pixels by multiplying by getContentScale()

Vec2i cinder::app::Window::toPixels ( Vec2i  s) const

Returns a Vec2i mapped from points to pixels by multiplying by getContentScale()

Area cinder::app::Window::toPixels ( const Area a) const

Returns an Area mapped from points to pixels by multiplying by getContentScale()

Rectf cinder::app::Window::toPixels ( const Rectf a) const

Returns a Rectf mapped from points to pixels by multiplying by getContentScale()

float cinder::app::Window::toPoints ( float  s) const

Returns a scalar mapped from pixels to points by dividing by getContentScale()

Vec2f cinder::app::Window::toPoints ( Vec2f  s) const

Returns a Vec2f mapped from pixels to points by dividing by getContentScale()

Vec2i cinder::app::Window::toPoints ( Vec2i  s) const

Returns a Vec2i mapped from pixels to points by dividing by getContentScale()

Area cinder::app::Window::toPoints ( const Area a) const

Returns an Area mapped from pixels to points by dividing by getContentScale()

Rectf cinder::app::Window::toPoints ( const Rectf a) const

Returns a Rectf mapped from pixels to points by dividing by getContentScale()

std::string cinder::app::Window::getTitle ( ) const

Returns the Window's title as a UTF-8 string.

void cinder::app::Window::setTitle ( const std::string title)

Sets the Window's title as a UTF-8 string.

bool cinder::app::Window::isBorderless ( ) const

Returns whether the window has a border (chrome/frame)

void cinder::app::Window::setBorderless ( bool  borderless = true)

Sets whether the window has a border (chrome/frame)

bool cinder::app::Window::isAlwaysOnTop ( ) const

Returns whether the window always remains above all other windows.

void cinder::app::Window::setAlwaysOnTop ( bool  alwaysOnTop = true)

Sets whether the window always remains above all other windows.

void cinder::app::Window::hide ( )

Hides the window but does not destroy it.

void cinder::app::Window::show ( )

Shows a window that was hidden with hide()

bool cinder::app::Window::isHidden ( ) const

Returns whether the window has been hidden with hide()

void cinder::app::Window::close ( )

Closes and destroys the Window.

DisplayRef cinder::app::Window::getDisplay ( ) const

Returns the Display on which the Window resides.

RendererRef cinder::app::Window::getRenderer ( ) const

Returns the Renderer associated with the Window.

void * cinder::app::Window::getNative ( ) const

Returns the associated NSView on Mac OS X, UIView on iOS, or HWND on MSW.

EventSignalMouse& cinder::app::Window::getSignalMouseDown ( )
void cinder::app::Window::emitMouseDown ( MouseEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectMouseDown ( fn,
Y *  inst 
)
EventSignalMouse& cinder::app::Window::getSignalMouseDrag ( )
void cinder::app::Window::emitMouseDrag ( MouseEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectMouseDrag ( fn,
Y *  inst 
)
EventSignalMouse& cinder::app::Window::getSignalMouseUp ( )
void cinder::app::Window::emitMouseUp ( MouseEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectMouseUp ( fn,
Y *  inst 
)
EventSignalMouse& cinder::app::Window::getSignalMouseMove ( )
void cinder::app::Window::emitMouseMove ( MouseEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectMouseMove ( fn,
Y *  inst 
)
EventSignalMouse& cinder::app::Window::getSignalMouseWheel ( )
void cinder::app::Window::emitMouseWheel ( MouseEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectMouseWheel ( fn,
Y *  inst 
)
EventSignalTouch& cinder::app::Window::getSignalTouchesBegan ( )
void cinder::app::Window::emitTouchesBegan ( TouchEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectTouchesBegan ( fn,
Y *  inst 
)
EventSignalTouch& cinder::app::Window::getSignalTouchesMoved ( )
void cinder::app::Window::emitTouchesMoved ( TouchEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectTouchesMoved ( fn,
Y *  inst 
)
EventSignalTouch& cinder::app::Window::getSignalTouchesEnded ( )
void cinder::app::Window::emitTouchesEnded ( TouchEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectTouchesEnded ( fn,
Y *  inst 
)
const std::vector< TouchEvent::Touch > & cinder::app::Window::getActiveTouches ( ) const

Returns a std::vector of all active touches.

EventSignalKey& cinder::app::Window::getSignalKeyDown ( )
void cinder::app::Window::emitKeyDown ( KeyEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectKeyDown ( fn,
Y *  inst 
)
EventSignalKey& cinder::app::Window::getSignalKeyUp ( )
void cinder::app::Window::emitKeyUp ( KeyEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectKeyUp ( fn,
Y *  inst 
)
EventSignalWindow& cinder::app::Window::getSignalDraw ( )
void cinder::app::Window::emitDraw ( )

Fires the 'draw' signal. Note in general this should not be called directly as it doesn't perform all necessary setup.

template<typename T , typename Y >
signals::connection cinder::app::Window::connectDraw ( fn,
Y *  inst 
)
EventSignalWindow& cinder::app::Window::getSignalPostDraw ( )

Returns the signal which is emitted after the draw signal and app's draw() virtual method.

template<typename T , typename Y >
signals::connection cinder::app::Window::connectPostDraw ( fn,
Y *  inst 
)
EventSignalWindow& cinder::app::Window::getSignalMove ( )
void cinder::app::Window::emitMove ( )
template<typename T , typename Y >
signals::connection cinder::app::Window::connectMove ( fn,
Y *  inst 
)
EventSignalWindow& cinder::app::Window::getSignalResize ( )
void cinder::app::Window::emitResize ( )
template<typename T , typename Y >
signals::connection cinder::app::Window::connectResize ( fn,
Y *  inst 
)
EventSignalWindow& cinder::app::Window::getSignalDisplayChange ( )
void cinder::app::Window::emitDisplayChange ( )
template<typename T , typename Y >
signals::connection cinder::app::Window::connectDisplayChange ( fn,
Y *  inst 
)
EventSignalWindow& cinder::app::Window::getSignalClose ( )

Returns the Signal emitted whenever a Window is closing. The WindowRef parameter is still valid at this point but its renderer is not.

void cinder::app::Window::emitClose ( )

Fires the 'close' signal.

template<typename T , typename Y >
signals::connection cinder::app::Window::connectClose ( fn,
Y *  inst 
)
EventSignalFileDrop& cinder::app::Window::getSignalFileDrop ( )
void cinder::app::Window::emitFileDrop ( FileDropEvent event)
template<typename T , typename Y >
signals::connection cinder::app::Window::connectFileDrop ( fn,
Y *  inst 
)
template<typename T >
T* cinder::app::Window::getUserData ( )

Returns the window-specific data associated with this Window.

template<typename T >
void cinder::app::Window::setUserData ( T *  userData)

Sets the window-specific data associated with this Window. The variable is deleted upon destruction of the Window.

bool cinder::app::Window::isValid ( ) const

Returns whether this Window is valid. false means it should no longer be used (neither read nor write)

void cinder::app::Window::setInvalid ( )
App* cinder::app::Window::getApp ( ) const
void cinder::app::Window::testValid ( ) const
protected
void cinder::app::Window::setApp ( App app)
protected

Member Data Documentation

App* cinder::app::Window::mApp
protected
bool cinder::app::Window::mValid
protected
std::shared_ptr<void> cinder::app::Window::mUserData
protected
EventSignalMouse cinder::app::Window::mSignalMouseDown
protected
EventSignalMouse cinder::app::Window::mSignalMouseDrag
protected
EventSignalMouse cinder::app::Window::mSignalMouseUp
protected
EventSignalMouse cinder::app::Window::mSignalMouseWheel
protected
EventSignalMouse cinder::app::Window::mSignalMouseMove
protected
EventSignalTouch cinder::app::Window::mSignalTouchesBegan
protected
EventSignalTouch cinder::app::Window::mSignalTouchesMoved
protected
EventSignalTouch cinder::app::Window::mSignalTouchesEnded
protected
EventSignalKey cinder::app::Window::mSignalKeyDown
protected
EventSignalKey cinder::app::Window::mSignalKeyUp
protected
EventSignalWindow cinder::app::Window::mSignalDraw
protected
EventSignalWindow cinder::app::Window::mSignalPostDraw
protected
EventSignalWindow cinder::app::Window::mSignalMove
protected
EventSignalWindow cinder::app::Window::mSignalResize
protected
EventSignalWindow cinder::app::Window::mSignalDisplayChange
protected
EventSignalWindow cinder::app::Window::mSignalClose
protected
EventSignalFileDrop cinder::app::Window::mSignalFileDrop
protected

The documentation for this class was generated from the following files: