本文整理汇总了C++中Box::AddWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ Box::AddWidget方法的具体用法?C++ Box::AddWidget怎么用?C++ Box::AddWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box
的用法示例。
在下文中一共展示了Box::AddWidget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Menu
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();
}