本文整理汇总了C++中BCheckBox::GetPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BCheckBox::GetPreferredSize方法的具体用法?C++ BCheckBox::GetPreferredSize怎么用?C++ BCheckBox::GetPreferredSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BCheckBox
的用法示例。
在下文中一共展示了BCheckBox::GetPreferredSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BMessage
// --------------------------------------------------------------
NetworkSetupWindow::NetworkSetupWindow(const char *title)
:
BWindow(BRect(100, 100, 600, 600), title, B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
BMenu *show_menu;
BMenu *profiles_menu;
BMenuField *menu_field;
BBox *top_box, *bottom_box, *line; // *group
BButton *button;
BCheckBox *check;
BRect r;
float x, w, h;
float size, min_size = 360;
// TODO: cleanup this mess!
show_menu = new BPopUpMenu("<please select me!>");
_BuildShowMenu(show_menu, SHOW_MSG);
#define H_MARGIN 10
#define V_MARGIN 10
#define SMALL_MARGIN 3
// Resize the window to minimal width
ResizeTo(fMinAddonViewRect.Width() + 2 * H_MARGIN, Bounds().Height());
top_box = new BBox(Bounds(), NULL, B_FOLLOW_NONE,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
B_PLAIN_BORDER);
AddChild(top_box);
r = top_box->Bounds();
r.InsetBy(H_MARGIN, V_MARGIN);
// ---- Profiles section
profiles_menu = new BPopUpMenu("<none>");
menu_field = new BMenuField(r, "profiles_menu", PROFILE_LABEL,
profiles_menu);
menu_field->SetFont(be_bold_font);
menu_field->SetDivider(be_bold_font->StringWidth(PROFILE_LABEL "#"));
top_box->AddChild(menu_field);
menu_field->ResizeToPreferred();
menu_field->GetPreferredSize(&w, &h);
size = w;
button = new BButton(r, "manage_profiles", MANAGE_PROFILES_LABEL,
new BMessage(MANAGE_PROFILES_MSG),
B_FOLLOW_TOP | B_FOLLOW_RIGHT);
button->GetPreferredSize(&w, &h);
button->ResizeToPreferred();
button->MoveTo(r.right - w, r.top);
top_box->AddChild(button);
size += SMALL_MARGIN + w;
min_size = max_c(min_size, (H_MARGIN + size + H_MARGIN));
r.top += h + V_MARGIN;
// ---- Separator line between Profiles section and Settings section
line = new BBox(BRect(r.left, r.top, r.right, r.top + 1), NULL,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
top_box->AddChild(line);
_BuildProfilesMenu(profiles_menu, SELECT_PROFILE_MSG);
r.top += 2 + V_MARGIN;
// ---- Settings section
// Make the show popup field half the whole width and centered
menu_field = new BMenuField(r, "show_menu", SHOW_LABEL, show_menu);
menu_field->SetFont(be_bold_font);
menu_field->SetDivider(be_bold_font->StringWidth(SHOW_LABEL "#"));
top_box->AddChild(menu_field);
menu_field->ResizeToPreferred();
menu_field->GetPreferredSize(&w, &h);
r.top += h+1 + V_MARGIN;
min_size = max_c(min_size, (H_MARGIN + w + H_MARGIN));
r = fMinAddonViewRect.OffsetByCopy(H_MARGIN, r.top);
fPanel = new BBox(r, "showview_box", B_FOLLOW_NONE,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
B_PLAIN_BORDER);
top_box->AddChild(fPanel);
top_box->ResizeTo(Bounds().Width(), r.bottom + 1 + V_MARGIN);
// ---- Bottom globals buttons section
r = Bounds();
r.top = top_box->Frame().bottom + 1;
bottom_box = new BBox(r, NULL, B_FOLLOW_NONE,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
B_PLAIN_BORDER);
AddChild(bottom_box);
//.........这里部分代码省略.........