Pebble Foundation Classes  0.2.0
C++ for Pebble
StatusBarLayer

Layer that serves as a configurable status bar. More...

Collaboration diagram for StatusBarLayer:

Macros

#define STATUS_BAR_LAYER_HEIGHT   _STATUS_BAR_LAYER_HEIGHT(PBL_PLATFORM_TYPE_CURRENT)
 The fixed height of the status bar, including separator height.
 
#define _STATUS_BAR_LAYER_HEIGHT(plat)
 The fixed height of the status bar, including separator height, for all platforms. More...
 

Typedefs

typedef struct StatusBarLayer StatusBarLayer
 

Enumerations

enum  StatusBarLayerSeparatorMode { StatusBarLayerSeparatorModeNone = 0, StatusBarLayerSeparatorModeDotted = 1 }
 Values that are used to indicate the different status bar separator modes. More...
 

Functions

StatusBarLayer * status_bar_layer_create (void)
 
void status_bar_layer_destroy (StatusBarLayer *status_bar_layer)
 
Layer * status_bar_layer_get_layer (StatusBarLayer *status_bar_layer)
 
GColor status_bar_layer_get_background_color (const StatusBarLayer *status_bar_layer)
 
GColor status_bar_layer_get_foreground_color (const StatusBarLayer *status_bar_layer)
 
void status_bar_layer_set_colors (StatusBarLayer *status_bar_layer, GColor background, GColor foreground)
 
void status_bar_layer_set_separator_mode (StatusBarLayer *status_bar_layer, StatusBarLayerSeparatorMode mode)
 

Detailed Description

Layer that serves as a configurable status bar.

Macro Definition Documentation

◆ _STATUS_BAR_LAYER_HEIGHT

#define _STATUS_BAR_LAYER_HEIGHT (   plat)
Value:
PBL_PLATFORM_SWITCH(plat, \
/*aplite*/ 16, \
/*basalt*/ 16, \
/*chalk*/ 24, \
/*diorite*/ 16, \
/*emery*/ 20)

The fixed height of the status bar, including separator height, for all platforms.

Enumeration Type Documentation

◆ StatusBarLayerSeparatorMode

Values that are used to indicate the different status bar separator modes.

Enumerator
StatusBarLayerSeparatorModeNone 

The default mode. No separator will be shown.

StatusBarLayerSeparatorModeDotted 

A dotted separator at the bottom of the status bar.

Function Documentation

◆ status_bar_layer_create()

StatusBarLayer* status_bar_layer_create ( void  )

Creates a new StatusBarLayer on the heap and initializes it with the default values.

// Change the status bar width to make space for the action bar
int16_t width = layer_get_bounds(root_layer).size.w - ACTION_BAR_WIDTH;
GRect frame = GRect(0, 0, width, STATUS_BAR_LAYER_HEIGHT);
Returns
A pointer to the StatusBarLayer, which will be allocated to the heap, NULL if the StatusBarLayer could not be created

◆ status_bar_layer_destroy()

void status_bar_layer_destroy ( StatusBarLayer *  status_bar_layer)

Destroys a StatusBarLayer previously created by status_bar_layer_create.

Parameters
status_bar_layerThe StatusBarLayer to destroy

◆ status_bar_layer_get_background_color()

GColor status_bar_layer_get_background_color ( const StatusBarLayer *  status_bar_layer)

Gets background color of StatusBarLayer

Parameters
status_bar_layerThe StatusBarLayer of which to get the color
Returns
GColor of background color property

◆ status_bar_layer_get_foreground_color()

GColor status_bar_layer_get_foreground_color ( const StatusBarLayer *  status_bar_layer)

Gets foreground color of StatusBarLayer

Parameters
status_bar_layerThe StatusBarLayer of which to get the color
Returns
GColor of foreground color property

◆ status_bar_layer_get_layer()

Layer* status_bar_layer_get_layer ( StatusBarLayer *  status_bar_layer)

Gets the "root" Layer of the status bar, which is the parent for the sub- layers used for its implementation.

Parameters
status_bar_layerPointer to the StatusBarLayer for which to get the "root" Layer
Returns
The "root" Layer of the status bar.
Note
The result is always equal to (Layer *) status_bar_layer.

◆ status_bar_layer_set_colors()

void status_bar_layer_set_colors ( StatusBarLayer *  status_bar_layer,
GColor  background,
GColor  foreground 
)

Sets the background and foreground colors of StatusBarLayer

Parameters
status_bar_layerThe StatusBarLayer of which to set the colors
backgroundThe new GColor to set for background
foregroundThe new GColor to set for text and other foreground elements

◆ status_bar_layer_set_separator_mode()

void status_bar_layer_set_separator_mode ( StatusBarLayer *  status_bar_layer,
StatusBarLayerSeparatorMode  mode 
)

Sets the mode of the StatusBarLayer separator, to help divide it from content

Parameters
status_bar_layerThe StatusBarLayer of which to set the separator mode
modeDetermines the separator mode
ACTION_BAR_WIDTH
#define ACTION_BAR_WIDTH
The width of the action bar in pixels.
Definition: pebble.h:7499
GRect::size
GSize size
The size of the rectangle.
Definition: pebble.h:3361
STATUS_BAR_LAYER_HEIGHT
#define STATUS_BAR_LAYER_HEIGHT
The fixed height of the status bar, including separator height.
Definition: pebble.h:7666
GSize::w
int16_t w
The width.
Definition: pebble.h:3338
GRect
struct GRect GRect
status_bar_layer_get_layer
Layer * status_bar_layer_get_layer(StatusBarLayer *status_bar_layer)
layer_add_child
void layer_add_child(Layer *parent, Layer *child)
layer_set_frame
void layer_set_frame(Layer *layer, GRect frame)
layer_get_bounds
GRect layer_get_bounds(const Layer *layer)
GRect
Definition: pebble.h:3357