Exemple #1
0
void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  switch(active_section)
  {
    case MENU_SECTION_MAIN:
      {
        if (cell_index->row >= last_item_index(MENU_SECTION_MAIN))
        {
          menu_cell_title_draw(ctx, cell_layer, EXIT_TEXT);
          return;
        }
        menu_cell_title_draw(ctx, cell_layer, menu_main_items[cell_index->row]);
        return;
      }
    case MENU_SECTION_ATTACK:
      {
        if (cell_index->row >= last_item_index(MENU_SECTION_ATTACK))
        {
          menu_cell_title_draw(ctx, cell_layer, EXIT_TEXT);
          return;
        }
        menu_cell_title_draw(ctx, cell_layer, monster_get_attack_name((Monster*)data, cell_index->row));
        return;
      }
  }
  return;
}
Exemple #2
0
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
}
// This is the menu item draw callback where you specify what each item should look like
static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  char str[64];
  if (current_type == SETUP) {
    if (cell_index->row == 0) {
      snprintf(str, 64, "ENABLE Tilt Scroll");
    }
    else if (cell_index->row == 1) {
      snprintf(str, 64, "DISABLE Tilt Scroll");
    }
  }
  else if (current_type == RESULTS) {
    if (cell_index->row < NUM_TRIALS * 2) {
      snprintf(str, 64, "Trial %d Time: %llu ms", cell_index->row, time_results[cell_index->row]);
    }
    else {
      snprintf(str, 64, "Trial %d Acc: %d", cell_index->row - (NUM_TRIALS * 2), accuracy_results[cell_index->row - (NUM_TRIALS * 2)]);
    }
  }
  else if (cell_index->row == 0) {
    switch (current_type) {
      case PRACTICE_KNOWN:
        snprintf(str, 64, "Select Item %d", practice_known);
        break;
      case TRIAL_KNOWN:
        snprintf(str, 64, "Select Item %d", known_trials[trial_num]);
        break;
      case PRACTICE_UNKNOWN:
      case TRIAL_UNKNOWN:
        snprintf(str, 64, "Select Item \"*****NEXT\"");
        break;
      default:
        break;
    }
  }
  else {
    switch (current_type) {
      case PRACTICE_UNKNOWN:
      case TRIAL_UNKNOWN:
        if (cell_index->row == unknown_trials[trial_num]) {
          snprintf(str, 64, "*****NEXT");
        }
        else {
          snprintf(str, 64, "Item");
        }
        break;
      case PRACTICE_KNOWN:
      case TRIAL_KNOWN:
        snprintf(str, 64, "Item %d", cell_index->row);
        break;
      default:
        break;
    }
  }
  menu_cell_title_draw(ctx, cell_layer, str);
}
Exemple #4
0
void draw_row
(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *callback_context)
{
  uint16_t row_num = cell_index->row;
  char* base_str = "Row ";

  char title[10];
  strcpy(title, base_str);
  strcat(title,itoa_alt(row_num+1));

  // just use the built-in method for now:
  menu_cell_title_draw(ctx,cell_layer, title);
}
Exemple #5
0
//This actually draws the titles or subtitles to the text boxes used in the menu
static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  switch (cell_index->section) {
    case 0:
    switch (cell_index->row) {
      case 0:
      menu_cell_title_draw(ctx, cell_layer, "Place Order");
      break;
      case 1:
      menu_cell_basic_draw(ctx, cell_layer, "Check Card", "Balance", NULL);
      break;
      case 2:
      menu_cell_basic_draw(ctx, cell_layer, "Find Closest", "BariBucks", NULL);
      break;
      case 3:
      menu_cell_title_draw(ctx, cell_layer, "Change Name");
      break;
      case 4:
      menu_cell_title_draw(ctx, cell_layer, "Reload Balance");
      break;

    }
    break;
  }
}
static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  // Determine which section we're going to draw in
  switch (cell_index->section) {
    case 0:
      // Use the row to specify which item we'll draw
      switch (cell_index->row) {
        case 0:
          // This is a basic menu item with a title and subtitle
          menu_cell_basic_draw(ctx, cell_layer, "Basic Item", "With a subtitle", NULL);
          break;
        case 1:
          // This is a basic menu icon with a cycling icon
          menu_cell_basic_draw(ctx, cell_layer, "Icon Item", "Select to cycle", s_menu_icons[s_current_icon]);
          break;
        case 2: 
          {
            // Here we use the graphics context to draw something different
            // In this case, we show a strip of a watchface's background
            GSize size = layer_get_frame(cell_layer).size;
            const uint8_t x_offset = (size.w - gbitmap_get_bounds(s_background_bitmap).size.w) / 2;
            graphics_draw_bitmap_in_rect(ctx, s_background_bitmap, GRect(x_offset, 0, size.w, size.h));
          }
          break;
      }
      break;
    case 1:
      switch (cell_index->row) {
        case 0:
          {
          // There is title draw for something more simple than a basic menu item
#ifdef PBL_RECT
          menu_cell_title_draw(ctx, cell_layer, "Final Item");
#else
          GSize size = layer_get_frame(cell_layer).size;
          graphics_draw_text(ctx, "Final Item", fonts_get_system_font(FONT_KEY_GOTHIC_28),
                             GRect(0, 0, size.w, size.h), GTextOverflowModeTrailingEllipsis, 
                             GTextAlignmentCenter, NULL);
#endif
          }
          break;
      }
  }
}
// This is the menu item draw callback where you specify what each item should look like
static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  // Determine which section we're going to draw in
  switch (cell_index->section) {
    case 0:
      // Use the row to specify which item we'll draw
      switch (cell_index->row) {
        case 0:
          // This is a basic menu item with a title and subtitle
          menu_cell_basic_draw(ctx, cell_layer, "Workout", status[status1], menu_icons1[current_icon1]);
          break;

        case 1:
          // This is a basic menu icon with a cycling icon
          menu_cell_basic_draw(ctx, cell_layer, "Sleep", status[status2] , menu_icons2[current_icon2]);
          break;
        
        
        case 2:
          // This is a basic menu icon with a cycling icon
          menu_cell_basic_draw(ctx, cell_layer, "Export Data", "Last Export: 4/19/2014", NULL);
          break;
        
       

        
      //  case 2:
          // Here we use the graphics context to draw something different
          // In this case, we show a strip of a watchface's background
      //    graphics_draw_bitmap_in_rect(ctx, menu_background,
      //        (GRect){ .origin = GPointZero, .size = layer_get_frame((Layer*) cell_layer).size });
      //    break;
      }
      break;

    case 1:
      switch (cell_index->row) {
        case 0:
          // There is title draw for something more simple than a basic menu item
          menu_cell_title_draw(ctx, cell_layer, event[eventNumber]);
          break;
      }
  }
}
Exemple #8
0
// DRAW MENU ITEMS
static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  switch (cell_index->section) {
    case 0:
      switch (cell_index->row) {
        case 0:
          menu_cell_title_draw(ctx, cell_layer, "On");
          break;

        case 1:
          menu_cell_title_draw(ctx, cell_layer, "Off");
          break;
      }
      break;

    case 1:
      switch (cell_index->row) {
        case 0:
          menu_cell_title_draw(ctx, cell_layer, "25%");
          break;

        case 1:
          menu_cell_title_draw(ctx, cell_layer, "50%");
          break;

        case 2:
          menu_cell_title_draw(ctx, cell_layer, "75%");
          break;

        case 3:
          menu_cell_title_draw(ctx, cell_layer, "100%");
          break;
      }
    break;
    
    case 2:
      switch (cell_index->row) {
        case 0:
          menu_cell_title_draw(ctx, cell_layer, "Link Device");
          break;
      }
  }
}
Exemple #9
0
static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  // Determine which section we're going to draw in
  menu_cell_title_draw(ctx, cell_layer, speeds[cell_index->row].level);
}
// This is the menu item draw callback where you specify what each item should look like
static void menu_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
    // Determine which section we're going to draw in
    switch (cell_index->section) {
    case 0:
        switch (workout_state) {
        case STATE_NOT_ACTIVE:
            switch (cell_index->row) {
            case 0:
                menu_cell_title_draw(ctx, cell_layer, "Start New");
                break;
            default:
                break;
            }
            break;
        case STATE_ACTIVE:
            switch (cell_index->row) {
            case 0:
                menu_cell_title_draw(ctx, cell_layer, "Continue");
                break;

            case 1:
                menu_cell_title_draw(ctx, cell_layer, "End (Save)");
                break;

            case 2:
                menu_cell_title_draw(ctx, cell_layer, "Cancel");
                break;
            default:
                break;
            }
            break;
        case STATE_FINISHED:
            switch (cell_index->row) {
            case 0:
                menu_cell_title_draw(ctx, cell_layer, "View");
                break;

            case 1:
                menu_cell_title_draw(ctx, cell_layer, "End (Save)");
                break;

            case 2:
                menu_cell_title_draw(ctx, cell_layer, "Cancel");
                break;
            default:
                break;
            }
            break;

        }
        break;

    case 1:
        switch (cell_index->row) {
        case 0:
            // There is title draw for something more simple than a basic menu item
            menu_cell_title_draw(ctx, cell_layer, "Prepare");
            break;

        case 1:
            menu_cell_basic_draw(ctx, cell_layer, "Upload workouts", upload_status_str, NULL);
            break;
        default:
            break;
        }
    default:
        break;
    }
}