npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pebble-ui-dialog-window

v0.2.1

Published

A library to create and customize simple dialog windows for Pebble watchapps.

Downloads

26

Readme

UIDialogWindow

A library to create and customize simple dialog windows for Pebble watchapps.

Aplite Basalt Chalk

Behavior

UIDialogWindows 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

Installation

pebble package install pebble-ui-dialog-window

Sample Usage

#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();
}

Documentation

UIDialogWindow* ui_dialog_window_create(char* message, GBitmap* icon);

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.

void ui_dialog_window_destroy(UIDialogWindow* this);

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.

Window* ui_dialog_window_get_window(UIDialogWindow* this);

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.

void ui_dialog_window_set_background_color(UIDialogWindow* this, const GColor color);

Sets the UIDialogWindow's background color.

void ui_dialog_window_set_label_color(UIDialogWindow* this, const GColor color);

Set's the font color of the UIDialogWindow's label.

void ui_dialog_window_set_label_font(UIDialogWindow* this, const GFont font);

Set's the font of the UIDialogWindow's label.

void ui_dialog_window_set_label_alignment(UIDialogWindow* this, const GTextAlignment align);

Set's the alignment of the UIDialogWindow's label. By default, the alignment is set to GTextAlignmentLeft for rectangular displays, and GTextAlignmentCenter for circular screens.

void ui_dialog_window_set_label_text(UIDialogWindow* this, char* message);

Set's the text of the UIDialogWindow's label.

GAlign ui_dialog_window_set_icon_alignment(UIDialogWindow* this, const GAlign align);

Set's the alignment of the UIDialogWindow's icon. By default, the alignment is set to GAlignmentLeft for rectangular displays, and GAlignmentCenter for circular screens and returns the set alignment.

If you try to set any alignment other than GAlignLeft, GAlignCenter, or GAlignRight the method will pick the closest match.

void ui_dialog_window_set_icon(UIDialogWindow* this, GBitmap* icon);

Set's the image of the UIDialogWindow's icon.

License

This library is licensed under the MIT license.