Add spacesaver theme
This commit is contained in:
+26
-1
@@ -88,11 +88,35 @@ void neat_bar_layer_set_corner_radius(NeatBarLayer *neat_bar, uint16_t corner_ra
|
|||||||
layer_mark_dirty(neat_bar->main_layer);
|
layer_mark_dirty(neat_bar->main_layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void s_recenter_icons(NeatBarLayer *neat_bar) {
|
||||||
|
if (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));
|
||||||
|
}
|
||||||
|
if (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));
|
||||||
|
}
|
||||||
|
if (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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void neat_bar_layer_set_theme_default_rect(NeatBarLayer *neat_bar) {
|
void neat_bar_layer_set_theme_default_rect(NeatBarLayer *neat_bar) {
|
||||||
neat_bar_layer_set_floating(neat_bar, false);
|
neat_bar_layer_set_floating(neat_bar, false);
|
||||||
neat_bar->main_grect = s_base_grect_rect;
|
neat_bar->main_grect = s_base_grect_rect;
|
||||||
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
|
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
|
||||||
neat_bar_layer_set_corner_radius(neat_bar, 0);
|
neat_bar_layer_set_corner_radius(neat_bar, 0);
|
||||||
|
s_recenter_icons(neat_bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
void neat_bar_layer_set_theme_spacesaver_rect(NeatBarLayer *neat_bar) {
|
||||||
|
neat_bar_layer_set_floating(neat_bar, false);
|
||||||
|
neat_bar->main_grect = GRect(s_base_grect_rect.origin.x + 12, 0, s_base_grect_rect.size.w - 12, s_base_grect_rect.size.h);
|
||||||
|
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
|
||||||
|
neat_bar_layer_set_corner_radius(neat_bar, 0);
|
||||||
|
s_recenter_icons(neat_bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
void neat_bar_layer_set_theme_legacy_rect(NeatBarLayer *neat_bar) {
|
void neat_bar_layer_set_theme_legacy_rect(NeatBarLayer *neat_bar) {
|
||||||
@@ -100,6 +124,7 @@ void neat_bar_layer_set_theme_legacy_rect(NeatBarLayer *neat_bar) {
|
|||||||
neat_bar->main_grect = GRect(s_base_grect_rect.origin.x, 4, s_base_grect_rect.size.w, s_base_grect_rect.size.h - 8);
|
neat_bar->main_grect = GRect(s_base_grect_rect.origin.x, 4, s_base_grect_rect.size.w, s_base_grect_rect.size.h - 8);
|
||||||
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
|
layer_set_frame(neat_bar->main_layer, neat_bar->main_grect);
|
||||||
neat_bar_layer_set_corner_radius(neat_bar, 3);
|
neat_bar_layer_set_corner_radius(neat_bar, 3);
|
||||||
|
s_recenter_icons(neat_bar);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
@@ -129,7 +154,7 @@ void neat_bar_layer_set_icon(NeatBarLayer *neat_bar, ButtonId button_id, GBitmap
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!current_bitmap_layer) {
|
if (!current_bitmap_layer) {
|
||||||
current_bitmap_layer = bitmap_layer_create(GRect(1, y_pos, ACTION_BAR_WIDTH, 18));
|
current_bitmap_layer = bitmap_layer_create(GRect(1, y_pos, neat_bar->main_grect.size.w, 18));
|
||||||
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:
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ typedef struct {
|
|||||||
NeatBarLayer *neat_bar_layer_create();
|
NeatBarLayer *neat_bar_layer_create();
|
||||||
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);
|
||||||
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_spacesaver_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_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);
|
||||||
|
|||||||
Reference in New Issue
Block a user