Files
neat_bar/src/c/neat_bar.h
T

59 lines
2.3 KiB
C

/* SPDX-FileCopyrightText: 2024 Google LLC */
/* SPDX-License-Identifier: Apache-2.0 */
#pragma once
#include <pebble.h>
typedef struct {
// layerage
struct Window *window;
GRect main_grect;
Layer *main_layer;
BitmapLayer *up_layer;
BitmapLayer *down_layer;
BitmapLayer *select_layer;
// stock cfg/plumbing
ClickConfigProvider click_config_provider;
GColor8 background_color;
void *context;
// neat_bar exclusives :D
bool bar_use_round_style;
uint16_t rect_bar_corner_radius;
uint16_t bar_x_offset;
int8_t icons_spread;
int8_t icons_x_offset;
int8_t icons_y_offset;
bool animations_enabled;
bool animations_move_on_y_axis;
int8_t animations_move_distance;
uint8_t animations_duration;
// state tracking
bool up_pressed;
bool select_pressed;
bool down_pressed;
} NeatBarLayer;
void neat_bar_layer_add_to_window(NeatBarLayer *neat_bar, Window *window);
void neat_bar_layer_set_click_config_provider(NeatBarLayer *neat_bar, ClickConfigProvider click_config_provider);
void neat_bar_layer_set_animations_enabled(NeatBarLayer *neat_bar, bool enabled);
void neat_bar_layer_set_animations_move_axis(NeatBarLayer *neat_bar, bool use_y_axis);
void neat_bar_layer_set_animations_move_distance(NeatBarLayer *neat_bar, int8_t distance);
void neat_bar_layer_set_animations_duration(NeatBarLayer *neat_bar, uint8_t duration_ms);
void neat_bar_layer_set_bar_style(NeatBarLayer *neat_bar, bool use_round_style);
void neat_bar_layer_set_rect_bar_floating(NeatBarLayer *neat_bar, uint16_t x_offset);
void neat_bar_layer_set_rect_bar_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius);
void neat_bar_layer_set_bar_width(NeatBarLayer *neat_bar, uint16_t width);
void neat_bar_layer_set_bar_height(NeatBarLayer *neat_bar, uint16_t height);
void neat_bar_layer_set_bar_y_offset(NeatBarLayer *neat_bar, uint16_t y_offset);
void neat_bar_layer_set_background_color(NeatBarLayer *neat_bar, GColor background_color);
void neat_bar_layer_set_icons_spread(NeatBarLayer *neat_bar, int8_t spread);
void neat_bar_layer_set_icons_x_offset(NeatBarLayer *neat_bar, int8_t x_offset);
void neat_bar_layer_set_icons_y_offset(NeatBarLayer *neat_bar, int8_t y_offset);
void neat_bar_layer_set_icon(NeatBarLayer *layer, ButtonId button_id, GBitmap *icon);
NeatBarLayer *neat_bar_layer_create();
void neat_bar_layer_destroy(NeatBarLayer *neat_bar);