pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • Examples
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

Pebble C API

  • Pebble C API
  • Pebble JavaScript API
  • PebbleKit JS
  • PebbleKit iOS
  • PebbleKit Android
  • Foundation
    • App
    • App Communication
    • App Glance
    • AppMessage
    • AppSync
    • AppWorker
    • DataLogging
    • DataStructures
      • UUID
    • Dictation
    • Dictionary
    • Event Service
      • AccelerometerService
      • AppFocusService
      • BatteryStateService
      • CompassService
      • ConnectionService
      • HealthService
      • TickTimerService
    • Exit Reason
    • Internationalization
    • Launch Reason
    • Logging
    • Math
    • Memory Management
    • Platform
    • Resources
      • File Formats
    • Storage
    • Timer
    • Wakeup
    • Wall Time
    • WatchInfo
    • Rocky
  • Graphics
    • Draw Commands
    • Drawing Paths
    • Drawing Primitives
    • Drawing Text
    • Fonts
    • Graphics Context
    • Graphics Types
      • Color Definitions
  • User Interface
    • Animation
      • PropertyAnimation
    • Clicks
    • Layers
      • ActionBarLayer
      • BitmapLayer
      • MenuLayer
      • RotBitmapLayer
      • ScrollLayer
      • SimpleMenuLayer
      • StatusBarLayer
      • TextLayer
    • Light
    • Preferences
    • UnobstructedArea
    • Vibes
    • Window
      • ActionMenu
      • NumberWindow
    • Window Stack
  • Standard C
    • Format
    • Locale
    • Math
    • Memory
    • String
    • Time

StatusBarLayer

Layer that serves as a configurable status bar.

Function Documentation

StatusBarLayer * status_bar_layer_create(void)

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

  • Text color: GColorBlack

  • Background color: GColorWhite

  • Frame: GRect(0, 0, screen_width, STATUS_BAR_LAYER_HEIGHT) The status bar is automatically marked dirty after this operation. You can call layer_set_frame() to create a StatusBarLayer of a different width.

// 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);
layer_set_frame(status_bar_layer_get_layer(status_bar), frame);
layer_add_child(root_layer, status_bar_layer_get_layer(status_bar));

Returns

A pointer to the StatusBarLayer, which will be allocated to the heap, NULL if the StatusBarLayer could not be created

void status_bar_layer_destroy(StatusBarLayer * status_bar_layer)

Destroys a StatusBarLayer previously created by status_bar_layer_create.

Parameters

status_bar_layer

The StatusBarLayer to destroy

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.

Note

The result is always equal to (Layer *) status_bar_layer.

Parameters

status_bar_layer

Pointer to the StatusBarLayer for which to get the "root" Layer

Returns

The "root" Layer of the status bar.

GColor status_bar_layer_get_background_color(const StatusBarLayer * status_bar_layer)

Gets background color of StatusBarLayer.

Parameters

status_bar_layer

The StatusBarLayer of which to get the color

Returns

GColor of background color property

GColor status_bar_layer_get_foreground_color(const StatusBarLayer * status_bar_layer)

Gets foreground color of StatusBarLayer.

Parameters

status_bar_layer

The StatusBarLayer of which to get the color

Returns

GColor of foreground color property

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_layer

The StatusBarLayer of which to set the colors

background

The new GColor to set for background

foreground

The new GColor to set for text and other foreground elements

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_layer

The StatusBarLayer of which to set the separator mode

mode

Determines the separator mode

Enum Documentation

enum StatusBarLayerSeparatorMode

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

Enumerators

StatusBarLayerSeparatorModeNone

The default mode. No separator will be shown.

StatusBarLayerSeparatorModeDotted

A dotted separator at the bottom of the status bar.

Typedef Documentation

typedef struct StatusBarLayer StatusBarLayer

Macro Definition Documentation

  • SDK 3
  • SDK 4
#define STATUS_BAR_LAYER_HEIGHT PBL_IF_RECT_ELSE(16, 24)

The fixed height of the status bar, including separator height.

#define STATUS_BAR_LAYER_HEIGHT _STATUS_BAR_LAYER_HEIGHT(PBL_PLATFORM_TYPE_CURRENT)

The fixed height of the status bar, including separator height.

  • SDK 3
  • SDK 4

The define _STATUS_BAR_LAYER_HEIGHT does not exist in SDK 3.

#define _STATUS_BAR_LAYER_HEIGHT ( plat)

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

Need some help?

Functions

  • status_bar_layer_create
  • status_bar_layer_destroy
  • status_bar_layer_get_layer
  • status_bar_layer_get_background_color
  • status_bar_layer_get_foreground_color
  • status_bar_layer_set_colors
  • status_bar_layer_set_separator_mode

Enums

  • StatusBarLayerSeparatorMode

Typedefs

  • StatusBarLayer

Macro Defintions

  • STATUS_BAR_LAYER_HEIGHT
  • _STATUS_BAR_LAYER_HEIGHT

Getting Help

Do you have questions about the Pebble SDK?

Do you need some help understanding something on this page?

You can either take advantage of our awesome developer community and check out the SDK Help forums, or you can send us a message through the website!