A library to create and customize simple dialog windows for Pebble watchapps.
UIDialogWindow
s are pre-configured, customizable dialog windows that
developers can create and use in their Pebble watchapps.
By default, the dialog window has the following properties and behavior:
- Default Background Color:
GColorClear
- Default Font Color:
GColorBlack
- Default Font:
FONT_KEY_GOTHIC_24_BOLD
back
button will close the window
pebble package install pebble-ui-dialog-window
#include <pebble.h>
#include "pebble-ui-dialog-window/pebble-ui-dialog-window.h"
UIDialogWindow* dialog;
char* dialog_message = "Battery is low! Connect Pebble to charging cable.";
GBitmap* dialog_icon = NULL;
static void init() {
dialog_icon = gbitmap_create_with_resource(RESOURCE_ID_WARNING);
dialog = ui_dialog_window_create(dialog_message, dialog_icon);
ui_dialog_window_set_background_color(dialog, GColorYellow);
Window* window = ui_dialog_window_get_window(dialog);
window_stack_push(window, true);
}
static void deinit() {
gbitmap_destroy(dialog_icon);
if (dialog) ui_dialog_window_destroy(dialog);
}
int main(void) {
init();
app_event_loop();
deinit();
}
Creates a new UIDialogWindow
object that can be used to display and customize
a dialog window.
NOTE: The UIDialogWindow
does not make copies of message
and icon
parameters, so the developer must ensure the objects persist for the lifetime of
the dialog window.
Frees all memory associated with the UIDialogWindow
object.
NOTE: ui_dialog_window_destroy
will not free the memory associated with
the message
or icon
parameters passed into ui_dialog_window_create
.
Returns a Window object that can be pushed onto the WindowStack or manipulated in other ways (such as assigning ClickHandlers with window_set_click_config_provider.
Sets the UIDialogWindow
's background color.
Set's the font color of the UIDialogWindow
's label.
Set's the font of the UIDialogWindow
's label.
Set's the text of the UIDialogWindow
's label.
Set's the image of the UIDialogWindow
's icon.
This library is licensed under the MIT license.