Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a909727c0 | |||
| ba80a2972a | |||
| 1f07cf7563 | |||
| 28c50819ad | |||
| 682b824488 | |||
| 9c20d38612 | |||
| 2e26048563 | |||
| 937cc08ac8 | |||
| 93a3d568aa | |||
| 8cd1dbd11a | |||
| 62fd6aa756 | |||
| 0e61a4bf79 | |||
| 7155e2f4f0 | |||
| 70004c432d |
@@ -1,23 +1,23 @@
|
||||
# neat_bar
|
||||
A more customizable replacement for the built-in Pebble action bar.
|
||||
`neat_bar` is a (mostly) drop-in replacement for the stock Pebble action bar that adds a bunch of customizability.
|
||||
|
||||
## VS Stock Action Bar
|
||||
### New Features
|
||||
- Floating mode
|
||||
- Rectangular mode on round watches
|
||||
- Adjustable spread (distance between icons)
|
||||
- Increased max icon size (unlimited width; 25px height)
|
||||
- Custom bar corner radius
|
||||
- Custom bar width/height
|
||||
- Custom bar x/y positions
|
||||
### Removed Features
|
||||
- Floating mode!
|
||||
- Rectangular/round backgrounds on all watches!
|
||||
- Adjustable spread (distance between icons)!
|
||||
- Increased max icon size (unlimited width; 25px height)!
|
||||
- Custom bar corner radius!
|
||||
- Custom bar width/height!
|
||||
- Custom bar/icon x/y offsets!
|
||||
### Missing Features (unplanned)
|
||||
- Anything to do with back button overrides
|
||||
- Fully custom animations
|
||||
- Built-in animations can still be customized
|
||||
- Duration, move distance/direction, and move axis are all configurable
|
||||
- Round style
|
||||
- Using a rectangular bar on a round watch saves space and IMO looks way better
|
||||
- Use custom corner radius for a nice effect on round watches!
|
||||
- They can also be disabled
|
||||
### Pending Features
|
||||
- Optional AA on bar corners
|
||||
- Legacy (background invert) animations support
|
||||
- Y offset for all icons
|
||||
- Customizable round bar size
|
||||
- Legacy and default theme setters
|
||||
|
||||
+132
-72
@@ -4,32 +4,34 @@
|
||||
#include "neat_bar.h"
|
||||
#include <pebble.h>
|
||||
|
||||
#if PBL_DISPLAY_WIDTH >= 260 && PBL_ROUND
|
||||
const int8_t ICON_X_OFFSET = -1;
|
||||
const uint16_t UP_Y = 76;
|
||||
const uint16_t SELECT_Y = 118;
|
||||
const uint16_t DOWN_Y = 158;
|
||||
#elif PBL_DISPLAY_WIDTH >= 200 && PBL_RECT
|
||||
const int8_t ICON_X_OFFSET = 0;
|
||||
const uint16_t UP_Y = 41;
|
||||
const uint16_t SELECT_Y = 102;
|
||||
const uint16_t DOWN_Y = 161;
|
||||
#elif PBL_DISPLAY_WIDTH >= 180 && PBL_ROUND
|
||||
const int8_t ICON_X_OFFSET = -1;
|
||||
const uint16_t UP_Y = 49;
|
||||
const uint16_t SELECT_Y = 78;
|
||||
const uint16_t DOWN_Y = 105;
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
||||
|
||||
#if PBL_DISPLAY_HEIGHT >= 260 && PBL_ROUND
|
||||
#define DEFAULT_SPREAD 41
|
||||
#define SELECT_Y 118
|
||||
//
|
||||
#elif PBL_DISPLAY_HEIGHT >= 228 && PBL_RECT
|
||||
#define DEFAULT_SPREAD 60
|
||||
#define SELECT_Y 102
|
||||
//
|
||||
#elif PBL_DISPLAY_HEIGHT >= 180 && PBL_ROUND
|
||||
#define DEFAULT_SPREAD 28
|
||||
#define SELECT_Y 78
|
||||
//
|
||||
#else // all 144x168 watches
|
||||
const int8_t ICON_X_OFFSET = 0;
|
||||
const uint16_t UP_Y = 26;
|
||||
const uint16_t SELECT_Y = 72;
|
||||
const uint16_t DOWN_Y = 117;
|
||||
#define DEFAULT_SPREAD 51
|
||||
#define SELECT_Y 72
|
||||
#endif
|
||||
|
||||
#if PBL_ROUND
|
||||
#define ANIM_DISTANCE 4
|
||||
#define USE_ROUND_BAR_BY_DEFAULT true
|
||||
#define DEFAULT_ANIM_DISTANCE 4
|
||||
#define DEFAULT_ICONS_X_OFFSET -1
|
||||
#else
|
||||
#define ANIM_DISTANCE 5
|
||||
#define USE_ROUND_BAR_BY_DEFAULT false
|
||||
#define DEFAULT_ANIM_DISTANCE 5
|
||||
#define DEFAULT_ICONS_X_OFFSET 1
|
||||
#endif
|
||||
|
||||
static const GRect s_base_grect_rect = GRect(PBL_DISPLAY_WIDTH - ACTION_BAR_WIDTH, 0, ACTION_BAR_WIDTH, PBL_DISPLAY_HEIGHT);
|
||||
@@ -37,17 +39,17 @@ static const GRect s_base_grect_rect = GRect(PBL_DISPLAY_WIDTH - ACTION_BAR_WIDT
|
||||
static NeatBarLayer *s_current_neat_bar = NULL;
|
||||
|
||||
static GRect s_get_home_frame(NeatBarLayer *neat_bar, uint8_t button_index) {
|
||||
int16_t y_offset = neat_bar->main_grect.origin.y;
|
||||
int8_t spread = neat_bar->spread;
|
||||
int16_t total_y_offset = neat_bar->main_grect.origin.y - neat_bar->icons_y_offset;
|
||||
int8_t spread = neat_bar->icons_spread;
|
||||
uint16_t width = neat_bar->main_grect.size.w;
|
||||
|
||||
switch (button_index) {
|
||||
case BUTTON_ID_UP:
|
||||
return GRect(ICON_X_OFFSET, UP_Y - spread - y_offset, width, 25);
|
||||
return GRect(neat_bar->icons_x_offset, SELECT_Y - spread - total_y_offset, width, 25);
|
||||
case BUTTON_ID_SELECT:
|
||||
return GRect(ICON_X_OFFSET, SELECT_Y - y_offset, width, 25);
|
||||
return GRect(neat_bar->icons_x_offset, SELECT_Y - total_y_offset, width, 25);
|
||||
case BUTTON_ID_DOWN:
|
||||
return GRect(ICON_X_OFFSET, DOWN_Y + spread - y_offset, width, 25);
|
||||
return GRect(neat_bar->icons_x_offset, SELECT_Y + spread - total_y_offset, width, 25);
|
||||
default:
|
||||
return GRectZero;
|
||||
}
|
||||
@@ -139,20 +141,32 @@ static void s_select_up_handler(ClickRecognizerRef recognizer, void *context) {
|
||||
}
|
||||
|
||||
static void s_main_layer_update_proc(Layer *layer, GContext *ctx) {
|
||||
if (s_current_neat_bar->bar_use_round_style) {
|
||||
const uint32_t action_bar_circle_diameter = PBL_DISPLAY_HEIGHT * 19 / 9;
|
||||
GRect neat_bar_circle_frame = (GRect){.size = GSize(action_bar_circle_diameter, action_bar_circle_diameter)};
|
||||
GRect bounds = layer_get_bounds(layer);
|
||||
grect_align(&neat_bar_circle_frame, &bounds, GAlignLeft, false);
|
||||
graphics_context_set_fill_color(ctx, s_current_neat_bar->background_color);
|
||||
const int32_t inset_thickness = MAX(ABS(neat_bar_circle_frame.size.h), ABS(neat_bar_circle_frame.size.w));
|
||||
graphics_fill_radial(ctx, neat_bar_circle_frame, GOvalScaleModeFitCircle, inset_thickness, 0, TRIG_MAX_ANGLE);
|
||||
} else {
|
||||
graphics_context_set_antialiased(ctx, false);
|
||||
graphics_context_set_fill_color(ctx, s_current_neat_bar->background_color);
|
||||
graphics_fill_rect(ctx, layer_get_bounds(layer), s_current_neat_bar->corner_radius, s_current_neat_bar->x_offset > 0 ? GCornersAll : GCornersLeft);
|
||||
graphics_fill_rect(ctx, layer_get_bounds(layer), s_current_neat_bar->rect_bar_corner_radius, s_current_neat_bar->bar_x_offset > 0 ? GCornersAll : GCornersLeft);
|
||||
}
|
||||
}
|
||||
|
||||
static void s_base_click_config_provider(void *config_context) {
|
||||
NeatBarLayer *neat_bar = config_context;
|
||||
void *context = neat_bar->context ? neat_bar->context : neat_bar;
|
||||
if (neat_bar->animations_enabled) {
|
||||
window_raw_click_subscribe(BUTTON_ID_UP, s_up_down_handler, s_up_up_handler, neat_bar);
|
||||
window_raw_click_subscribe(BUTTON_ID_DOWN, s_down_down_handler, s_down_up_handler, neat_bar);
|
||||
window_raw_click_subscribe(BUTTON_ID_SELECT, s_select_down_handler, s_select_up_handler, neat_bar);
|
||||
window_set_click_context(BUTTON_ID_UP, context);
|
||||
window_set_click_context(BUTTON_ID_DOWN, context);
|
||||
window_set_click_context(BUTTON_ID_SELECT, context);
|
||||
}
|
||||
if (neat_bar->click_config_provider) {
|
||||
neat_bar->click_config_provider(context);
|
||||
}
|
||||
@@ -165,19 +179,19 @@ inline static void s_update_click_config_provider(NeatBarLayer *neat_bar) {
|
||||
}
|
||||
|
||||
static void s_recenter_icons(NeatBarLayer *neat_bar) {
|
||||
int16_t y_offset = neat_bar->main_grect.origin.y;
|
||||
int8_t spread = neat_bar->spread;
|
||||
int16_t total_y_offset = neat_bar->main_grect.origin.y - neat_bar->icons_y_offset;
|
||||
int8_t spread = neat_bar->icons_spread;
|
||||
if (neat_bar->up_layer) {
|
||||
layer_set_frame(bitmap_layer_get_layer(neat_bar->up_layer),
|
||||
GRect(ICON_X_OFFSET, UP_Y - spread - y_offset, neat_bar->main_grect.size.w, 25));
|
||||
GRect(neat_bar->icons_x_offset, SELECT_Y - spread - total_y_offset, neat_bar->main_grect.size.w, 25));
|
||||
}
|
||||
if (neat_bar->select_layer) {
|
||||
layer_set_frame(bitmap_layer_get_layer(neat_bar->select_layer),
|
||||
GRect(ICON_X_OFFSET, SELECT_Y - y_offset, neat_bar->main_grect.size.w, 25));
|
||||
GRect(neat_bar->icons_x_offset, SELECT_Y - total_y_offset, neat_bar->main_grect.size.w, 25));
|
||||
}
|
||||
if (neat_bar->down_layer) {
|
||||
layer_set_frame(bitmap_layer_get_layer(neat_bar->down_layer),
|
||||
GRect(ICON_X_OFFSET, DOWN_Y + spread - y_offset, neat_bar->main_grect.size.w, 25));
|
||||
GRect(neat_bar->icons_x_offset, SELECT_Y + spread - total_y_offset, neat_bar->main_grect.size.w, 25));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,11 +206,12 @@ void neat_bar_layer_set_click_config_provider(NeatBarLayer *neat_bar, ClickConfi
|
||||
s_update_click_config_provider(neat_bar);
|
||||
}
|
||||
|
||||
void neat_bar_layer_set_animations_move_distance(NeatBarLayer *neat_bar, int8_t distance) {
|
||||
if (distance == neat_bar->animations_move_distance) {
|
||||
// default: true
|
||||
void neat_bar_layer_set_animations_enabled(NeatBarLayer *neat_bar, bool enabled) {
|
||||
if (enabled == neat_bar->animations_enabled) {
|
||||
return;
|
||||
}
|
||||
neat_bar->animations_move_distance = distance;
|
||||
neat_bar->animations_enabled = enabled;
|
||||
}
|
||||
|
||||
// default: false
|
||||
@@ -207,6 +222,14 @@ void neat_bar_layer_set_animations_move_axis(NeatBarLayer *neat_bar, bool use_y_
|
||||
neat_bar->animations_move_on_y_axis = use_y_axis;
|
||||
}
|
||||
|
||||
// default: 5 (rect), 4 (round)
|
||||
void neat_bar_layer_set_animations_move_distance(NeatBarLayer *neat_bar, int8_t distance) {
|
||||
if (distance == neat_bar->animations_move_distance) {
|
||||
return;
|
||||
}
|
||||
neat_bar->animations_move_distance = distance;
|
||||
}
|
||||
|
||||
// default: 144
|
||||
void neat_bar_layer_set_animations_duration(NeatBarLayer *neat_bar, uint8_t duration_ms) {
|
||||
if (duration_ms == neat_bar->animations_duration) {
|
||||
@@ -215,29 +238,47 @@ void neat_bar_layer_set_animations_duration(NeatBarLayer *neat_bar, uint8_t dura
|
||||
neat_bar->animations_duration = duration_ms;
|
||||
}
|
||||
|
||||
// default: 0
|
||||
void neat_bar_layer_set_floating(NeatBarLayer *neat_bar, uint16_t x_offset) {
|
||||
if (x_offset == neat_bar->x_offset) {
|
||||
// default: false (rect), true (round)
|
||||
void neat_bar_layer_set_bar_style(NeatBarLayer *neat_bar, bool use_round_style) {
|
||||
if (use_round_style == neat_bar->bar_use_round_style) {
|
||||
return;
|
||||
}
|
||||
neat_bar->x_offset = x_offset;
|
||||
neat_bar->bar_use_round_style = use_round_style;
|
||||
layer_mark_dirty(neat_bar->main_layer);
|
||||
}
|
||||
|
||||
// default: 0
|
||||
void neat_bar_layer_set_rect_bar_floating(NeatBarLayer *neat_bar, uint16_t x_offset) {
|
||||
if (x_offset == neat_bar->bar_x_offset) {
|
||||
return;
|
||||
}
|
||||
neat_bar->bar_x_offset = x_offset;
|
||||
neat_bar->main_grect.origin.x = PBL_DISPLAY_WIDTH - neat_bar->main_grect.size.w - x_offset;
|
||||
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
|
||||
layer_mark_dirty(neat_bar->main_layer);
|
||||
}
|
||||
|
||||
// default: 0
|
||||
void neat_bar_layer_set_rect_bar_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius) {
|
||||
if (corner_radius == neat_bar->rect_bar_corner_radius) {
|
||||
return;
|
||||
}
|
||||
neat_bar->rect_bar_corner_radius = corner_radius;
|
||||
layer_mark_dirty(neat_bar->main_layer);
|
||||
}
|
||||
|
||||
// default: ACTION_BAR_WIDTH
|
||||
void neat_bar_layer_set_width(NeatBarLayer *neat_bar, uint16_t width) {
|
||||
void neat_bar_layer_set_bar_width(NeatBarLayer *neat_bar, uint16_t width) {
|
||||
if (width == neat_bar->main_grect.size.w) {
|
||||
return;
|
||||
}
|
||||
neat_bar->main_grect.origin.x = PBL_DISPLAY_WIDTH - width;
|
||||
neat_bar->main_grect.size.w = width;
|
||||
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
|
||||
if (neat_bar->x_offset > 0) {
|
||||
uint16_t x = neat_bar->x_offset;
|
||||
neat_bar->x_offset = 0; // force update
|
||||
neat_bar_layer_set_floating(neat_bar, x);
|
||||
if (neat_bar->bar_x_offset > 0) {
|
||||
uint16_t x = neat_bar->bar_x_offset;
|
||||
neat_bar->bar_x_offset = 0; // force update
|
||||
neat_bar_layer_set_rect_bar_floating(neat_bar, x);
|
||||
} else {
|
||||
layer_mark_dirty(neat_bar->main_layer);
|
||||
}
|
||||
@@ -245,7 +286,7 @@ void neat_bar_layer_set_width(NeatBarLayer *neat_bar, uint16_t width) {
|
||||
}
|
||||
|
||||
// default: PBL_DISPLAY_HEIGHT
|
||||
void neat_bar_layer_set_height(NeatBarLayer *neat_bar, uint16_t height) {
|
||||
void neat_bar_layer_set_bar_height(NeatBarLayer *neat_bar, uint16_t height) {
|
||||
if (height == neat_bar->main_grect.size.h) {
|
||||
return;
|
||||
}
|
||||
@@ -255,7 +296,7 @@ void neat_bar_layer_set_height(NeatBarLayer *neat_bar, uint16_t height) {
|
||||
}
|
||||
|
||||
// default: 0
|
||||
void neat_bar_layer_set_y_offset(NeatBarLayer *neat_bar, uint16_t y_offset) {
|
||||
void neat_bar_layer_set_bar_y_offset(NeatBarLayer *neat_bar, uint16_t y_offset) {
|
||||
if (y_offset == neat_bar->main_grect.origin.y) {
|
||||
return;
|
||||
}
|
||||
@@ -265,15 +306,6 @@ void neat_bar_layer_set_y_offset(NeatBarLayer *neat_bar, uint16_t y_offset) {
|
||||
s_recenter_icons(neat_bar);
|
||||
}
|
||||
|
||||
// default: 0
|
||||
void neat_bar_layer_set_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius) {
|
||||
if (corner_radius == neat_bar->corner_radius) {
|
||||
return;
|
||||
}
|
||||
neat_bar->corner_radius = corner_radius;
|
||||
layer_mark_dirty(neat_bar->main_layer);
|
||||
}
|
||||
|
||||
// default: GColorBlack
|
||||
void neat_bar_layer_set_background_color(NeatBarLayer *neat_bar, GColor background_color) {
|
||||
if (gcolor_equal(background_color, neat_bar->background_color)) {
|
||||
@@ -283,39 +315,54 @@ void neat_bar_layer_set_background_color(NeatBarLayer *neat_bar, GColor backgrou
|
||||
layer_mark_dirty(neat_bar->main_layer);
|
||||
}
|
||||
|
||||
// default: 0
|
||||
void neat_bar_layer_set_spread(NeatBarLayer *neat_bar, int8_t spread) {
|
||||
if (spread == neat_bar->spread) {
|
||||
// default: DEFAULT_SPREAD
|
||||
void neat_bar_layer_set_icons_spread(NeatBarLayer *neat_bar, int8_t spread) {
|
||||
if (spread == neat_bar->icons_spread) {
|
||||
return;
|
||||
}
|
||||
neat_bar->spread = spread;
|
||||
neat_bar->icons_spread = spread;
|
||||
s_recenter_icons(neat_bar);
|
||||
}
|
||||
|
||||
// default: 1 (rect), -1 (round)
|
||||
void neat_bar_layer_set_icons_x_offset(NeatBarLayer *neat_bar, int8_t x_offset) {
|
||||
if (x_offset == neat_bar->icons_x_offset) {
|
||||
return;
|
||||
}
|
||||
neat_bar->icons_x_offset = x_offset;
|
||||
s_recenter_icons(neat_bar);
|
||||
}
|
||||
|
||||
// default: 0
|
||||
void neat_bar_layer_set_icons_y_offset(NeatBarLayer *neat_bar, int8_t y_offset) {
|
||||
if (y_offset == neat_bar->icons_y_offset) {
|
||||
return;
|
||||
}
|
||||
neat_bar->icons_y_offset = y_offset;
|
||||
s_recenter_icons(neat_bar);
|
||||
}
|
||||
|
||||
// constraints: must be <=25px in height (width is only constrained to the width of the bar)
|
||||
void neat_bar_layer_set_icon(NeatBarLayer *neat_bar, ButtonId button_id, GBitmap *icon) {
|
||||
BitmapLayer *current_bitmap_layer;
|
||||
uint16_t y_pos;
|
||||
|
||||
switch (button_id) {
|
||||
case BUTTON_ID_UP:
|
||||
current_bitmap_layer = neat_bar->up_layer;
|
||||
y_pos = UP_Y;
|
||||
break;
|
||||
case BUTTON_ID_DOWN:
|
||||
current_bitmap_layer = neat_bar->down_layer;
|
||||
y_pos = DOWN_Y;
|
||||
break;
|
||||
default:
|
||||
current_bitmap_layer = neat_bar->select_layer;
|
||||
y_pos = SELECT_Y;
|
||||
}
|
||||
|
||||
if (!current_bitmap_layer) {
|
||||
int16_t adjusted_y = (button_id == BUTTON_ID_UP) ? y_pos - neat_bar->spread
|
||||
: (button_id == BUTTON_ID_DOWN) ? y_pos + neat_bar->spread
|
||||
: y_pos;
|
||||
current_bitmap_layer = bitmap_layer_create(GRect(ICON_X_OFFSET, adjusted_y, neat_bar->main_grect.size.w, 25));
|
||||
int16_t total_y_offset = neat_bar->main_grect.origin.y - neat_bar->icons_y_offset;
|
||||
int16_t adjusted_y = (button_id == BUTTON_ID_UP) ? SELECT_Y - neat_bar->icons_spread - total_y_offset
|
||||
: (button_id == BUTTON_ID_DOWN) ? SELECT_Y + neat_bar->icons_spread - total_y_offset
|
||||
: SELECT_Y - total_y_offset;
|
||||
current_bitmap_layer = bitmap_layer_create(GRect(neat_bar->icons_x_offset, adjusted_y, neat_bar->main_grect.size.w, 25));
|
||||
layer_add_child(neat_bar->main_layer, bitmap_layer_get_layer(current_bitmap_layer));
|
||||
switch (button_id) {
|
||||
case BUTTON_ID_UP:
|
||||
@@ -338,23 +385,36 @@ void neat_bar_layer_set_icon(NeatBarLayer *neat_bar, ButtonId button_id, GBitmap
|
||||
|
||||
NeatBarLayer *neat_bar_layer_create() {
|
||||
NeatBarLayer *neat_bar = malloc(sizeof(NeatBarLayer));
|
||||
|
||||
// layerage
|
||||
neat_bar->main_grect = s_base_grect_rect;
|
||||
neat_bar->main_layer = layer_create(s_base_grect_rect);
|
||||
neat_bar->up_layer = NULL;
|
||||
neat_bar->down_layer = NULL;
|
||||
neat_bar->select_layer = NULL;
|
||||
|
||||
// stock cfg/plumbing
|
||||
neat_bar->click_config_provider = NULL;
|
||||
neat_bar->background_color = GColorBlack;
|
||||
neat_bar->corner_radius = 0;
|
||||
neat_bar->x_offset = 0;
|
||||
neat_bar->spread = 0;
|
||||
neat_bar->context = NULL;
|
||||
|
||||
// neat_bar exclusives :D
|
||||
neat_bar->bar_use_round_style = USE_ROUND_BAR_BY_DEFAULT;
|
||||
neat_bar->rect_bar_corner_radius = 0;
|
||||
neat_bar->bar_x_offset = 0;
|
||||
neat_bar->icons_spread = DEFAULT_SPREAD;
|
||||
neat_bar->icons_x_offset = DEFAULT_ICONS_X_OFFSET;
|
||||
neat_bar->icons_y_offset = 0;
|
||||
neat_bar->animations_enabled = true;
|
||||
neat_bar->animations_move_on_y_axis = false;
|
||||
neat_bar->animations_move_distance = ANIM_DISTANCE;
|
||||
neat_bar->animations_move_distance = DEFAULT_ANIM_DISTANCE;
|
||||
neat_bar->animations_duration = 144;
|
||||
|
||||
// state tracking
|
||||
neat_bar->up_pressed = false;
|
||||
neat_bar->select_pressed = false;
|
||||
neat_bar->down_pressed = false;
|
||||
neat_bar->context = NULL;
|
||||
|
||||
layer_set_update_proc(neat_bar->main_layer, s_main_layer_update_proc);
|
||||
s_current_neat_bar = neat_bar;
|
||||
return neat_bar;
|
||||
|
||||
+26
-11
@@ -6,38 +6,53 @@
|
||||
#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;
|
||||
uint16_t corner_radius;
|
||||
uint16_t x_offset;
|
||||
int8_t spread;
|
||||
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;
|
||||
void *context;
|
||||
} 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_move_distance(NeatBarLayer *neat_bar, int8_t distance);
|
||||
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_floating(NeatBarLayer *neat_bar, uint16_t x_offset);
|
||||
void neat_bar_layer_set_width(NeatBarLayer *neat_bar, uint16_t width);
|
||||
void neat_bar_layer_set_height(NeatBarLayer *neat_bar, uint16_t height);
|
||||
void neat_bar_layer_set_y_offset(NeatBarLayer *neat_bar, uint16_t y_offset);
|
||||
void neat_bar_layer_set_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius);
|
||||
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_spread(NeatBarLayer *neat_bar, int8_t spread);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user