static void tl_draw_row_cb(GContext *ctx, const Layer *cell_layer, MenuIndex *idx, void *context) { char *title; if(tl_max_count == 0) // empty list title = "No tasklists! Please create one from phone/PC"; else if(idx->row >= tl_count) // no such item (yet?) title = "<...>"; else if(tl_items[idx->row].title) title = tl_items[idx->row].title; else title = "<OOM>"; #ifdef PBL_COLOR if(!menu_layer_is_index_selected(mlTasklists, idx) && idx->row == ts_current_if_complete()) { graphics_context_set_fill_color(ctx, GColorPastelYellow); GRect bounds = layer_get_bounds(cell_layer); graphics_fill_rect(ctx, bounds, 0, GCornerNone); } #endif #ifdef PBL_ROUND // this uses smaller font but properly centers text menu_cell_basic_draw(ctx, cell_layer, title, NULL, NULL); #else // this doesn't center text but uses bigger font which is good menu_cell_title_draw(ctx, cell_layer, title); #endif }
static int16_t prv_menu_layer_get_cell_height(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) { if (menu_layer_is_index_selected(menu_layer, cell_index)) { return MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT; } else { return MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT; } }
static int16_t get_cell_height_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) { if (menu_layer_is_index_selected(menu_layer, cell_index)) { switch (cell_index->row) { case 0: return MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT; break; default: return MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT; } } else { return MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT; } }
static int16_t get_cell_height_callback(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { return menu_layer_is_index_selected(menu_layer, cell_index) ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT : MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT; }
static int16_t get_cell_height_callback(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { return PBL_IF_ROUND_ELSE( menu_layer_is_index_selected(menu_layer, cell_index) ? MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT : MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT, CHECKBOX_WINDOW_CELL_HEIGHT_DEP); }
static void draw_menu_item(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, const char* title, const char* subtitle) { menu_cell_basic_draw(ctx, cell_layer, title, PBL_IF_ROUND_ELSE( menu_layer_is_index_selected(s_menulayer_1, cell_index) ? subtitle : NULL, subtitle), NULL); }