Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
Add missing status and menu layer definitions for older aplite SDKs
Browse files Browse the repository at this point in the history
  • Loading branch information
Meiguro committed Feb 8, 2016
1 parent 68c8c10 commit cfbad5f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/simply/simply_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 :
Expand Down
19 changes: 19 additions & 0 deletions src/util/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit cfbad5f

Please sign in to comment.