Pebble Foundation Classes  0.2.0
C++ for Pebble
NumberWindow

A ready-made Window prompting the user to pick a number. More...

Collaboration diagram for NumberWindow:

Classes

struct  NumberWindowCallbacks
 Data structure containing all the callbacks for a NumberWindow. More...
 

Typedefs

typedef struct NumberWindow NumberWindow
 
typedef void(* NumberWindowCallback) (struct NumberWindow *number_window, void *context)
 Function signature for NumberWindow callbacks.
 

Functions

NumberWindow * number_window_create (const char *label, NumberWindowCallbacks callbacks, void *callback_context)
 
void number_window_destroy (NumberWindow *number_window)
 Destroys a NumberWindow previously created by number_window_create.
 
void number_window_set_label (NumberWindow *numberwindow, const char *label)
 
void number_window_set_max (NumberWindow *numberwindow, int32_t max)
 
void number_window_set_min (NumberWindow *numberwindow, int32_t min)
 
void number_window_set_value (NumberWindow *numberwindow, int32_t value)
 
void number_window_set_step_size (NumberWindow *numberwindow, int32_t step)
 
int32_t number_window_get_value (const NumberWindow *numberwindow)
 
Window * number_window_get_window (NumberWindow *numberwindow)
 

Detailed Description

A ready-made Window prompting the user to pick a number.

Function Documentation

◆ number_window_create()

NumberWindow* number_window_create ( const char *  label,
NumberWindowCallbacks  callbacks,
void *  callback_context 
)

Creates a new NumberWindow on the heap and initalizes it with the default values.

Parameters
labelThe title or prompt to display in the NumberWindow. Must be long-lived and cannot be stack-allocated.
callbacksThe callbacks
callback_contextPointer to application specific data that is passed
Note
The number window is not pushed to the window stack. Use window_stack_push() to do this.
Returns
A pointer to the NumberWindow. NULL if the NumberWindow could not be created

◆ number_window_get_value()

int32_t number_window_get_value ( const NumberWindow *  numberwindow)

Gets the current value

Parameters
numberwindowPointer to the NumberWindow for which to get the current value
Returns
The current value

◆ number_window_get_window()

Window* number_window_get_window ( NumberWindow *  numberwindow)

Gets the "root" Window of the number window

Parameters
numberwindowPointer to the NumberWindow for which to get the "root" Window
Returns
The "root" Window of the number window.

◆ number_window_set_label()

void number_window_set_label ( NumberWindow *  numberwindow,
const char *  label 
)

Sets the text of the title or prompt label.

Parameters
numberwindowPointer to the NumberWindow for which to set the label text
labelThe new label text. Must be long-lived and cannot be stack-allocated.

◆ number_window_set_max()

void number_window_set_max ( NumberWindow *  numberwindow,
int32_t  max 
)

Sets the maximum value this field can hold

Parameters
numberwindowPointer to the NumberWindow for which to set the maximum value
maxThe maximum value

◆ number_window_set_min()

void number_window_set_min ( NumberWindow *  numberwindow,
int32_t  min 
)

Sets the minimum value this field can hold

Parameters
numberwindowPointer to the NumberWindow for which to set the minimum value
minThe minimum value

◆ number_window_set_step_size()

void number_window_set_step_size ( NumberWindow *  numberwindow,
int32_t  step 
)

Sets the amount by which to increment/decrement by on a button click

Parameters
numberwindowPointer to the NumberWindow for which to set the step increment
stepThe new step increment

◆ number_window_set_value()

void number_window_set_value ( NumberWindow *  numberwindow,
int32_t  value 
)

Sets the current value of the field

Parameters
numberwindowPointer to the NumberWindow for which to set the current value
valueThe new current value