示例#1
0
static void menu_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) {
  switch (cell_index->row) {
    case 0:
      next_unit_index();
      break;

    case 1:
      next_format();
      break;

    case 2:
      toggle_first_day();
      break;

    case 3:
      if (!get_has_reminders()) {
        show_time();
      } else {
        set_has_reminders(0);
        cancell_all_reminders();
        menu_layer_reload_data(menu_layer);
      }

      break;

    case 4:
        show_welcome();
        break;
  }

  layer_mark_dirty((Layer *)menu_layer_get_scroll_layer(menu_layer));
}
示例#2
0
static void initialise_ui(void) {
  s_window = window_create();
  window_set_fullscreen(s_window, true);
  window_set_background_color(s_window, COLOUR_WINDOW);
  
  // s_menu
  s_menu = menu_layer_create(layer_get_bounds(window_get_root_layer(s_window)));
  if(watch_info_get_firmware_version().major >= 3) {
    scroll_layer_set_shadow_hidden(menu_layer_get_scroll_layer(s_menu), true);
  }
#ifdef PBL_SDK_3
  menu_layer_set_highlight_colors(s_menu, COLOUR_MENU_HIGHLIGHT_BACKGROUND, COLOUR_MENU_HIGHLIGHT_FOREGROUND);
  menu_layer_set_normal_colors(s_menu, COLOUR_MENU_BACKGROUND, COLOUR_MENU_FOREGROUND);
#endif
  menu_layer_set_click_config_onto_window(s_menu, s_window);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_menu);
}
示例#3
0
static void initialise_ui(void) {
  s_window = window_create();
  window_set_fullscreen(s_window, PBL_IF_ROUND_ELSE(true, false));
  window_set_background_color(s_window, COLOUR_WINDOW);
  
  // s_menu
  s_menu = menu_layer_create(layer_get_bounds(window_get_root_layer(s_window)));
  if(watch_info_get_firmware_version().major >= 3) {
    scroll_layer_set_shadow_hidden(menu_layer_get_scroll_layer(s_menu), true);
  }
  menu_set_colours(s_menu);
#ifdef PBL_ROUND
  menu_layer_set_center_focused(s_menu, true);
#endif
  menu_layer_set_click_config_onto_window(s_menu, s_window);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_menu);
}
示例#4
0
static void nearbyStopsWindow_load(Window *window) {
    Layer *windowLayer = window_get_root_layer(window);
    GRect bounds = layer_get_frame(windowLayer);

    #ifdef PBL_SDK_3
    bounds = GRect(0, 16, 144, 168-16);
    #endif

    s_menuLayer = menu_layer_create(bounds);
    s_scrollLayer = menu_layer_get_scroll_layer(s_menuLayer);
    scroll_layer_set_shadow_hidden(s_scrollLayer, false);

    menu_layer_set_callbacks(s_menuLayer, NULL, (MenuLayerCallbacks) {
        .get_num_sections = menu_get_num_sections_callback,
        .get_num_rows = menu_get_num_rows_callback,
        .get_header_height = menu_get_header_height_callback,
        .draw_header = menu_draw_header_callback,
        .draw_row = menu_draw_row_callback,
        .select_click = menu_select_callback,
        .selection_changed = menu_selection_changed_callback,
    });
static void initialise_ui(void) {
  s_window = window_create();
  window_set_fullscreen(s_window, false);
  window_set_background_color(s_window, COLOUR_WINDOW);
  
  s_res_gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
  s_res_gothic_24 = fonts_get_system_font(FONT_KEY_GOTHIC_24);
  // s_statusbar
  s_statusbar = text_layer_create(GRect(0, 0, 144, 21));
  text_layer_set_background_color(s_statusbar, COLOUR_HEADER);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_statusbar);
  
  // s_train_number
  s_train_number = text_layer_create(GRect(2, -7, 56, 29));
  text_layer_set_background_color(s_train_number, GColorClear);
  text_layer_set_text_color(s_train_number, COLOUR_HEADER_TEXT);
  text_layer_set_text(s_train_number, "#307");
  text_layer_set_font(s_train_number, s_res_gothic_24_bold);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_train_number);
  
  // s_train_type
  s_train_type = text_layer_create(GRect(62, -7, 80, 28));
  text_layer_set_background_color(s_train_type, GColorClear);
  text_layer_set_text_color(s_train_type, COLOUR_HEADER_TEXT);
  text_layer_set_text(s_train_type, "Something");
  text_layer_set_text_alignment(s_train_type, GTextAlignmentRight);
  text_layer_set_font(s_train_type, s_res_gothic_24);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_train_type);
  
  // s_stop_list
  s_stop_list = menu_layer_create(GRect(0, 21, 144, 131));
  #ifdef PBL_COLOR
  menu_hack_disable_inversion(s_stop_list);
  #endif
  if(watch_info_get_firmware_version().major >= 3) {
    scroll_layer_set_shadow_hidden(menu_layer_get_scroll_layer(s_stop_list), true);
  }
  menu_layer_set_click_config_onto_window(s_stop_list, s_window);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_stop_list);
}
static void initialise_ui(void) {
  s_window = window_create();
  window_set_fullscreen(s_window, false);
  window_set_background_color(s_window, COLOUR_WINDOW);
  
  s_res_gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
  s_res_gothic_18 = fonts_get_system_font(FONT_KEY_GOTHIC_18);
  // s_inverterlayer_1
  s_inverterlayer_1 = inverter_layer_create(GRect(0, 0, 144, 35));
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_inverterlayer_1);
  
  // s_direction_layer
  s_direction_layer = text_layer_create(GRect(0, 14, 144, 21));
  text_layer_set_background_color(s_direction_layer, COLOUR_HEADER);
  text_layer_set_text_color(s_direction_layer, COLOUR_HEADER_TEXT);
  text_layer_set_text(s_direction_layer, "Southbound");
  text_layer_set_text_alignment(s_direction_layer, GTextAlignmentCenter);
  text_layer_set_font(s_direction_layer, s_res_gothic_18);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_direction_layer);
  
  // s_stop_name_layer
  s_stop_name_layer = text_layer_create(GRect(0, -8, 144, 28));
  text_layer_set_background_color(s_stop_name_layer, COLOUR_HEADER);
  text_layer_set_text_color(s_stop_name_layer, COLOUR_HEADER_TEXT);
  text_layer_set_text(s_stop_name_layer, "Mountain View");
  text_layer_set_text_alignment(s_stop_name_layer, GTextAlignmentCenter);
  text_layer_set_font(s_stop_name_layer, s_res_gothic_24_bold);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_stop_name_layer);
  
  // s_train_menu
  s_train_menu = menu_layer_create(GRect(0, 35, 144, 117));
  #ifdef PBL_COLOR
  menu_hack_disable_inversion(s_train_menu);
  #endif
  if(watch_info_get_firmware_version().major >= 3) {
    scroll_layer_set_shadow_hidden(menu_layer_get_scroll_layer(s_train_menu), true);
  }
  menu_layer_set_click_config_onto_window(s_train_menu, s_window);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_train_menu);
}
示例#7
0
	GRect menu_bounds = layer_get_bounds(window_layer);
	menu_bounds.size.h = (display_bounds.size.h - 10) - 2;
	multi_code_menu_layer = menu_layer_create(menu_bounds);
	menu_layer_set_click_config_onto_window(multi_code_menu_layer, window);
	menu_layer_set_callbacks(multi_code_menu_layer, NULL, (MenuLayerCallbacks) {
		.get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback)multi_code_menu_get_num_rows_callback,
		.draw_row = (MenuLayerDrawRowCallback)multi_code_menu_draw_row_callback,
		.get_cell_height = (MenuLayerGetCellHeightCallback)multi_code_menu_get_cell_height_callback,
		.select_click = (MenuLayerSelectCallback)multi_code_menu_select_callback,
		.select_long_click = (MenuLayerSelectCallback)multi_code_menu_select_long_callback,
		.draw_header = (MenuLayerDrawHeaderCallback)multi_code_menu_draw_header_callback,
		.get_header_height = (MenuLayerGetHeaderHeightCallback)multi_code_menu_get_header_height_callback,
		.get_num_sections = (MenuLayerGetNumberOfSectionsCallback)multi_code_menu_get_num_sections_callback,
		.selection_changed = (MenuLayerSelectionChangedCallback)multi_code_menu_selection_changed_callback,
	});
	scroll_layer_set_shadow_hidden(menu_layer_get_scroll_layer(multi_code_menu_layer), true);
	layer_add_child(window_layer, menu_layer_get_layer(multi_code_menu_layer));
	menu_layer_set_selected_index(multi_code_menu_layer, MenuIndex(0, otp_selected), MenuRowAlignCenter, false);
	add_countdown_layer(window_layer);
	show_countdown_layer();
	multi_code_apply_display_colors();
}

void multi_code_window_unload(Window *window) {
	menu_layer_destroy(multi_code_menu_layer);
	window_destroy(multi_code_main_window);
	multi_code_main_window = NULL;
}

void multi_code_window_remove(void) {
	window_stack_remove(multi_code_main_window, false);