Compare commits

...

14 Commits

3 changed files with 179 additions and 104 deletions
+13 -13
View File
@@ -1,23 +1,23 @@
# neat_bar # 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 ## VS Stock Action Bar
### New Features ### New Features
- Floating mode - Floating mode!
- Rectangular mode on round watches - Rectangular/round backgrounds on all watches!
- Adjustable spread (distance between icons) - Adjustable spread (distance between icons)!
- Increased max icon size (unlimited width; 25px height) - Increased max icon size (unlimited width; 25px height)!
- Custom bar corner radius - Custom bar corner radius!
- Custom bar width/height - Custom bar width/height!
- Custom bar x/y positions - Custom bar/icon x/y offsets!
### Removed Features ### Missing Features (unplanned)
- Anything to do with back button overrides - Anything to do with back button overrides
- Fully custom animations - Fully custom animations
- Built-in animations can still be customized - Built-in animations can still be customized
- Duration, move distance/direction, and move axis are all configurable - Duration, move distance/direction, and move axis are all configurable
- Round style - They can also be disabled
- 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!
### Pending Features ### Pending Features
- Optional AA on bar corners
- Legacy (background invert) animations support - Legacy (background invert) animations support
- Y offset for all icons - Customizable round bar size
- Legacy and default theme setters
+140 -80
View File
@@ -4,32 +4,34 @@
#include "neat_bar.h" #include "neat_bar.h"
#include <pebble.h> #include <pebble.h>
#if PBL_DISPLAY_WIDTH >= 260 && PBL_ROUND #define MAX(a, b) (((a) > (b)) ? (a) : (b))
const int8_t ICON_X_OFFSET = -1; #define ABS(a) (((a) < 0) ? -(a) : (a))
const uint16_t UP_Y = 76;
const uint16_t SELECT_Y = 118; #if PBL_DISPLAY_HEIGHT >= 260 && PBL_ROUND
const uint16_t DOWN_Y = 158; #define DEFAULT_SPREAD 41
#elif PBL_DISPLAY_WIDTH >= 200 && PBL_RECT #define SELECT_Y 118
const int8_t ICON_X_OFFSET = 0; //
const uint16_t UP_Y = 41; #elif PBL_DISPLAY_HEIGHT >= 228 && PBL_RECT
const uint16_t SELECT_Y = 102; #define DEFAULT_SPREAD 60
const uint16_t DOWN_Y = 161; #define SELECT_Y 102
#elif PBL_DISPLAY_WIDTH >= 180 && PBL_ROUND //
const int8_t ICON_X_OFFSET = -1; #elif PBL_DISPLAY_HEIGHT >= 180 && PBL_ROUND
const uint16_t UP_Y = 49; #define DEFAULT_SPREAD 28
const uint16_t SELECT_Y = 78; #define SELECT_Y 78
const uint16_t DOWN_Y = 105; //
#else // all 144x168 watches #else // all 144x168 watches
const int8_t ICON_X_OFFSET = 0; #define DEFAULT_SPREAD 51
const uint16_t UP_Y = 26; #define SELECT_Y 72
const uint16_t SELECT_Y = 72;
const uint16_t DOWN_Y = 117;
#endif #endif
#if PBL_ROUND #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 #else
#define ANIM_DISTANCE 5 #define USE_ROUND_BAR_BY_DEFAULT false
#define DEFAULT_ANIM_DISTANCE 5
#define DEFAULT_ICONS_X_OFFSET 1
#endif #endif
static const GRect s_base_grect_rect = GRect(PBL_DISPLAY_WIDTH - ACTION_BAR_WIDTH, 0, ACTION_BAR_WIDTH, PBL_DISPLAY_HEIGHT); 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 NeatBarLayer *s_current_neat_bar = NULL;
static GRect s_get_home_frame(NeatBarLayer *neat_bar, uint8_t button_index) { static GRect s_get_home_frame(NeatBarLayer *neat_bar, uint8_t button_index) {
int16_t y_offset = neat_bar->main_grect.origin.y; int16_t total_y_offset = neat_bar->main_grect.origin.y - neat_bar->icons_y_offset;
int8_t spread = neat_bar->spread; int8_t spread = neat_bar->icons_spread;
uint16_t width = neat_bar->main_grect.size.w; uint16_t width = neat_bar->main_grect.size.w;
switch (button_index) { switch (button_index) {
case BUTTON_ID_UP: 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: 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: 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: default:
return GRectZero; 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) { static void s_main_layer_update_proc(Layer *layer, GContext *ctx) {
graphics_context_set_antialiased(ctx, false); if (s_current_neat_bar->bar_use_round_style) {
graphics_context_set_fill_color(ctx, s_current_neat_bar->background_color); const uint32_t action_bar_circle_diameter = PBL_DISPLAY_HEIGHT * 19 / 9;
graphics_fill_rect(ctx, layer_get_bounds(layer), s_current_neat_bar->corner_radius, s_current_neat_bar->x_offset > 0 ? GCornersAll : GCornersLeft); 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->rect_bar_corner_radius, s_current_neat_bar->bar_x_offset > 0 ? GCornersAll : GCornersLeft);
}
} }
static void s_base_click_config_provider(void *config_context) { static void s_base_click_config_provider(void *config_context) {
NeatBarLayer *neat_bar = config_context; NeatBarLayer *neat_bar = config_context;
void *context = neat_bar->context ? neat_bar->context : neat_bar; void *context = neat_bar->context ? neat_bar->context : neat_bar;
window_raw_click_subscribe(BUTTON_ID_UP, s_up_down_handler, s_up_up_handler, neat_bar); if (neat_bar->animations_enabled) {
window_raw_click_subscribe(BUTTON_ID_DOWN, s_down_down_handler, s_down_up_handler, neat_bar); window_raw_click_subscribe(BUTTON_ID_UP, s_up_down_handler, s_up_up_handler, neat_bar);
window_raw_click_subscribe(BUTTON_ID_SELECT, s_select_down_handler, s_select_up_handler, neat_bar); window_raw_click_subscribe(BUTTON_ID_DOWN, s_down_down_handler, s_down_up_handler, neat_bar);
window_set_click_context(BUTTON_ID_UP, context); window_raw_click_subscribe(BUTTON_ID_SELECT, s_select_down_handler, s_select_up_handler, neat_bar);
window_set_click_context(BUTTON_ID_DOWN, context); window_set_click_context(BUTTON_ID_UP, context);
window_set_click_context(BUTTON_ID_SELECT, context); window_set_click_context(BUTTON_ID_DOWN, context);
window_set_click_context(BUTTON_ID_SELECT, context);
}
if (neat_bar->click_config_provider) { if (neat_bar->click_config_provider) {
neat_bar->click_config_provider(context); 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) { static void s_recenter_icons(NeatBarLayer *neat_bar) {
int16_t y_offset = neat_bar->main_grect.origin.y; int16_t total_y_offset = neat_bar->main_grect.origin.y - neat_bar->icons_y_offset;
int8_t spread = neat_bar->spread; int8_t spread = neat_bar->icons_spread;
if (neat_bar->up_layer) { if (neat_bar->up_layer) {
layer_set_frame(bitmap_layer_get_layer(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) { if (neat_bar->select_layer) {
layer_set_frame(bitmap_layer_get_layer(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) { if (neat_bar->down_layer) {
layer_set_frame(bitmap_layer_get_layer(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); s_update_click_config_provider(neat_bar);
} }
void neat_bar_layer_set_animations_move_distance(NeatBarLayer *neat_bar, int8_t distance) { // default: true
if (distance == neat_bar->animations_move_distance) { void neat_bar_layer_set_animations_enabled(NeatBarLayer *neat_bar, bool enabled) {
if (enabled == neat_bar->animations_enabled) {
return; return;
} }
neat_bar->animations_move_distance = distance; neat_bar->animations_enabled = enabled;
} }
// default: false // 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; 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 // default: 144
void neat_bar_layer_set_animations_duration(NeatBarLayer *neat_bar, uint8_t duration_ms) { void neat_bar_layer_set_animations_duration(NeatBarLayer *neat_bar, uint8_t duration_ms) {
if (duration_ms == neat_bar->animations_duration) { 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; neat_bar->animations_duration = duration_ms;
} }
// default: 0 // default: false (rect), true (round)
void neat_bar_layer_set_floating(NeatBarLayer *neat_bar, uint16_t x_offset) { void neat_bar_layer_set_bar_style(NeatBarLayer *neat_bar, bool use_round_style) {
if (x_offset == neat_bar->x_offset) { if (use_round_style == neat_bar->bar_use_round_style) {
return; 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; 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_set_frame(neat_bar->main_layer, neat_bar->main_grect);
layer_mark_dirty(neat_bar->main_layer); 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 // 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) { if (width == neat_bar->main_grect.size.w) {
return; return;
} }
neat_bar->main_grect.origin.x = PBL_DISPLAY_WIDTH - width; neat_bar->main_grect.origin.x = PBL_DISPLAY_WIDTH - width;
neat_bar->main_grect.size.w = width; neat_bar->main_grect.size.w = width;
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect); layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
if (neat_bar->x_offset > 0) { if (neat_bar->bar_x_offset > 0) {
uint16_t x = neat_bar->x_offset; uint16_t x = neat_bar->bar_x_offset;
neat_bar->x_offset = 0; // force update neat_bar->bar_x_offset = 0; // force update
neat_bar_layer_set_floating(neat_bar, x); neat_bar_layer_set_rect_bar_floating(neat_bar, x);
} else { } else {
layer_mark_dirty(neat_bar->main_layer); 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 // 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) { if (height == neat_bar->main_grect.size.h) {
return; return;
} }
@@ -255,7 +296,7 @@ void neat_bar_layer_set_height(NeatBarLayer *neat_bar, uint16_t height) {
} }
// default: 0 // 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) { if (y_offset == neat_bar->main_grect.origin.y) {
return; return;
} }
@@ -265,15 +306,6 @@ void neat_bar_layer_set_y_offset(NeatBarLayer *neat_bar, uint16_t y_offset) {
s_recenter_icons(neat_bar); 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 // default: GColorBlack
void neat_bar_layer_set_background_color(NeatBarLayer *neat_bar, GColor background_color) { void neat_bar_layer_set_background_color(NeatBarLayer *neat_bar, GColor background_color) {
if (gcolor_equal(background_color, neat_bar->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); layer_mark_dirty(neat_bar->main_layer);
} }
// default: 0 // default: DEFAULT_SPREAD
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) {
if (spread == neat_bar->spread) { if (spread == neat_bar->icons_spread) {
return; 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); s_recenter_icons(neat_bar);
} }
// constraints: must be <=25px in height (width is only constrained to the width of the 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) { void neat_bar_layer_set_icon(NeatBarLayer *neat_bar, ButtonId button_id, GBitmap *icon) {
BitmapLayer *current_bitmap_layer; BitmapLayer *current_bitmap_layer;
uint16_t y_pos;
switch (button_id) { switch (button_id) {
case BUTTON_ID_UP: case BUTTON_ID_UP:
current_bitmap_layer = neat_bar->up_layer; current_bitmap_layer = neat_bar->up_layer;
y_pos = UP_Y;
break; break;
case BUTTON_ID_DOWN: case BUTTON_ID_DOWN:
current_bitmap_layer = neat_bar->down_layer; current_bitmap_layer = neat_bar->down_layer;
y_pos = DOWN_Y;
break; break;
default: default:
current_bitmap_layer = neat_bar->select_layer; current_bitmap_layer = neat_bar->select_layer;
y_pos = SELECT_Y;
} }
if (!current_bitmap_layer) { if (!current_bitmap_layer) {
int16_t adjusted_y = (button_id == BUTTON_ID_UP) ? y_pos - neat_bar->spread int16_t total_y_offset = neat_bar->main_grect.origin.y - neat_bar->icons_y_offset;
: (button_id == BUTTON_ID_DOWN) ? y_pos + neat_bar->spread int16_t adjusted_y = (button_id == BUTTON_ID_UP) ? SELECT_Y - neat_bar->icons_spread - total_y_offset
: y_pos; : (button_id == BUTTON_ID_DOWN) ? SELECT_Y + neat_bar->icons_spread - total_y_offset
current_bitmap_layer = bitmap_layer_create(GRect(ICON_X_OFFSET, adjusted_y, neat_bar->main_grect.size.w, 25)); : 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)); layer_add_child(neat_bar->main_layer, bitmap_layer_get_layer(current_bitmap_layer));
switch (button_id) { switch (button_id) {
case BUTTON_ID_UP: 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_layer_create() {
NeatBarLayer *neat_bar = malloc(sizeof(NeatBarLayer)); NeatBarLayer *neat_bar = malloc(sizeof(NeatBarLayer));
// layerage
neat_bar->main_grect = s_base_grect_rect; neat_bar->main_grect = s_base_grect_rect;
neat_bar->main_layer = layer_create(s_base_grect_rect); neat_bar->main_layer = layer_create(s_base_grect_rect);
neat_bar->up_layer = NULL; neat_bar->up_layer = NULL;
neat_bar->down_layer = NULL; neat_bar->down_layer = NULL;
neat_bar->select_layer = NULL; neat_bar->select_layer = NULL;
// stock cfg/plumbing
neat_bar->click_config_provider = NULL; neat_bar->click_config_provider = NULL;
neat_bar->background_color = GColorBlack; neat_bar->background_color = GColorBlack;
neat_bar->corner_radius = 0; neat_bar->context = NULL;
neat_bar->x_offset = 0;
neat_bar->spread = 0; // 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_on_y_axis = false;
neat_bar->animations_move_distance = ANIM_DISTANCE; neat_bar->animations_move_distance = DEFAULT_ANIM_DISTANCE;
neat_bar->animations_duration = 144; neat_bar->animations_duration = 144;
// state tracking
neat_bar->up_pressed = false; neat_bar->up_pressed = false;
neat_bar->select_pressed = false; neat_bar->select_pressed = false;
neat_bar->down_pressed = false; neat_bar->down_pressed = false;
neat_bar->context = NULL;
layer_set_update_proc(neat_bar->main_layer, s_main_layer_update_proc); layer_set_update_proc(neat_bar->main_layer, s_main_layer_update_proc);
s_current_neat_bar = neat_bar; s_current_neat_bar = neat_bar;
return neat_bar; return neat_bar;
+26 -11
View File
@@ -6,38 +6,53 @@
#include <pebble.h> #include <pebble.h>
typedef struct { typedef struct {
// layerage
struct Window *window; struct Window *window;
GRect main_grect; GRect main_grect;
Layer *main_layer; Layer *main_layer;
BitmapLayer *up_layer; BitmapLayer *up_layer;
BitmapLayer *down_layer; BitmapLayer *down_layer;
BitmapLayer *select_layer; BitmapLayer *select_layer;
// stock cfg/plumbing
ClickConfigProvider click_config_provider; ClickConfigProvider click_config_provider;
GColor8 background_color; GColor8 background_color;
uint16_t corner_radius; void *context;
uint16_t x_offset;
int8_t spread; // 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; bool animations_move_on_y_axis;
int8_t animations_move_distance; int8_t animations_move_distance;
uint8_t animations_duration; uint8_t animations_duration;
// state tracking
bool up_pressed; bool up_pressed;
bool select_pressed; bool select_pressed;
bool down_pressed; bool down_pressed;
void *context;
} NeatBarLayer; } NeatBarLayer;
void neat_bar_layer_add_to_window(NeatBarLayer *neat_bar, Window *window); 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_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_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_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_bar_style(NeatBarLayer *neat_bar, bool use_round_style);
void neat_bar_layer_set_width(NeatBarLayer *neat_bar, uint16_t width); void neat_bar_layer_set_rect_bar_floating(NeatBarLayer *neat_bar, uint16_t x_offset);
void neat_bar_layer_set_height(NeatBarLayer *neat_bar, uint16_t height); void neat_bar_layer_set_rect_bar_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius);
void neat_bar_layer_set_y_offset(NeatBarLayer *neat_bar, uint16_t y_offset); void neat_bar_layer_set_bar_width(NeatBarLayer *neat_bar, uint16_t width);
void neat_bar_layer_set_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius); 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_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); void neat_bar_layer_set_icon(NeatBarLayer *layer, ButtonId button_id, GBitmap *icon);
NeatBarLayer *neat_bar_layer_create(); NeatBarLayer *neat_bar_layer_create();
void neat_bar_layer_destroy(NeatBarLayer *neat_bar); void neat_bar_layer_destroy(NeatBarLayer *neat_bar);