All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Window Stack

Detailed Description

The default sequence-of-windows, drill-down navigation.

The navigation model of Pebble revolves around the concept of a horizontal “stack” of windows. Each new window is pushed onto the stack to the right of the previous one. Usually, it makes most sense to use the SELECT button (middle button on the right side of the watch) as trigger for the user to push a new window onto the window stack. For example, pressing SELECT in the launcher menu, will push the window of the highlighted app onto the window stack.

window_stack.png

By default, the BACK button on the left of the watch pops the top-most window off of the “window stack” and moves left to the previous window that is on the stack.

Note that the direction of the SELECT button aligns with the direction in which the user interface moves when windows are being pushed (to the right) and the direction of the BACK button aligns with the direction in which the user interface moves when windows are being popped (to the left).

Please refer to Building User Interfaces chapter in Pebble Developer Guide (chapter "Window Stack") for a conceptual overview of the window stack and relevant code examples.

Also see the WindowHandlers of a Window, for the callbacks that can be added to a window in order to act upon window stack transitions.

Function Documentation

bool window_stack_contains_window ( Window *  window)

Checks if the window is on the window stack.

Parameters
windowThe window to look for on the window stack
Returns
true if the window is currently on the window stack.
Window* window_stack_get_top_window ( void  )

Gets the top-most window on the stack that belongs to the app.

Returns
The top-most window on the stack that belongs to the app or NULL if no app window could be found.
Window* window_stack_pop ( bool  animated)

Pops the top-most window on the navigation stack.

Parameters
animatedSee window_stack_remove()
Returns
The window that is popped, or NULL is there are no windows to pop.
void window_stack_pop_all ( const bool  animated)

Pops all windows. See window_stack_remove() for a description of the animated parameter and notes.

void window_stack_push ( Window *  window,
bool  animated 
)

Pushes given window on the window navigation stack, on top of the current top-most window of the app.

Parameters
windowThe window to push on top
animatedPass in true to animate the push using a sliding animation, or false to skip the animation.
bool window_stack_remove ( Window *  window,
bool  animated 
)

Removes a given window from the window stack, that belongs to the app task.

Note
If there are no windows for the app left on the stack, the app will be killed by the system, shortly. To avoid this, make sure to push another window shortly after or before removing the last window.
Parameters
windowThe window to remove. If the window is NULL or if it is not on the stack, this function is a no-op.
animatedPass in true to animate the removal of the window using a side-to-side sliding animation to reveal the next window. This is only used in case the window happens to be on top of the window stack (thus visible).
Returns
True if window was successfully removed, false otherwise.