From cfbad5ff2379e959ae641b27ccfe48207fc8595b Mon Sep 17 00:00:00 2001 From: Meiguro Date: Sun, 7 Feb 2016 22:10:36 -0800 Subject: [PATCH] Add missing status and menu layer definitions for older aplite SDKs --- src/simply/simply_menu.c | 5 +++-- src/util/compat.h | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/simply/simply_menu.c b/src/simply/simply_menu.c index 3c5f60b2..391db719 100644 --- a/src/simply/simply_menu.c +++ b/src/simply/simply_menu.c @@ -7,6 +7,7 @@ #include "simply.h" #include "util/color.h" +#include "util/display.h" #include "util/graphics.h" #include "util/menu_layer.h" #include "util/platform.h" @@ -333,8 +334,8 @@ static int16_t prv_menu_get_header_height_callback(MenuLayer *menu_layer, uint16 section->title != EMPTY_TITLE ? MENU_CELL_BASIC_HEADER_HEIGHT : 0); } -static int16_t prv_menu_get_cell_height_callback(MenuLayer *menu_layer, MenuIndex *cell_index, - void *context) { +ROUND_USAGE static int16_t prv_menu_get_cell_height_callback(MenuLayer *menu_layer, MenuIndex *cell_index, + void *context) { if (PBL_IF_ROUND_ELSE(true, false)) { const bool is_selected = menu_layer_is_index_selected(menu_layer, cell_index); return is_selected ? MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT : diff --git a/src/util/compat.h b/src/util/compat.h index 9f0e3435..cd0beeb1 100644 --- a/src/util/compat.h +++ b/src/util/compat.h @@ -134,6 +134,14 @@ typedef TextLayout GTextAttributes; graphics_text_layout_get_content_size(text, font, box, overflow_mode, alignment) #endif +#ifndef MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT +#define MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT ((const int16_t) 84) +#endif + +#ifndef MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT +#define MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT ((const int16_t) 24) +#endif + #ifndef menu_layer_set_normal_colors #define menu_layer_set_normal_colors(menu_layer, background_color, text_color) #endif @@ -146,6 +154,13 @@ typedef TextLayout GTextAttributes; #define menu_cell_layer_is_highlighted(cell_layer) (false) #endif +#ifndef menu_layer_is_index_selected +static inline bool menu_layer_is_index_selected(MenuLayer *menu_layer, MenuIndex *cell_index) { + MenuIndex current_index = menu_layer_get_selected_index(menu_layer); + return (current_index.section == cell_index->section && current_index.row == cell_index->row); +} +#endif + //! Convenience macro to use SDK 3.0 function to set a `PropertyAnimation`'s //! `values.from.grect` field. #ifndef property_animation_set_from_grect @@ -170,6 +185,10 @@ void dictation_session_start(DictationSession *session); #define scroll_layer_set_paging(scroll_layer, paging_enabled) #endif +#ifndef STATUS_BAR_LAYER_HEIGHT +#define STATUS_BAR_LAYER_HEIGHT 16 +#endif + #endif // Legacy definitions for basalt on 3.0