Make bar height adjustable
This commit is contained in:
+15
-3
@@ -56,17 +56,18 @@ 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;
|
||||||
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(1, UP_Y, neat_bar->main_grect.size.w, 18));
|
GRect(1, UP_Y - y_offset, neat_bar->main_grect.size.w, 18));
|
||||||
}
|
}
|
||||||
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(1, SELECT_Y, neat_bar->main_grect.size.w, 18));
|
GRect(1, SELECT_Y - y_offset, neat_bar->main_grect.size.w, 18));
|
||||||
}
|
}
|
||||||
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(1, DOWN_Y, neat_bar->main_grect.size.w, 18));
|
GRect(1, DOWN_Y - y_offset, neat_bar->main_grect.size.w, 18));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,6 +128,17 @@ void neat_bar_layer_set_width(NeatBarLayer *neat_bar, uint16_t width) {
|
|||||||
s_recenter_icons(neat_bar);
|
s_recenter_icons(neat_bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void neat_bar_layer_set_height(NeatBarLayer *neat_bar, uint16_t height) {
|
||||||
|
if (height == neat_bar->main_grect.size.h) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
neat_bar->main_grect.origin.y = (PBL_DISPLAY_HEIGHT - height) / 2;
|
||||||
|
neat_bar->main_grect.size.h = height;
|
||||||
|
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
|
||||||
|
layer_mark_dirty(neat_bar->main_layer);
|
||||||
|
s_recenter_icons(neat_bar);
|
||||||
|
}
|
||||||
|
|
||||||
void neat_bar_layer_set_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius) {
|
void neat_bar_layer_set_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius) {
|
||||||
if (corner_radius == neat_bar->corner_radius) {
|
if (corner_radius == neat_bar->corner_radius) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ void neat_bar_layer_set_icon(NeatBarLayer *layer, ButtonId button_id, GBitmap *i
|
|||||||
void neat_bar_layer_set_theme_default_rect(NeatBarLayer *neat_bar);
|
void neat_bar_layer_set_theme_default_rect(NeatBarLayer *neat_bar);
|
||||||
void neat_bar_layer_set_theme_legacy_rect(NeatBarLayer *neat_bar);
|
void neat_bar_layer_set_theme_legacy_rect(NeatBarLayer *neat_bar);
|
||||||
void neat_bar_layer_set_width(NeatBarLayer *neat_bar, uint16_t width);
|
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_floating(NeatBarLayer *neat_bar, bool floating);
|
void neat_bar_layer_set_floating(NeatBarLayer *neat_bar, bool floating);
|
||||||
void neat_bar_layer_set_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius);
|
void neat_bar_layer_set_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_radius);
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user