QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

Q::Layer Struct Reference
[User Interface]

Abstract screen rectangle component. More...

#include <Q/q.h>

Inheritance diagram for Q::Layer:

Q::ObjectBase Q::CameraLayer Q::ImageLayer Q::LogLayer Q::StatsLayer Q::TextLayer List of all members.

Public Member Functions

 Layer ()
Utils::Result destroy ()
Maths::Vec2f center () const
Maths::Vec2f extent () const
Maths::Vec2f alignment () const
float angle () const
unsigned int depth () const
bool visible () const
bool alwaysTop () const
bool rejectFocus () const
Screen screen () const
Maths::Vec2f layerToScreen (const Maths::Vec2f &layerRel) const
Maths::Vec2f screenToLayer (const Maths::Vec2f &screenRel) const
Maths::Vec2f layerToWindow (const Maths::Vec2f &layerRel) const
Maths::Vec2f windowToLayer (const Maths::Vec2f &windowRel) const
Utils::Result setCenter (const Maths::Vec2f &center)
Utils::Result setExtent (const Maths::Vec2f &extent)
Utils::Result setAlignment (const Maths::Vec2f &alignment)
Utils::Result setAngle (float angle)
Utils::Result setDepth (unsigned int depth)
Utils::Result setVisible (bool v)
Utils::Result setRejectFocus (bool r)
Utils::Result addListener (KeyboardListener &)
Utils::Result removeListener (KeyboardListener &)
Utils::Result addListener (MouseListener &)
Utils::Result removeListener (MouseListener &)

Detailed Description

Abstract screen rectangle component.

Different types of layer are tiled onto a screen to form the user interface. A layer is a 2-dimensional rectangular area on a given screen.

The shape and location of this rectangle depends on several parameters. The 'center' of the layer determines the location of the rectangle in the screen's virtual coordinate system. The 'alignment' of the layer determines the location of the origin of the layer's local coordinate system. An alignment of (0,0) places the origin at the bottom left of the layer and an alignment of (1,1) places it at the top right. The 'extent' of the layer gives its width and height in the screen's virtual coordinate system and the 'angle' can be used to rotate it.

Each layer has a position within a stack of layers in the screen. The stack of layers is rendered in order from bottom to top with layers higher in the stack obscuring lower layers. The position can either be set explicitly with methods of Screen (e.g. Screen::moveToTop) or implicitly by setting its 'depth' parameter.

The Layer class is a base class for the actual functional layers. It provides common functionality but it is not possible to construct an object of type Layer.


Constructor & Destructor Documentation

Q::Layer::Layer  )  [inline]
 

Create a null layer reference.


Member Function Documentation

Utils::Result Q::Layer::addListener MouseListener  ) 
 

Add a listener which will receive mouse events when this layer has the mouse focus.

Utils::Result Q::Layer::addListener KeyboardListener  ) 
 

Add a listener which will receive keyboard events when this layer has the keyboard focus.

Maths::Vec2f Q::Layer::alignment  )  const
 

Return the alignment of the layer.

bool Q::Layer::alwaysTop  )  const
 

Return true if the layer is intended to always be on top of the screen's layer stack.

float Q::Layer::angle  )  const
 

Return the angle of the layer measured in radians counter-clockwise. An angle of zero leaves the layer's coordinate system aligned with the screen's virtual coordinate system.

Maths::Vec2f Q::Layer::center  )  const
 

Return the center of the layer.

unsigned int Q::Layer::depth  )  const
 

Return the depth of the layer. A Layer with a larger depth value than another one will be in front of it.

Utils::Result Q::Layer::destroy  ) 
 

Destroy the layer, removing it from the screen first.

Maths::Vec2f Q::Layer::extent  )  const
 

Return the extent of the layer.

Maths::Vec2f Q::Layer::layerToScreen const Maths::Vec2f layerRel  )  const
 

Transform a coordinate in the layer's coordinate system to the equivalent coordinate in the screen's virtual coordinate system.

Maths::Vec2f Q::Layer::layerToWindow const Maths::Vec2f layerRel  )  const
 

Transform a coordinate in the layer's coordinate system to the equivalent coordinate in the window's physical coordinate system.

bool Q::Layer::rejectFocus  )  const
 

Return true if the object should not receive input events.

Utils::Result Q::Layer::removeListener MouseListener  ) 
 

Remove a mouse event listener.

Utils::Result Q::Layer::removeListener KeyboardListener  ) 
 

Remove a keyboard event listener.

Screen Q::Layer::screen  )  const
 

Return the screen that owns this layer.

Maths::Vec2f Q::Layer::screenToLayer const Maths::Vec2f screenRel  )  const
 

Transform a coordinate in the screen's virtual coordinate system to the equivalent coordinate in the layer's coordinate system.

Utils::Result Q::Layer::setAlignment const Maths::Vec2f alignment  ) 
 

Set the alignment of the layer.

Utils::Result Q::Layer::setAngle float  angle  ) 
 

Set the angle of the layer.

Utils::Result Q::Layer::setCenter const Maths::Vec2f center  ) 
 

Set the center of the layer.

Utils::Result Q::Layer::setDepth unsigned int  depth  ) 
 

Set the depth of the layer. A Layer with a depth of 0 will be rendered first and hence at the back of the screen.

Utils::Result Q::Layer::setExtent const Maths::Vec2f extent  ) 
 

Set the extent of the layer.

Utils::Result Q::Layer::setRejectFocus bool  r  ) 
 

If r is true, then this layer will not receive input events, otherwise it will participate in the screen's focus arbitration policy.

Utils::Result Q::Layer::setVisible bool  v  ) 
 

Set the visibility of the layer to v. Layers which are not visible are not rendered, allowing an application to efficiently toggle parts of its user-interface on and off.

bool Q::Layer::visible  )  const
 

Return true if the layer is visible.

Maths::Vec2f Q::Layer::windowToLayer const Maths::Vec2f windowRel  )  const
 

Transform a coordinate in the window's physical coordinate system to the equivalent coordinate in the layer's coordinate system.

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004