Пример #1
0
ReplayMenu::ReplayMenu()
  : Menu("menu/bg_play")
  , selected(NULL)
{
  // Center the boxes!
  uint h      = GetMainWindow().GetHeight();
  uint size_y = h-50;
  float z     = size_y/430.0;
  uint border = 5*z;
  uint size_x = GetMainWindow().GetWidth()/19;
  uint w      = 8*size_x - 2*border;
  Font::font_size_t fsize1 = Font::GetFixedSize(z * 18);
  Font::font_size_t fsize2 = Font::GetFixedSize(z * 16);

#define ARG_LIST  fsize1, Font::FONT_BOLD, primary_red_color, Text::ALIGN_LEFT_TOP, true
#define ARG_LIST2 fsize2, Font::FONT_BOLD, dark_gray_color, Text::ALIGN_LEFT_TOP, false

  //Replay files
  VBox *vbox = new VBox(8*size_x, true);
  vbox->SetPosition(size_x, size_y/20);
  widgets.AddWidget(vbox);

  file_box = new VBox(w, false);
  file_box->SetBorder(border);
  file_box->SetSelfBackgroundColor(transparent_color);
  vbox->AddWidget(file_box);
  file_box->AddWidget(new Label(_("Select a replay:"), w, ARG_LIST));

  replay_lbox = new FileListBox(Point2i(w-20, (9*size_y)/10 - fsize1 - 3*5));
  replay_lbox->SetBorder(defaultOptionColorRect, 2);
  // Windows may SFN => uppercase extensions
  replay_lbox->AddExtensionFilter("WRF");
  replay_lbox->AddExtensionFilter("wrf");
  replay_lbox->StartListing();
  file_box->AddWidget(replay_lbox);

  //Info
  vbox = new VBox(8*size_x);
  vbox->SetPosition(10*size_x, size_y/20);
  widgets.AddWidget(vbox);

  info_box = new VBox(w, false);
  info_box->SetBorder(border);
  info_box->SetSelfBackgroundColor(transparent_color);
  vbox->AddWidget(info_box);

  info_box->AddWidget(new Label(_("Replay info"), w, ARG_LIST));

  vbox = new VBox(w-10, true);
  info_box->AddWidget(vbox);

  Box *panel = new VBox(w-10-2*border, false);
  panel->SetBorder(border);
  panel->SetSelfBackgroundColor(transparent_color);
  panel->SetMargin(0);
  vbox->AddWidget(panel);

  // Version
  panel->AddWidget(new Label(_("Version"), w-10, ARG_LIST));
  version_lbl = new Label(" ", w-10, ARG_LIST2);
  panel->AddWidget(version_lbl);

  // Date
  panel->AddWidget(new Label(_("Date"), w-10, ARG_LIST));
  date_lbl = new Label(" ", w-10, ARG_LIST2);
  panel->AddWidget(date_lbl);

  // Duration
  panel->AddWidget(new Label(_("Duration"), w-10, ARG_LIST));
  duration_lbl = new Label(" ", w-20, ARG_LIST2);
  panel->AddWidget(duration_lbl);

  // Comment
  panel->AddWidget(new Label(_("Comment"), w-10, ARG_LIST));
  comment_lbl = new Label(" ", w-10, ARG_LIST2);
  panel->AddWidget(comment_lbl);

  // Teams
  panel->AddWidget(new Label(_("Teams"), w-10, ARG_LIST));
  teams_lbox = new ScrollBox(Point2i(w-10, (9*size_y)/10 - 6*(fsize1+fsize2)- 4*border -2*5));
  panel->AddWidget(teams_lbox);

  widgets.Pack();
}