Example #1
0
void window_load(Window *window) {
    updates = 0;

    Menu* menu = window_get_user_data(window);

    Layer *window_layer = window_get_root_layer(window);
    GRect bounds = layer_get_frame(window_layer);

#ifdef PBL_SDK_3
    GRect menu_bounds = GRect(
            bounds.origin.x,
            bounds.origin.y + STATUS_BAR_LAYER_HEIGHT,
            bounds.size.w,
            bounds.size.h - STATUS_BAR_LAYER_HEIGHT
    );
    menu->layer = menu_layer_create(menu_bounds);
    menu->load_layer = bitmap_layer_create(menu_bounds);
#else
    menu->layer = menu_layer_create(bounds);
    menu->load_layer = bitmap_layer_create(bounds);
#endif

    menu_layer_set_callbacks(menu->layer, menu, (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->callbacks.select_click,
            .selection_changed = selection_changed_callback,
    });
Example #2
0
// This initializes the menu upon window load
void replywindow_appear(Window *window) {
    
    ReplyWindow * rw = (ReplyWindow*)window_get_user_data(window);
    
    
    Layer * mainWindowLayer = window_get_root_layer(window);
    
    static char titleText[40];
#ifdef PBL_ROUND
    if ((rw->replyTo!=NULL) && (strlen(rw->replyTo) > 3)) {
        snprintf(titleText,40,"%s", rw->replyTo);
    } else {
        snprintf(titleText,40,"Reply %s", rw->replyTo);        
    }
#else
    snprintf(titleText,40,"Reply %s", rw->replyTo);
#endif
    rw->title_layer = title_layer_create(GRect(0,0,PEBBLE_WIDTH,TITLE_HEIGHT), titleText, ICON_CHAT);
    
    // Create the menu layer
#ifdef PBL_ROUND
    rw->menu_layer = menu_layer_create(GRect(0,0,PEBBLE_WIDTH,PEBBLE_HEIGHT));
#else
    rw->menu_layer = menu_layer_create(GRect(0,TITLE_HEIGHT,PEBBLE_WIDTH,PEBBLE_HEIGHT-TITLE_HEIGHT));
#endif
    // Set all the callbacks for the menu layer
    menu_layer_set_callbacks(rw->menu_layer, rw, (MenuLayerCallbacks){
        .get_num_sections = reply_get_num_sections_callback,
        .get_num_rows = reply_get_num_rows_callback,
        .draw_row = reply_draw_row_callback,
        .select_click = reply_select_callback,
        .get_cell_height = reply_get_cell_height_callback,
    });
Example #3
0
static void window_load(Window *window) {
	Layer *window_layer = window_get_root_layer(window);
	GRect bounds = layer_get_frame(window_layer);
	
	window_set_background_color(window, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));

	#ifdef PBL_COLOR
		#ifdef PBL_ROUND
			s_menu_layer = menu_layer_create(
				GRect(20,0,bounds.size.w - 40, bounds.size.h));
		#else
			s_menu_layer = menu_layer_create(
				GRect(20,0,bounds.size.w - 20, bounds.size.h - 20));
		#endif
	#else
		s_menu_layer = menu_layer_create(
			GRect(0,0,bounds.size.w, bounds.size.h));
	#endif
		
	menu_layer_set_callbacks(s_menu_layer, 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,
		.get_cell_height = menu_get_cell_height_callback,
		.draw_header = menu_draw_header_callback,
		.draw_row = menu_draw_row_callback,
		.select_click = menu_select_callback
	});
Example #4
0
static void main_window_load(Window *window) {
  // Load the custom font
  s_icons = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_ICONS_32));
  s_helvetic_bold = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_HELVETICA_BOLD_20));

  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);

  s_status_bar = status_bar_layer_create();
  status_bar_layer_set_separator_mode(s_status_bar, StatusBarLayerSeparatorModeNone);
  status_bar_layer_set_colors(s_status_bar, GColorBlack, GColorWhite);

  // Create MenuLayer
#if defined(PBL_RECT)
  s_menu_layer = menu_layer_create(GRect(0, STATUS_BAR_LAYER_HEIGHT, bounds.size.w, bounds.size.h));
#elif defined(PBL_ROUND)
  s_menu_layer = menu_layer_create(bounds);
#endif
  menu_layer_set_callbacks(s_menu_layer, NULL, (MenuLayerCallbacks) {
      .get_num_sections = (MenuLayerGetNumberOfSectionsCallback)get_num_sections_callback,
      .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback)get_num_rows_callback,
      .get_cell_height = (MenuLayerGetCellHeightCallback)get_cell_height_callback,
      .get_header_height = (MenuLayerGetHeaderHeightCallback)get_header_height_callback,
      .draw_row = (MenuLayerDrawRowCallback)draw_row_callback,
      .draw_header = (MenuLayerDrawHeaderCallback)draw_header_callback,
      .select_click = (MenuLayerSelectCallback)select_callback,
  });
Example #5
0
//Loads main_window
static void main_window_load(Window *window) {
  // Here we load the bitmap assets
  s_menu_icons[0] = gbitmap_create_with_resource(RESOURCE_ID_VERYGOOD);
  s_menu_icons[1] = gbitmap_create_with_resource(RESOURCE_ID_GOOD);
  s_menu_icons[2] = gbitmap_create_with_resource(RESOURCE_ID_MED);
  s_menu_icons[3] = gbitmap_create_with_resource(RESOURCE_ID_BAD);
  s_menu_icons[4] = gbitmap_create_with_resource(RESOURCE_ID_VERYBAD);
  s_menu_icons[5] = gbitmap_create_with_resource(RESOURCE_ID_EXAMPLE1);


  // Now we prepare to initialize the menu layer
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_frame(window_layer);

  //if user presses BACK, the app exits
  window_set_click_config_provider(window, back_click_config_provider);

  // Create the menu layer
  s_menu_layer = menu_layer_create(bounds);
  menu_layer_set_callbacks(s_menu_layer, NULL, (MenuLayerCallbacks){
    .get_num_rows = menu_get_num_rows_callback,
    .get_header_height = PBL_IF_RECT_ELSE(menu_get_header_height_callback, NULL),
    .draw_header = PBL_IF_RECT_ELSE(menu_draw_header_callback, NULL),
    .draw_row = menu_draw_row_callback,
    .select_click = menu_select_callback,
    .get_cell_height = PBL_IF_ROUND_ELSE(get_cell_height_callback, NULL),
  });
Example #6
0
MenuIndex get_current_session_from_time() {
    time_t now = time(NULL);
    struct tm *tm_now = localtime(&now);
    MenuIndex current = {.section = 0, .row = 0};
    if (tm_now->tm_mon != event_month - 1 || tm_now->tm_mday != event_day) {
        return current;
    }
    for(int ts_idx=0; ts_idx<schedule.num_slots; ts_idx++) {
        TimeSlot *ts = &schedule.slots[ts_idx];
        if (tm_now->tm_hour < ts->start_hour) {
            break;
        } else if(tm_now->tm_hour == ts->start_hour && tm_now->tm_min < ts->start_min) {
            break;
        }
        current.section = ts_idx;
    }
    return current;
}

MenuIndex get_current_session_from_args() {
    int args = launch_get_args();
    MenuIndex current = {.section = args / 10, .row = args % 10};
    return current;
}

MenuIndex get_current_session() {
    #ifdef PBL_COLOR
    if (launch_reason() == APP_LAUNCH_TIMELINE_ACTION && launch_get_args() > 0) {
        return get_current_session_from_args();
    }
    #endif
    return get_current_session_from_time();
}

static void main_window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_frame(window_layer);

  menu_schedule = menu_layer_create(bounds);

  #ifdef PBL_COLOR
  menu_layer_set_normal_colors(menu_schedule, ROW_BG_COLOR, ROW_FG_COLOR);
  menu_layer_set_highlight_colors(menu_schedule, HIGHLIGHT_BG_COLOR, HIGHLIGHT_FG_COLOR);
  #endif

  menu_layer_set_callbacks(menu_schedule, 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,
    .get_cell_height = menu_get_height_callback,
    .draw_header = menu_draw_header_callback,
    .draw_row = menu_draw_row_callback,
    .select_click = menu_select_callback,
  });

  menu_layer_set_click_config_onto_window(menu_schedule, window);
  MenuIndex idx = get_current_session();
  menu_layer_set_selected_index(menu_schedule, idx, MenuRowAlignCenter, false);
  layer_add_child(window_layer, menu_layer_get_layer(menu_schedule));
}
static void main_window_load(Window *window) {
	Layer *window_layer;
	GRect window_bounds;

	window_set_background_color(window, COLOR_WINDOW_BG);

	window_layer = window_get_root_layer(window);
	window_bounds = layer_get_bounds(window_layer);

	APP_LOG(APP_LOG_LEVEL_INFO, "bounds of window: %d,%d:%d,%d",
			window_bounds.origin.x, window_bounds.origin.y,
			window_bounds.size.w, window_bounds.size.h);

	main_menu_layer = menu_layer_create(window_bounds);
#ifdef PBL_SDK_3
	menu_layer_set_highlight_colors(main_menu_layer, COLOR_MENU_BG, COLOR_MENU_FG);
	menu_layer_set_normal_colors(main_menu_layer, COLOR_MENU_BG_HL, COLOR_MENU_FG_HL);
#endif
	menu_layer_set_click_config_onto_window(main_menu_layer, window);
	layer_add_child(window_layer, menu_layer_get_layer(main_menu_layer));

	menu_layer_set_callbacks(main_menu_layer, NULL, (MenuLayerCallbacks) {
		.get_header_height = main_menu_header_height,
		.draw_header = main_menu_header,
		.draw_row = main_menu_draw_row,
		.get_num_rows = main_menu_num_rows,
		.select_click = main_menu_select_click,
	});
Example #8
0
static void main_window_load(Window *window) {
  // Here we load the bitmap assets
  /*
  s_menu_icons[0] = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MENU_ICON_BIG_WATCH);
  s_menu_icons[1] = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MENU_ICON_SECTOR_WATCH);
  s_menu_icons[2] = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_MENU_ICON_BINARY_WATCH);
  */

  // And also load the background
  //s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BACKGROUND_BRAINS);
  
  //init list of books:
  int i;
  for (i=0; i<NUM_FIRST_MENU_ITEMS; i++){
    snprintf(book_list[i].name, sizeof(book_list[i].name), "Book %d", i+1);
  }
  //if data was saved, read it:
  load_items(); 
  

  // Now we prepare to initialize the menu layer
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_frame(window_layer);

  // Create the menu layer
  s_menu_layer = menu_layer_create(bounds);
  menu_layer_set_callbacks(s_menu_layer, 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,
  });
Example #9
0
void window_load(Window *me) {
	Layer *window_layer = window_get_root_layer(me);
	switch (current_level) {
		case 0:
		case 1:
		if (current_level == 1)
			for (int i = 0; i < item_count; i++)
				memset(item_names[i], 0, TITLE_SIZE);
			menu_layer[current_level] = menu_layer_create(layer_get_bounds(window_layer));
			menu_layer_set_callbacks(menu_layer[current_level], NULL, (MenuLayerCallbacks){
				.get_cell_height = menu_get_cell_height_callback,
				.get_num_rows = menu_get_num_rows_callback,
				.draw_row = menu_draw_row_callback,
				.select_click = menu_select_callback,
			});
			menu_layer_set_click_config_onto_window(menu_layer[current_level], me);
			layer_set_hidden(menu_layer_get_layer(menu_layer[current_level]), true);
			layer_add_child(window_layer, menu_layer_get_layer(menu_layer[current_level]));
			break;
		case 2:
			messageheader_layer = text_layer_create(GRect(0, 0, 144, INT16_MAX));
			messageseparator_layer = inverter_layer_create(GRect(0, 0, 144, INT16_MAX));
			messagetext_layer = text_layer_create(GRect(0, 0, 144, INT16_MAX));
			message_layer = scroll_layer_create(layer_get_bounds(window_layer));
			scroll_layer_add_child(message_layer, text_layer_get_layer(messageheader_layer));
			scroll_layer_add_child(message_layer, inverter_layer_get_layer(messageseparator_layer));
			scroll_layer_add_child(message_layer, text_layer_get_layer(messagetext_layer));
			scroll_layer_set_callbacks(message_layer, (ScrollLayerCallbacks){
				.click_config_provider = message_click_config_provider
			});
static void window_load(Window *me) {
	callHistoryIcon = gbitmap_create_with_resource(RESOURCE_ID_CALL_HISTORY);
	contactsIcon = gbitmap_create_with_resource(RESOURCE_ID_CONTACTS);
	contactGroupIcon = gbitmap_create_with_resource(RESOURCE_ID_CONTACT_GROUP);

	Layer* topLayer = window_get_root_layer(me);

	loadingLayer = text_layer_create(GRect(0, STATUSBAR_Y_OFFSET, SCREEN_WIDTH, HEIGHT_BELOW_STATUSBAR));
	text_layer_set_text_alignment(loadingLayer, GTextAlignmentCenter);
	text_layer_set_text(loadingLayer, "Loading...");
	text_layer_set_font(loadingLayer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
	layer_add_child(topLayer, (Layer*) loadingLayer);

	quitTitle = text_layer_create(GRect(0, 70 + STATUSBAR_Y_OFFSET, SCREEN_WIDTH, 50));
	text_layer_set_text_alignment(quitTitle, GTextAlignmentCenter);
	text_layer_set_text(quitTitle, "Press back again if app does not close in several seconds");
	layer_add_child(topLayer, (Layer*) quitTitle);

	quitText = text_layer_create(GRect(0, 10 + STATUSBAR_Y_OFFSET, SCREEN_WIDTH, 50));
	text_layer_set_text_alignment(quitText, GTextAlignmentCenter);
	text_layer_set_text(quitText, "Quitting...\n Please wait");
	text_layer_set_font(quitText, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
	layer_add_child(topLayer, (Layer*) quitText);

	menuLayer = menu_layer_create(GRect(0, STATUSBAR_Y_OFFSET, SCREEN_WIDTH, HEIGHT_BELOW_STATUSBAR));

	// Set all the callbacks for the menu layer
	menu_layer_set_callbacks(menuLayer, NULL, (MenuLayerCallbacks){
			.get_num_sections = menu_get_num_sections_callback,
			.get_num_rows = menu_get_num_rows_callback,
			.draw_row = menu_draw_row_callback,
			.select_click = menu_select_callback,
	});
Example #11
0
void window_load(Window *window)
{
  // Create time TextLayer
  window_layer = text_layer_create(GRect(0, 15, 144, 50));
  text_layer_set_background_color(window_layer, GColorClear);
  text_layer_set_text_color(window_layer, GColorBlack);
  text_layer_set_text(window_layer, "Article Topics");
  
  // Improve the layout to be more like a watchface
  text_layer_set_font(window_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
  text_layer_set_text_alignment(window_layer, GTextAlignmentCenter);

  // Add it as a child layer to the Window's root layer
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(window_layer));
  
  
  // Menu Layer
  //Create it - 12 is approx height of the top bar
  menu_layer = menu_layer_create(GRect(0, 55, 144, 113 - 16));
 
  //Let it receive clicks
  menu_layer_set_click_config_onto_window(menu_layer, window);
 
  //Give it its callbacks
  MenuLayerCallbacks callbacks = {
      .draw_row = (MenuLayerDrawRowCallback) draw_row_callback,
      .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback) num_rows_callback,
      .select_click = (MenuLayerSelectCallback) select_click_callback
  };
  menu_layer_set_callbacks(menu_layer, NULL, callbacks);
  //Add to Window
  layer_add_child(window_get_root_layer(window), menu_layer_get_layer(menu_layer));
  // Menu Layer
  
}
Example #12
0
static void main_window_load(Window *window) {
  // Grab user data 
  MainMenuData *data = window_get_user_data(window);
  
  // Icons for main menu
  data->icons[0] = gbitmap_create_with_resource(RESOURCE_ID_TELEVISION);
  data->icons[1] = gbitmap_create_with_resource (RESOURCE_ID_BOOK);
  
  // Categories for main menu
  data->categories[0] = "Anime";
  data->categories[1] = "Manga";
  
  // Setup main menu
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);
  data->layer = menu_layer_create(bounds);

  menu_layer_set_callbacks(data->layer, data, (MenuLayerCallbacks) {
    .get_num_rows = menu_layer_get_num_rows_callback,
    .get_num_sections = menu_layer_get_num_sections_callback,
    .get_header_height = menu_get_header_height_callback,
    .draw_header = menu_draw_header_callback,
    .draw_row = menu_layer_draw_row_callback,
    .get_cell_height = menu_layer_get_cell_height_callback,
    .select_click = menu_layer_select_click_callback
  });
Example #13
0
static void window_load(Window *window)
{ 
  char * buff = (char*)malloc(100 * sizeof(char*));
  if(amount > 1) snprintf(buff, 100, "Are you sure you want to send $%2d.00 to %s?", (int)amount, cont_name);
  else snprintf(buff, 100, "Are you sure you want to send $0.10 to %s?", cont_name);
  tlayer = text_layer_create(GRect(0, 0, 144, 55 + 12));
  text_layer_set_text(tlayer, buff);
  text_layer_set_background_color(tlayer, GColorClear);
  text_layer_set_text_color(tlayer, GColorBlack);
  text_layer_set_text_alignment(tlayer, GTextAlignmentCenter);
  text_layer_set_font(tlayer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(tlayer));
  
  menu_layer = menu_layer_create(GRect(0, 55 + 12, 144, 152 - 55 - 12));
  menu_layer_set_click_config_onto_window(menu_layer, cpay_window);
  MenuLayerCallbacks callbacks = {
    .draw_row = (MenuLayerDrawRowCallback) draw_row_callback,
    .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback) num_rows_callback,
    .select_click = (MenuLayerSelectCallback) select_click_callback,
  };
  menu_layer_set_callbacks(menu_layer, NULL, callbacks);
  layer_add_child(window_get_root_layer(cpay_window), menu_layer_get_layer(menu_layer));
  free(buff);
}
 
void cpay_deinit()
{
  window_push--;
  window_destroy(cpay_window);
  menu_layer_destroy(menu_layer);
}
Example #14
0
static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);

	s_icon_bitmap_menu_1 = gbitmap_create_with_resource(RESOURCE_ID_SUB_MENU_1);
	s_icon_bitmap_menu_2 = gbitmap_create_with_resource(RESOURCE_ID_SUB_MENU_2);
	s_icon_bitmap_menu_3 = gbitmap_create_with_resource(RESOURCE_ID_SUB_MENU_3);
	s_icon_bitmap_menu_4 = gbitmap_create_with_resource(RESOURCE_ID_SUB_MENU_4);
	s_icon_bitmap_menu_5 = gbitmap_create_with_resource(RESOURCE_ID_SUB_MENU_5);
	s_icon_bitmap_menu_6 = gbitmap_create_with_resource(RESOURCE_ID_SUB_MENU_6);
	s_icon_bitmap_menu_7 = gbitmap_create_with_resource(RESOURCE_ID_SUB_MENU_7);
	s_icon_bitmap_menu_8 = gbitmap_create_with_resource(RESOURCE_ID_SUB_MENU_8);
	s_icon_bitmap_menu_9 = gbitmap_create_with_resource(RESOURCE_ID_SUB_MENU_9);

  s_menu_layer = menu_layer_create(bounds);
  menu_layer_set_click_config_onto_window(s_menu_layer, window);
  menu_layer_set_callbacks(s_menu_layer, NULL, (MenuLayerCallbacks) {
      .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback)get_num_rows_callback,
      .draw_row = (MenuLayerDrawRowCallback)draw_row_callback,
      .get_cell_height = (MenuLayerGetCellHeightCallback)get_cell_height_callback,
      .select_click = (MenuLayerSelectCallback)select_callback,
      .draw_header = (MenuLayerDrawHeaderCallback)draw_header_callback,
      .get_header_height = (MenuLayerGetHeaderHeightCallback)get_header_height_callback,
      .get_num_sections = (MenuLayerGetNumberOfSectionsCallback)get_num_sections_callback,
  });
static void initialise_ui(void) {
  s_window = window_create();
  window_set_fullscreen(s_window, false);
  
  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_stop_name_layer
  s_stop_name_layer = text_layer_create(GRect(0, -7, 144, 29));
  text_layer_set_background_color(s_stop_name_layer, GColorClear);
  text_layer_set_text_color(s_stop_name_layer, GColorWhite);
  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_direction_layer
  s_direction_layer = text_layer_create(GRect(0, 14, 144, 19));
  text_layer_set_background_color(s_direction_layer, GColorClear);
  text_layer_set_text_color(s_direction_layer, GColorWhite);
  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_train_menu
  s_train_menu = menu_layer_create(GRect(0, 35, 144, 117));
  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);
}
static void initialise_ui(void) {
  s_window = window_create();
  window_set_fullscreen(s_window, 0);
  
  // question_menu_layer
  question_menu_layer = menu_layer_create(GRect(0, 0, 144, 168));
  menu_layer_set_click_config_onto_window(question_menu_layer, s_window);
  layer_add_child(window_get_root_layer(s_window), (Layer *)question_menu_layer);
}
/*
 * Main window load callback
 */
static void main_window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);

  menu_layer = menu_layer_create(layer_get_bounds(window_layer));
  menu_layer_set_callbacks(menu_layer, pebble_fonts, menu_callbacks);
  menu_layer_set_click_config_onto_window(menu_layer, window);

  layer_add_child(window_layer, menu_layer_get_layer(menu_layer));
}
static void initialise_ui(void) {
  s_window = window_create();
  window_set_fullscreen(s_window, false);
  
  // language_menu_layer
  language_menu_layer = menu_layer_create(GRect(0, 0, 144, 152));
  menu_layer_set_click_config_onto_window(language_menu_layer, s_window);
  layer_add_child(window_get_root_layer(s_window), (Layer *)language_menu_layer);
}
Example #19
0
void mainWindow_load(Window *window){
	mainMenu = menu_layer_create(GRect(0, 0, 144, 168));
	menu_layer_set_callbacks(mainMenu, 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,
    });
Example #20
0
/*
 * This initializes the menu upon window load
 */
static void window_load(Window *window) {
  menu_icons[0] = gbitmap_create_with_resource(RESOURCE_ID_RECALL_ICON);
  menu_icons[1] = gbitmap_create_with_resource(RESOURCE_ID_SAVE_ICON);
 
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_frame(window_layer);

  menu_layer = menu_layer_create(bounds);

  menu_layer_set_callbacks(menu_layer, 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, });
Example #21
0
//----- Begin main menu window load/unload
static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect frame = layer_get_frame(window_layer);

  menu_layer_main_menu = menu_layer_create(frame);
  menu_layer_set_click_config_onto_window(menu_layer_main_menu, window);
  menu_layer_set_callbacks(menu_layer_main_menu, NULL, menu_layer_callbacks);
  
  layer_add_child(window_layer, menu_layer_get_layer(menu_layer_main_menu));
}
Example #22
0
static void menu_window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);

  s_menu_layer = menu_layer_create(bounds);
  menu_layer_set_callbacks(s_menu_layer, NULL, (MenuLayerCallbacks){
    .get_num_rows = get_menu_sections_count_callback,
    .get_cell_height = get_menu_cell_height_callback,
    .draw_row = draw_menu_row_handler,
    .select_click = menu_select_callback
  }); 
Example #23
0
static void tl_window_load(Window *wnd) {
	Layer *wnd_layer = window_get_root_layer(wnd);
	GRect bounds = layer_get_bounds(wnd_layer);

	mlTasklists = menu_layer_create(bounds);
	assert_oom(mlTasklists, "OOM while creating menu layer");
	menu_layer_set_callbacks(mlTasklists, NULL, (MenuLayerCallbacks) {
		.draw_row = tl_draw_row_cb,
		.get_num_rows = tl_get_num_rows_cb,
		.select_click = tl_select_click_cb,
	});
Example #24
0
static void window_load(Window* window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect window_frame = layer_get_frame(window_layer);
  menu_layer = menu_layer_create(window_frame);
  menu_layer_set_callbacks(menu_layer, NULL, (MenuLayerCallbacks) {
    .get_cell_height = (MenuLayerGetCellHeightCallback) get_cell_height_callback,
    .draw_row = (MenuLayerDrawRowCallback) draw_row_callback,
    .get_num_rows = (MenuLayerGetNumberOfRowsInSectionsCallback) get_num_rows_callback,
    .select_click = (MenuLayerSelectCallback) select_callback,
    .select_long_click = (MenuLayerSelectCallback) select_long_callback
  });
Example #25
0
File: menu.c Project: nmittu/MNotes
void menu_window_load(){
	Layer *mLayer = window_get_root_layer(window);
	GRect bounds = layer_get_bounds(mLayer);
	
	menuL = menu_layer_create(bounds);
	menu_layer_set_callbacks(menuL, NULL, (MenuLayerCallbacks){
		.get_num_rows = get_num_rows,
		.draw_row  = draw_rows,
		.select_click  = selected,
		.select_long_click = long_selected
	});
Example #26
0
static void initialise_ui(void) {
  s_window = window_create();
  #ifndef PBL_SDK_3
    window_set_fullscreen(s_window, true);
  #endif
  
  // action_menu
  action_menu = menu_layer_create(GRect(0, 0, 144, 96));
  menu_layer_set_click_config_onto_window(action_menu, s_window);
  layer_add_child(window_get_root_layer(s_window), (Layer *)action_menu);
}
Example #27
0
static void initialise_ui(void) {
  s_window = window_create();
  IF_2(window_set_fullscreen(s_window, true));
  s_header_font = fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD);
  
  // settings_layer
  settings_layer = menu_layer_create(GRect(0, 0, 144, 168));
  menu_layer_set_click_config_onto_window(settings_layer, s_window);
  IF_3(menu_layer_set_normal_colors(settings_layer, GColorBlack, GColorWhite)); 
  IF_3(menu_layer_set_highlight_colors(settings_layer, GColorBlueMoon, GColorWhite));
  layer_add_child(window_get_root_layer(s_window), (Layer *)settings_layer);
}
Example #28
0
// This initializes the menu upon window load
void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_frame(window_layer);

  // Create the menu layer
  menu_layer = menu_layer_create(bounds);

  // Set all the callbacks for the menu layer
  menu_layer_set_callbacks(menu_layer, NULL, (MenuLayerCallbacks){
    .get_num_rows = menu_get_num_rows_callback,
    .draw_row = menu_draw_row_callback,
  });
Example #29
0
static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_frame(window_layer);
  menu_layer = menu_layer_create(bounds);
  menu_layer_set_callbacks(menu_layer, 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,
  });
Example #30
0
static void category_window_load(Window *window) {
  // Get the root layer
  Layer *category_window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(category_window_layer);

  // Create menu layer
  s_category_menu_layer = menu_layer_create(bounds);
  menu_layer_set_highlight_colors(s_category_menu_layer, GColorYellow, GColorBlack);
  menu_layer_set_callbacks(s_category_menu_layer, NULL, (MenuLayerCallbacks) {
    .get_num_rows = category_menu_get_num_rows_callback,
    .draw_row = category_menu_draw_row_callback,
    .select_click = category_menu_select_callback
  });