Pebble Foundation Classes  0.2.0
C++ for Pebble
Pebble::Layer Class Reference
Inheritance diagram for Pebble::Layer:
Collaboration diagram for Pebble::Layer:

Public Member Functions

 Layer (::Layer *layer)
 Wraps an existing TextLayer.
 
 operator::Layer * ()
 Instances of this class can be automatically converted to Pebble Layers.
 
 operator const ::Layer * () const
 
void MarkDirty ()
 
void SetFrame (GRect frame)
 
void SetFrame (int16_t x, int16_t y, int16_t w, int16_t h)
 
void SetFrame (GPoint origin, GSize size)
 
GRect GetFrame ()
 
void SetBounds (GRect bounds)
 
GRect GetBounds ()
 
void RemoveFromParent ()
 
void RemoveChildLayers ()
 
void AddChild (Layer &child)
 
void InsertBelowSibling (Layer &below_sibling_layer)
 
void InsertAboveSibling (Layer &above_sibling_layer)
 
void SetHidden (bool hidden)
 
bool GetHidden ()
 
void SetClips (bool clips)
 
bool GetClips ()
 

Protected Attributes

::Layerlayer_
 

Member Function Documentation

◆ AddChild()

void Pebble::Layer::AddChild ( Layer child)
inline

Adds the child layer to a given parent layer, making it appear in front of its parent and in front of any existing child layers of the parent. If the child layer was already part of a layer hierarchy, it will be removed from its old parent first. If added successfully, the parent (and children) will be marked dirty automatically.

Parameters
parentThe layer to which to add the child layer
childThe layer to add to the parent layer

◆ GetBounds()

GRect Pebble::Layer::GetBounds ( )
inline

Gets the bounds of the layer

Returns
The bounds of the layer
See also
layer_set_bounds

◆ GetClips()

bool Pebble::Layer::GetClips ( )
inline

Gets whether clipping is enabled for the layer. If enabled, whatever the layer and its children will draw using their .update_proc callbacks, will be clipped by the this layer's frame.

Parameters
layerThe layer for which to get the clipping property
Returns
True if clipping is enabled for the layer, false if clipping is not enabled for the layer.

◆ GetFrame()

GRect Pebble::Layer::GetFrame ( )
inline

Gets the frame of the layer, which is it's bounding box relative to the coordinate system of its parent layer. If the frame has changed, layer_mark_dirty() will be called automatically.

Returns
The frame of the layer
See also
layer_set_frame

◆ GetHidden()

bool Pebble::Layer::GetHidden ( )
inline

Gets the visibility of the layer.

Parameters
layerThe layer for which to get the visibility
Returns
True if the layer is hidden, false if it is not hidden.

◆ InsertAboveSibling()

void Pebble::Layer::InsertAboveSibling ( Layer above_sibling_layer)
inline

Inserts the layer as a sibling in front of another layer. The above_layer has to be a child of a parent layer, otherwise this function will be a noop. If inserted successfully, the parent (and children) will be marked dirty automatically.

Parameters
layer_to_insertThe layer to insert into the hierarchy
above_sibling_layerThe layer that will be used as the sibling layer below which the insertion will take place

◆ InsertBelowSibling()

void Pebble::Layer::InsertBelowSibling ( Layer below_sibling_layer)
inline

Inserts the layer as a sibling behind another layer. The below_layer has to be a child of a parent layer, otherwise this function will be a noop. If inserted successfully, the parent (and children) will be marked dirty automatically.

Parameters
layer_to_insertThe layer to insert into the hierarchy
below_sibling_layerThe layer that will be used as the sibling layer above which the insertion will take place

◆ MarkDirty()

void Pebble::Layer::MarkDirty ( )
inline

Marks the complete layer as "dirty", awaiting to be asked by the system to redraw itself. Typically, this function is called whenever state has changed that affects what the layer is displaying.

  • The layer's .update_proc will not be called before this function returns, but will be called asynchronously, shortly.
  • Internally, a call to this function will schedule a re-render of the window that the layer belongs to. In effect, all layers in that window's layer hierarchy will be asked to redraw.
  • If an earlier re-render request is still pending, this function is a no-op.

◆ RemoveChildLayers()

void Pebble::Layer::RemoveChildLayers ( )
inline

Removes child layers from given layer If removed successfully, the child's parent layer will be marked dirty automatically.

◆ RemoveFromParent()

void Pebble::Layer::RemoveFromParent ( )
inline

Gets the window that the layer is currently attached to.

Parameters
layerThe layer for which to get the window
Returns
The window that this layer is currently attached to, or NULL if it has not been added to a window's layer hierarchy.
See also
window_get_root_layer()
layer_add_child() Removes the layer from its current parent layer If removed successfully, the child's parent layer will be marked dirty automatically.
Parameters
childThe layer to remove

◆ SetBounds()

void Pebble::Layer::SetBounds ( GRect  bounds)
inline

Sets the bounds of the layer, which is it's bounding box relative to its frame. If the bounds has changed, layer_mark_dirty() will be called automatically.

Parameters
boundsThe new bounds
See also
layer_set_frame()

◆ SetClips()

void Pebble::Layer::SetClips ( bool  clips)
inline

Sets whether clipping is enabled for the layer. If enabled, whatever the layer and its children will draw using their .update_proc callbacks, will be clipped by the this layer's frame. If the clipping has changed, layer_mark_dirty() will be called automatically.

Parameters
layerThe layer for which to set the clipping property
clipsSupply true to make the layer clip to its frame, or false to make it non-clipping.

◆ SetFrame()

void Pebble::Layer::SetFrame ( GRect  frame)
inline

Sets the frame of the layer, which is it's bounding box relative to the coordinate system of its parent layer. The size of the layer's bounds will be extended automatically, so that the bounds cover the new frame.

Parameters
frameThe new frame
See also
layer_set_bounds()

◆ SetHidden()

void Pebble::Layer::SetHidden ( bool  hidden)
inline

Sets the visibility of the layer. If the visibility has changed, layer_mark_dirty() will be called automatically on the parent layer.

Parameters
layerThe layer for which to set the visibility
hiddenSupply true to make the layer hidden, or false to make it non-hidden.

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