本文整理汇总了C++中BButton::Bounds方法的典型用法代码示例。如果您正苦于以下问题:C++ BButton::Bounds方法的具体用法?C++ BButton::Bounds怎么用?C++ BButton::Bounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BButton
的用法示例。
在下文中一共展示了BButton::Bounds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bounds
DocInfoWindow::DocInfoWindow(BMessage *docInfo)
: HWindow(BRect(0, 0, 400, 250), "Document Information", B_TITLED_WINDOW_LOOK,
B_MODAL_APP_WINDOW_FEEL, B_NOT_MINIMIZABLE),
fDocInfo(docInfo)
{
BRect bounds(Bounds());
BView *background = new BView(bounds, "bachground", B_FOLLOW_ALL, B_WILL_DRAW);
background->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(background);
bounds.InsetBy(10.0, 10.0);
BButton *button = new BButton(bounds, "ok", "OK", new BMessage(OK_MSG),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
background->AddChild(button);
button->ResizeToPreferred();
button->MoveTo(bounds.right - button->Bounds().Width(),
bounds.bottom - button->Bounds().Height());
BRect buttonFrame(button->Frame());
button = new BButton(buttonFrame, "cancel", "Cancel", new BMessage(CANCEL_MSG),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
background->AddChild(button);
button->ResizeToPreferred();
button->MoveTo(buttonFrame.left - (button->Bounds().Width() + 10.0),
buttonFrame.top);
bounds.bottom = buttonFrame.top - 10.0;
#if HAVE_FULLVERSION_PDF_LIB
BString permissions;
if (_DocInfo()->FindString("permissions", &permissions) == B_OK)
fPermissions.Decode(permissions.String());
BTabView *tabView = new BTabView(bounds, "tabView");
_SetupDocInfoView(_CreateTabPanel(tabView, "Information"));
_SetupPasswordView(_CreateTabPanel(tabView, "Password"));
_SetupPermissionsView(_CreateTabPanel(tabView, "Permissions"));
background->AddChild(tabView);
#else
BBox* panel = new BBox(bounds, "top_panel", B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_NO_BORDER);
_SetupDocInfoView(panel);
background->AddChild(panel);
#endif
if (fTable->ChildAt(0))
fTable->ChildAt(0)->MakeFocus();
BRect winFrame(Frame());
BRect screenFrame(BScreen().Frame());
MoveTo((screenFrame.right - winFrame.right) / 2,
(screenFrame.bottom - winFrame.bottom) / 2);
SetSizeLimits(400.0, 10000.0, 250.0, 10000.0);
}
示例2: rect
AlertView::AlertView(BRect frame, const char *name)
: BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED),
// we will wait 12 seconds until we send a message
fSeconds(12)
{
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fBitmap = InitIcon();
BRect rect(60, 8, 400, 36);
BStringView *stringView = new BStringView(rect, NULL,
"Do you wish to keep these settings?");
stringView->SetFont(be_bold_font);
stringView->ResizeToPreferred();
AddChild(stringView);
rect = stringView->Frame();
rect.OffsetBy(0, rect.Height());
fCountdownView = new BStringView(rect, "countdown", NULL);
UpdateCountdownView();
fCountdownView->ResizeToPreferred();
AddChild(fCountdownView);
BButton* keepButton = new BButton(rect, "keep", "Keep",
new BMessage(BUTTON_KEEP_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
keepButton->ResizeToPreferred();
AddChild(keepButton);
BButton* button = new BButton(rect, "undo", "Undo",
new BMessage(BUTTON_UNDO_MSG), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
button->ResizeToPreferred();
AddChild(button);
// we're resizing ourselves to the right size
// (but we're not implementing GetPreferredSize(), bad style!)
float width = stringView->Frame().right;
if (fCountdownView->Frame().right > width)
width = fCountdownView->Frame().right;
if (width < Bounds().Width())
width = Bounds().Width();
float height
= fCountdownView->Frame().bottom + 24 + button->Bounds().Height();
ResizeTo(width, height);
keepButton->MoveTo(Bounds().Width() - 8 - keepButton->Bounds().Width(),
Bounds().Height() - 8 - keepButton->Bounds().Height());
button->MoveTo(keepButton->Frame().left - button->Bounds().Width() - 8,
keepButton->Frame().top);
keepButton->MakeDefault(true);
}
示例3: BMessage
StringInputWindow::StringInputWindow(const char *title, const char *text, BMessage msg,
BMessenger target)
: DWindow(BRect(0,0,300,200),title,B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE),
fMessage(msg),
fMessenger(target)
{
MakeCenteredOnShow(true);
BView *top = GetBackgroundView();
BRect r = Bounds().InsetByCopy(10,10);
r.bottom = r.top + 10;
BRect textRect = r.OffsetToCopy(0,0);
textRect.InsetBy(10,10);
fTextView = new BTextView(r,"paneltext",textRect,B_FOLLOW_LEFT | B_FOLLOW_TOP);
top->AddChild(fTextView);
fTextView->MakeEditable(false);
fTextView->SetText(text);
fTextView->ResizeTo(r.Width(), 20.0 + (fTextView->CountLines() *
fTextView->TextHeight(0,fTextView->TextLength())));
fTextView->SetViewColor(top->ViewColor());
fText = new BTextControl(BRect(10,10,11,11),"nametext","", "", new BMessage);
top->AddChild(fText);
fText->ResizeToPreferred();
fText->ResizeTo(Bounds().Width() - 20,fText->Bounds().Height());
fText->SetDivider(0.0);
fText->MoveTo(10,fTextView->Frame().bottom + 10.0);
r = fText->Frame();
r.OffsetBy(0,r.Height() + 10.0);
BButton *cancel = new BButton(r,"cancel","Cancel",
new BMessage(B_QUIT_REQUESTED));
cancel->ResizeToPreferred();
top->AddChild(cancel);
ResizeTo(300, cancel->Frame().bottom + 10);
cancel->MoveTo( Bounds().Width() - (cancel->Bounds().Width() * 2) - 20,
cancel->Frame().top);
r = cancel->Frame();
r.OffsetBy(r.Width() + 10,0);
BButton *open = new BButton(r,"ok","OK", new BMessage(M_INVOKE));
top->AddChild(open);
open->MakeDefault(true);
fText->MakeFocus(true);
open->MakeDefault(true);
}
示例4: bounds
PasswordWindow::PasswordWindow()
: BWindow(BRect(100, 100, 400, 230), "Enter password",
B_NO_BORDER_WINDOW_LOOK, kPasswordWindowFeel
/* TODO: B_MODAL_APP_WINDOW_FEEL should also behave correctly */,
B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE
| B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES)
{
BView* topView = new BView(Bounds(), "topView", B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
BRect bounds(Bounds());
bounds.InsetBy(10.0, 10.0);
BBox *customBox = new BBox(bounds, "customBox", B_FOLLOW_NONE);
topView->AddChild(customBox);
customBox->SetLabel("Unlock screen saver");
bounds.top += 10.0;
fPassword = new BTextControl(bounds, "password", "Enter password:",
"VeryLongPasswordPossible", B_FOLLOW_NONE);
customBox->AddChild(fPassword);
fPassword->MakeFocus(true);
fPassword->ResizeToPreferred();
fPassword->TextView()->HideTyping(true);
fPassword->SetDivider(be_plain_font->StringWidth("Enter password:") + 5.0);
BButton* button = new BButton(BRect(), "unlock", "Unlock",
new BMessage(kMsgUnlock), B_FOLLOW_NONE);
customBox->AddChild(button);
button->MakeDefault(true);
button->ResizeToPreferred();
button->SetTarget(NULL, be_app);
BRect frame = fPassword->Frame();
button->MoveTo(frame.right - button->Bounds().Width(), frame.bottom + 10.0);
customBox->ResizeTo(frame.right + 10.0, button->Frame().bottom + 10.0);
frame = customBox->Frame();
ResizeTo(frame.right + 10.0, frame.bottom + 10.0);
BScreen screen(this);
MoveTo(screen.Frame().left + (screen.Frame().Width() - Bounds().Width()) / 2,
screen.Frame().top + (screen.Frame().Height() - Bounds().Height()) / 2);
}
示例5: BMessage
FindWindow::FindWindow(BRect _rect, BMessage& previous, BMessenger& target,
const BMessage* settings)
: BWindow(_rect, B_TRANSLATE("Find"), B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_CLOSE_ON_ESCAPE),
fTarget(target)
{
BView* view = new BView(Bounds(), "main", B_FOLLOW_ALL, 0);
view->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
AddChild(view);
int8 mode = kAsciiMode;
if (previous.FindInt8("find_mode", &mode) != B_OK && settings != NULL)
settings->FindInt8("find_mode", &mode);
// add the top widgets
fMenu = new BPopUpMenu("mode");
BMessage* message;
BMenuItem* item;
fMenu->AddItem(item = new BMenuItem(B_TRANSLATE("Text"),
message = new BMessage(kMsgFindMode)));
message->AddInt8("mode", kAsciiMode);
if (mode == kAsciiMode)
item->SetMarked(true);
fMenu->AddItem(item = new BMenuItem(B_TRANSLATE_COMMENT("Hexadecimal",
"A menu item, as short as possible, noun is recommended if it is "
"shorter than adjective."), message = new BMessage(kMsgFindMode)));
message->AddInt8("mode", kHexMode);
if (mode == kHexMode)
item->SetMarked(true);
BRect rect = Bounds().InsetByCopy(5, 5);
BMenuField* menuField = new BMenuField(rect, B_EMPTY_STRING,
B_TRANSLATE("Mode:"), fMenu, B_FOLLOW_LEFT | B_FOLLOW_TOP);
menuField->SetDivider(menuField->StringWidth(menuField->Label()) + 8);
menuField->ResizeToPreferred();
view->AddChild(menuField);
// add the bottom widgets
BButton* button = new BButton(rect, B_EMPTY_STRING, B_TRANSLATE("Find"),
new BMessage(kMsgStartFind), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
button->MakeDefault(true);
button->ResizeToPreferred();
button->MoveTo(rect.right - button->Bounds().Width(),
rect.bottom - button->Bounds().Height());
view->AddChild(button);
fCaseCheckBox = new BCheckBox(rect, B_EMPTY_STRING, B_TRANSLATE("Case sensitive"),
NULL, B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fCaseCheckBox->ResizeToPreferred();
fCaseCheckBox->MoveTo(5, button->Frame().top);
bool caseSensitive;
if (previous.FindBool("case_sensitive", &caseSensitive) != B_OK) {
if (settings == NULL
|| settings->FindBool("case_sensitive", &caseSensitive) != B_OK)
caseSensitive = true;
}
fCaseCheckBox->SetValue(caseSensitive);
view->AddChild(fCaseCheckBox);
// and now those inbetween
rect.top = menuField->Frame().bottom + 5;
rect.bottom = fCaseCheckBox->Frame().top - 8;
rect.InsetBy(2, 2);
fTextView = new FindTextView(rect, B_EMPTY_STRING,
rect.OffsetToCopy(B_ORIGIN).InsetByCopy(3, 3), B_FOLLOW_ALL);
fTextView->SetWordWrap(true);
fTextView->SetMode((find_mode)mode);
fTextView->SetData(previous);
BScrollView* scrollView = new BScrollView("scroller", fTextView,
B_FOLLOW_ALL, B_WILL_DRAW, false, false);
view->AddChild(scrollView);
ResizeTo(290, button->Frame().Height() * 3 + 30);
SetSizeLimits(fCaseCheckBox->Bounds().Width() + button->Bounds().Width()
+ 20, 32768, button->Frame().Height() * 3 + 10, 32768);
}
示例6: BMessage
FileTypesWindow::FileTypesWindow(const BMessage& settings)
: BWindow(_Frame(settings), "FileTypes", B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
fNewTypeWindow(NULL)
{
bool showIcons;
bool showRule;
if (settings.FindBool("show_icons", &showIcons) != B_OK)
showIcons = true;
if (settings.FindBool("show_rule", &showRule) != B_OK)
showRule = false;
// add the menu
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
AddChild(menuBar);
BMenu* menu = new BMenu("File");
BMenuItem* item;
menu->AddItem(item = new BMenuItem("New resource file" B_UTF8_ELLIPSIS,
NULL, 'N', B_COMMAND_KEY));
item->SetEnabled(false);
BMenu* recentsMenu = BRecentFilesList::NewFileListMenu("Open" B_UTF8_ELLIPSIS,
NULL, NULL, be_app, 10, false, NULL, kSignature);
item = new BMenuItem(recentsMenu, new BMessage(kMsgOpenFilePanel));
item->SetShortcut('O', B_COMMAND_KEY);
menu->AddItem(item);
menu->AddItem(new BMenuItem("Application types" B_UTF8_ELLIPSIS,
new BMessage(kMsgOpenApplicationTypesWindow)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("About FileTypes" B_UTF8_ELLIPSIS,
new BMessage(B_ABOUT_REQUESTED)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED),
'Q', B_COMMAND_KEY));
menu->SetTargetForItems(be_app);
menuBar->AddItem(menu);
menu = new BMenu("Settings");
item = new BMenuItem("Show icons in list", new BMessage(kMsgToggleIcons));
item->SetMarked(showIcons);
item->SetTarget(this);
menu->AddItem(item);
item = new BMenuItem("Show recognition rule", new BMessage(kMsgToggleRule));
item->SetMarked(showRule);
item->SetTarget(this);
menu->AddItem(item);
menuBar->AddItem(menu);
// MIME Types list
BRect rect = Bounds();
rect.top = menuBar->Bounds().Height() + 1.0f;
BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
BButton* button = new BButton(rect, "add", "Add" B_UTF8_ELLIPSIS,
new BMessage(kMsgAddType), B_FOLLOW_BOTTOM);
button->ResizeToPreferred();
button->MoveTo(8.0f, topView->Bounds().bottom - 8.0f - button->Bounds().Height());
topView->AddChild(button);
rect = button->Frame();
rect.OffsetBy(rect.Width() + 8.0f, 0.0f);
fRemoveTypeButton = new BButton(rect, "remove", "Remove",
new BMessage(kMsgRemoveType), B_FOLLOW_BOTTOM);
fRemoveTypeButton->ResizeToPreferred();
topView->AddChild(fRemoveTypeButton);
rect.bottom = rect.top - 10.0f;
rect.top = 10.0f;
rect.left = 10.0f;
rect.right -= B_V_SCROLL_BAR_WIDTH + 2.0f;
if (rect.right < 180)
rect.right = 180;
fTypeListView = new MimeTypeListView(rect, "typeview", NULL, showIcons, false,
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM);
fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected));
BScrollView* scrollView = new BScrollView("scrollview", fTypeListView,
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_FRAME_EVENTS | B_WILL_DRAW, false, true);
topView->AddChild(scrollView);
// "Icon" group
font_height plainHeight;
be_plain_font->GetHeight(&plainHeight);
float height = ceilf(plainHeight.ascent + plainHeight.descent
+ plainHeight.leading) + 2.0f;
BFont font(be_bold_font);
float labelWidth = font.StringWidth("Icon");
font_height boldHeight;
font.GetHeight(&boldHeight);
//.........这里部分代码省略.........
示例7: BMessage
AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
AttributeItem* attributeItem)
: BWindow(BRect(100, 100, 350, 200), "Attribute", B_MODAL_WINDOW_LOOK,
B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE
| B_ASYNCHRONOUS_CONTROLS),
fTarget(target),
fMimeType(mimeType.Type())
{
if (attributeItem != NULL)
fAttribute = *attributeItem;
BRect rect = Bounds();
BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
rect.InsetBy(8.0f, 8.0f);
fPublicNameControl = new BTextControl(rect, "public", "Attribute name:",
fAttribute.PublicName(), NULL, B_FOLLOW_LEFT_RIGHT);
fPublicNameControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
float labelWidth = fPublicNameControl->StringWidth(fPublicNameControl->Label()) + 2.0f;
fPublicNameControl->SetDivider(labelWidth);
fPublicNameControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
float width, height;
fPublicNameControl->GetPreferredSize(&width, &height);
fPublicNameControl->ResizeTo(rect.Width(), height);
topView->AddChild(fPublicNameControl);
rect = fPublicNameControl->Frame();
rect.OffsetBy(0.0f, rect.Height() + 5.0f);
fAttributeControl = new BTextControl(rect, "internal", "Internal name:",
fAttribute.Name(), NULL, B_FOLLOW_LEFT_RIGHT);
fAttributeControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
fAttributeControl->SetDivider(labelWidth);
fAttributeControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
// filter out invalid characters that can't be part of an attribute
BTextView* textView = fAttributeControl->TextView();
const char* disallowedCharacters = "/";
for (int32 i = 0; disallowedCharacters[i]; i++) {
textView->DisallowChar(disallowedCharacters[i]);
}
topView->AddChild(fAttributeControl);
fTypeMenu = new BPopUpMenu("type");
BMenuItem* item = NULL;
for (int32 i = 0; kTypeMap[i].name != NULL; i++) {
BMessage* message = new BMessage(kMsgTypeChosen);
message->AddInt32("type", kTypeMap[i].type);
item = new BMenuItem(kTypeMap[i].name, message);
fTypeMenu->AddItem(item);
if (kTypeMap[i].type == fAttribute.Type())
item->SetMarked(true);
}
rect.OffsetBy(0.0f, rect.Height() + 4.0f);
BMenuField* menuField = new BMenuField(rect, "types",
"Type:", fTypeMenu);
menuField->SetDivider(labelWidth);
menuField->SetAlignment(B_ALIGN_RIGHT);
menuField->GetPreferredSize(&width, &height);
menuField->ResizeTo(rect.Width(), height);
topView->AddChild(menuField);
rect.OffsetBy(0.0f, rect.Height() + 4.0f);
rect.bottom = rect.top + fAttributeControl->Bounds().Height() * 2.0f + 18.0f;
BBox* box = new BBox(rect, "", B_FOLLOW_LEFT_RIGHT);
topView->AddChild(box);
fVisibleCheckBox = new BCheckBox(rect, "visible", "Visible",
new BMessage(kMsgVisibilityChanged));
fVisibleCheckBox->SetValue(fAttribute.Visible());
fVisibleCheckBox->ResizeToPreferred();
box->SetLabel(fVisibleCheckBox);
labelWidth -= 8.0f;
BMenu* menu = new BPopUpMenu("display as");
for (int32 i = 0; kDisplayAsMap[i].name != NULL; i++) {
BMessage* message = new BMessage(kMsgDisplayAsChosen);
if (kDisplayAsMap[i].identifier != NULL) {
message->AddString("identifier", kDisplayAsMap[i].identifier);
for (int32 j = 0; kDisplayAsMap[i].supported[j]; j++) {
message->AddInt32("supports", kDisplayAsMap[i].supported[j]);
}
}
item = new BMenuItem(kDisplayAsMap[i].name, message);
menu->AddItem(item);
if (compare_display_as(kDisplayAsMap[i].identifier, fAttribute.DisplayAs()))
item->SetMarked(true);
}
rect.OffsetTo(8.0f, fVisibleCheckBox->Bounds().Height());
//.........这里部分代码省略.........
示例8: windowRect
OpenWithContainerWindow::OpenWithContainerWindow(BMessage* entriesToOpen,
LockingList<BWindow>* windowList, window_look look, window_feel feel,
uint32 flags, uint32 workspace)
:
BContainerWindow(windowList, 0, look, feel, flags, workspace),
fEntriesToOpen(entriesToOpen)
{
AutoLock<BWindow> lock(this);
BRect windowRect(85, 50, 718, 296);
MoveTo(windowRect.LeftTop());
ResizeTo(windowRect.Width(), windowRect.Height());
// add a background view; use the standard BackgroundView here, the same
// as the file panel is using
BRect rect(Bounds());
BackgroundView* backgroundView = new BackgroundView(rect);
AddChild(backgroundView);
rect = Bounds();
// add buttons
fLaunchButton = new BButton(rect, "ok", B_TRANSLATE("Open"),
new BMessage(kDefaultButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
fLaunchButton->ResizeToPreferred();
fLaunchButton->MoveTo(rect.right - 10 - kDocumentKnobWidth
- fLaunchButton->Bounds().Width(),
rect.bottom - 10.0f - fLaunchButton->Bounds().Height());
backgroundView->AddChild(fLaunchButton);
BRect buttonRect = fLaunchButton->Frame();
fLaunchAndMakeDefaultButton = new BButton(buttonRect, "make default",
B_TRANSLATE("Open and make preferred"),
new BMessage(kOpenAndMakeDefault), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
// wide button, have to resize to fit text
fLaunchAndMakeDefaultButton->ResizeToPreferred();
fLaunchAndMakeDefaultButton->MoveBy(-10.0f
- fLaunchAndMakeDefaultButton->Bounds().Width(), 0.0f);
backgroundView->AddChild(fLaunchAndMakeDefaultButton);
fLaunchAndMakeDefaultButton->SetEnabled(false);
buttonRect = fLaunchAndMakeDefaultButton->Frame();
BButton* button = new BButton(buttonRect, "cancel", B_TRANSLATE("Cancel"),
new BMessage(kCancelButton), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
button->ResizeToPreferred();
button->MoveBy(-10.0f - button->Bounds().Width(), 0.0f);
backgroundView->AddChild(button);
fMinimalWidth = button->Bounds().Width() + fLaunchButton->Bounds().Width()
+ fLaunchAndMakeDefaultButton->Bounds().Width() + kDocumentKnobWidth
+ 40.0f;
fLaunchButton->MakeDefault(true);
// add pose view
rect.OffsetTo(10.0f, 10.0f);
rect.bottom = buttonRect.top - 15.0f;
rect.right -= B_V_SCROLL_BAR_WIDTH + 20.0f;
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
// make room for scrollbars and a margin
fPoseView = NewPoseView(0, rect, kListMode);
backgroundView->AddChild(fPoseView);
fPoseView->SetFlags(fPoseView->Flags() | B_NAVIGABLE);
fPoseView->SetPoseEditing(false);
// set the window title
if (CountRefs(fEntriesToOpen) == 1) {
// if opening just one file, use it in the title
entry_ref ref;
fEntriesToOpen->FindRef("refs", &ref);
BString buffer(B_TRANSLATE("Open %name with:"));
buffer.ReplaceFirst("%name", ref.name);
SetTitle(buffer.String());
} else {
// use generic title
SetTitle(B_TRANSLATE("Open selection with:"));
}
AddCommonFilter(new BMessageFilter(B_KEY_DOWN,
&OpenWithContainerWindow::KeyDownFilter));
}
示例9: BAlert
void
AlertTestWindow::Test()
{
BAlert *pAlert = new BAlert(
"alert1",
k60X,
k20X, "OK", "Cancel",
B_WIDTH_AS_USUAL, // widthStyle
B_OFFSET_SPACING,
B_EMPTY_ALERT // alert_type
);
if (fAlertType == 'H') {
BView *master = pAlert->ChildAt(0);
master->SetViewColor(ui_color(B_MENU_BACKGROUND_COLOR));
}
BPoint pt;
BString strLabel;
BButton *pBtns[3] = { NULL };
pBtns[0] = pAlert->ButtonAt(0);
pBtns[1] = pAlert->ButtonAt(1);
pBtns[2] = pAlert->ButtonAt(2);
BTextView *pTextView = pAlert->TextView();
// Window info
printf("wi.width = %.1ff;\n"
"wi.height = %.1ff;\n"
"ati.SetWinInfo(wi);\n",
pAlert->Bounds().Width(), pAlert->Bounds().Height());
// TextView info
printf("\n");
which_label(pTextView->Text(), strLabel);
pt = pTextView->ConvertToParent(BPoint(0, 0));
printf("ti.label = %s;\n"
"ti.width = %.1ff;\n"
"ti.height = %.1ff;\n"
"ti.topleft.Set(%.1ff, %.1ff);\n"
"ati.SetTextViewInfo(ti);\n",
strLabel.String(), pTextView->Bounds().Width(),
pTextView->Bounds().Height(), pt.x, pt.y);
// Button info
printf("\n");
int32 i = 0;
while (i < 3 && pBtns[i] != NULL) {
BButton *pb = pBtns[i];
which_label(pb->Label(), strLabel);
pt = pb->ConvertToParent(BPoint(0, 0));
printf("bi.label = %s;\n"
"bi.width = %.1ff;\n"
"bi.height = %.1ff;\n"
"bi.topleft.Set(%.1ff, %.1ff);\n"
"ati.SetButtonInfo(%d, bi);\n",
strLabel.String(), pb->Bounds().Width(),
pb->Bounds().Height(), pt.x, pt.y,
(int)i);
i++;
}
int32 result = pAlert->Go();
printf("%c<Clicked: %d\n", fAlertType, static_cast<int>(result));
pAlert = NULL;
}
示例10: bounds
JobSetupWindow::JobSetupWindow(BMessage *msg, const char * printerName)
: BlockingWindow(BRect(0, 0, 300, 200), "Job Setup", B_TITLED_WINDOW_LOOK,
B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_MINIMIZABLE |
B_NOT_ZOOMABLE),
fPrinterName(printerName),
fSetupMsg(msg)
{
if (printerName)
SetTitle(BString(printerName).Append(" Job Setup").String());
int32 firstPage;
fSetupMsg->FindInt32("first_page", &firstPage);
int32 lastPage;
fSetupMsg->FindInt32("last_page", &lastPage);
bool allPages = firstPage == 1 && lastPage == LONG_MAX;
BRect bounds(Bounds());
BBox *panel = new BBox(bounds, "background", B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
AddChild(panel);
bounds.InsetBy(10.0, 10.0);
fAll = new BRadioButton(bounds, "allPages", "Print all pages",
new BMessage(ALL_PAGES_MGS));
panel->AddChild(fAll);
fAll->ResizeToPreferred();
fAll->SetValue(allPages);
bounds.OffsetBy(0.0, fAll->Bounds().Height() + 10.0);
fRange = new BRadioButton(bounds, "pagesRange", "Print pages:",
new BMessage(RANGE_SELECTION_MSG));
panel->AddChild(fRange);
fRange->ResizeToPreferred();
fRange->SetValue(!allPages);
bounds.OffsetBy(0.0, fRange->Bounds().Height() + 5.0);
BRect rect(bounds);
rect.right = be_plain_font->StringWidth("From: SomeSpaceHere");
fFrom = new BTextControl(rect, "from", "From:", "SomeSpaceHere", NULL);
panel->AddChild(fFrom);
fFrom->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
fFrom->ResizeToPreferred();
fFrom->SetDivider(be_plain_font->StringWidth("From: "));
fFrom->SetEnabled(!allPages);
rect = fFrom->Frame();
fTo = new BTextControl(rect, "to", "To:", "SomeSpaceHere", NULL);
panel->AddChild(fTo);
fTo->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
fTo->SetDivider(be_plain_font->StringWidth("To: "));
fTo->MoveTo(fFrom->Frame().right + 10.0, fTo->Frame().top);
fTo->SetEnabled(!allPages);
BString buffer;
buffer << firstPage;
fFrom->SetText(buffer.String());
buffer = "";
buffer << lastPage;
fTo->SetText(buffer.String());
for (uint32 i = 0; i < '0'; i++) {
fTo->TextView()->DisallowChar(i);
fFrom->TextView()->DisallowChar(i);
}
for (uint32 i = '9' + 1; i < 255; i++) {
fTo->TextView()->DisallowChar(i);
fFrom->TextView()->DisallowChar(i);
}
bounds.OffsetBy(0.0, fTo->Bounds().Height() + 10.0);
BBox *line = new BBox(BRect(bounds.left - 5.0, bounds.top, bounds.right + 5.0,
bounds.top + 1.0), NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
panel->AddChild(line);
bounds.OffsetBy(0.0, 11.0);
BButton *cancel = new BButton(bounds, NULL, "Cancel", new BMessage(CANCEL_MSG));
panel->AddChild(cancel);
cancel->ResizeToPreferred();
BButton *ok = new BButton(bounds, NULL, "OK", new BMessage(OK_MSG));
panel->AddChild(ok, cancel);
ok->ResizeToPreferred();
bounds.right = fTo->Frame().right;
ok->MoveTo(bounds.right - ok->Bounds().Width(), ok->Frame().top);
bounds = ok->Frame();
cancel->MoveTo(bounds.left - cancel->Bounds().Width() - 10.0, bounds.top);
ok->MakeDefault(true);
ResizeTo(bounds.right + 10.0, bounds.bottom + 10.0);
BRect winFrame(Frame());
BRect screenFrame(BScreen().Frame());
MoveTo((screenFrame.right - winFrame.right) / 2,
(screenFrame.bottom - winFrame.bottom) / 2);
//.........这里部分代码省略.........
示例11: BMessage
void
PasswordWindow::_Setup()
{
BRect bounds = Bounds();
BView* topView = new BView(bounds, "topView", B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
bounds.InsetBy(10.0, 10.0);
fUseNetwork = new BRadioButton(bounds, "useNetwork", "Use network password",
new BMessage(kMsgPasswordTypeChanged), B_FOLLOW_NONE);
topView->AddChild(fUseNetwork);
fUseNetwork->ResizeToPreferred();
fUseNetwork->MoveBy(10.0, 0.0);
bounds.OffsetBy(0.0, fUseNetwork->Bounds().Height());
BBox *customBox = new BBox(bounds, "customBox", B_FOLLOW_NONE);
topView->AddChild(customBox);
fUseCustom = new BRadioButton(BRect(), "useCustom", "Use custom password",
new BMessage(kMsgPasswordTypeChanged), B_FOLLOW_NONE);
customBox->SetLabel(fUseCustom);
fUseCustom->ResizeToPreferred();
fPasswordControl = new BTextControl(bounds, "passwordControl", "Password:",
NULL, B_FOLLOW_NONE);
customBox->AddChild(fPasswordControl);
fPasswordControl->ResizeToPreferred();
fPasswordControl->TextView()->HideTyping(true);
fPasswordControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
bounds.OffsetBy(0.0, fPasswordControl->Bounds().Height() + 5.0);
fConfirmControl = new BTextControl(bounds, "confirmControl",
"Confirm password:", "VeryLongPasswordPossible", B_FOLLOW_NONE);
customBox->AddChild(fConfirmControl);
fConfirmControl->TextView()->HideTyping(true);
fConfirmControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
float width, height;
fConfirmControl->GetPreferredSize(&width, &height);
fPasswordControl->ResizeTo(width, height);
fConfirmControl->ResizeTo(width, height);
float divider = be_plain_font->StringWidth("Confirm password:") + 5.0;
fConfirmControl->SetDivider(divider);
fPasswordControl->SetDivider(divider);
customBox->ResizeTo(fConfirmControl->Frame().right + 10.0,
fConfirmControl->Frame().bottom + 10.0);
BButton* button = new BButton(BRect(), "done", "Done", new BMessage(kMsgDone));
topView->AddChild(button);
button->ResizeToPreferred();
BRect frame = customBox->Frame();
button->MoveTo(frame.right - button->Bounds().Width(), frame.bottom + 10.0);
frame = button->Frame();
button->MakeDefault(true);
button = new BButton(frame, "cancel", "Cancel", new BMessage(B_CANCEL));
topView->AddChild(button);
button->ResizeToPreferred();
button->MoveBy(-(button->Bounds().Width() + 10.0), 0.0);
ResizeTo(customBox->Frame().right + 10.0, frame.bottom + 10.0);
}
示例12: BMessage
// SavePanel class
SavePanel::SavePanel(const char* name,
BMessenger* target,
entry_ref* startDirectory,
uint32 nodeFlavors,
bool allowMultipleSelection,
BMessage* message,
BRefFilter* filter,
bool modal,
bool hideWhenDone)
: BFilePanel(B_SAVE_PANEL, target, startDirectory,
nodeFlavors, allowMultipleSelection,
message, filter, modal, hideWhenDone),
BHandler(name),
fConfigWindow(NULL),
fFormatM(NULL),
fExportMode(EXPORT_MODE_ICON_RDEF)
{
BWindow* window = Window();
if (!window || !window->Lock())
return;
window->SetTitle(B_TRANSLATE("Save image"));
// add this instance as BHandler to the window's looper
window->AddHandler(this);
// find a couple of important views and mess with their layout
BView* background = Window()->ChildAt(0);
BButton* cancel = dynamic_cast<BButton*>(background->FindView("cancel button"));
BView* textview = background->FindView("text view");
BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(background->FindView("HScrollBar"));
if (!background || !cancel || !textview || !hscrollbar) {
printf("SavePanel::SavePanel() - couldn't find necessary controls.\n");
return;
}
_BuildMenu();
BRect rect = textview->Frame();
rect.top = cancel->Frame().top;
font_height fh;
be_plain_font->GetHeight(&fh);
rect.bottom = rect.top + fh.ascent + fh.descent + 5.0;
fFormatMF = new BMenuField(rect, "format popup", B_TRANSLATE("Format"),
fFormatM, true,
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
B_WILL_DRAW | B_NAVIGABLE);
fFormatMF->SetDivider(be_plain_font->StringWidth(
B_TRANSLATE("Format")) + 7);
fFormatMF->MenuBar()->ResizeToPreferred();
fFormatMF->ResizeToPreferred();
float height = fFormatMF->Bounds().Height() + 8.0;
// find all the views that are in the way and
// move up them up the height of the menu field
BView *poseview = background->FindView("PoseView");
if (poseview) poseview->ResizeBy(0, -height);
BButton *insert = (BButton *)background->FindView("default button");
if (hscrollbar) hscrollbar->MoveBy(0, -height);
BScrollBar *vscrollbar = (BScrollBar *)background->FindView("VScrollBar");
if (vscrollbar) vscrollbar->ResizeBy(0, -height);
BView *countvw = (BView *)background->FindView("CountVw");
if (countvw) countvw->MoveBy(0, -height);
textview->MoveBy(0, -height);
#if HAIKU_TARGET_PLATFORM_DANO
fFormatMF->MoveTo(textview->Frame().left, fFormatMF->Frame().top + 2);
#else
fFormatMF->MoveTo(textview->Frame().left, fFormatMF->Frame().top);
#endif
background->AddChild(fFormatMF);
// Build the "Settings" button relative to the format menu
rect = cancel->Frame();
rect.OffsetTo(fFormatMF->Frame().right + 5.0, rect.top);
fSettingsB = new BButton(rect, "settings",
B_TRANSLATE("Settings"B_UTF8_ELLIPSIS),
new BMessage(MSG_SETTINGS),
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM,
B_WILL_DRAW | B_NAVIGABLE);
fSettingsB->ResizeToPreferred();
background->AddChild(fSettingsB);
fSettingsB->SetTarget(this);
textview->ResizeTo(fSettingsB->Frame().right - fFormatMF->Frame().left,
textview->Frame().Height());
// Make sure the smallest window won't draw the "Settings" button over anything else
float minWindowWidth = textview->Bounds().Width()
+ cancel->Bounds().Width()
+ (insert ? insert->Bounds().Width() : 0.0)
+ 90;
Window()->SetSizeLimits(minWindowWidth, 10000, 250, 10000);
if (Window()->Bounds().IntegerWidth() + 1 < minWindowWidth)
Window()->ResizeTo(minWindowWidth, Window()->Bounds().Height());
//.........这里部分代码省略.........
示例13: bounds
PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
: BlockingWindow(BRect(0,0,400,220), "Page setup", B_TITLED_WINDOW_LOOK,
B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_MINIMIZABLE |
B_NOT_ZOOMABLE),
fSetupMsg(msg),
fPrinterDirName(printerName)
{
if (printerName)
SetTitle(BString(printerName).Append(" Page setup").String());
// load orientation
if (fSetupMsg->FindInt32("orientation", &fCurrentOrientation) != B_OK)
fCurrentOrientation = PrinterDriver::PORTRAIT_ORIENTATION;
// load page rect
BRect page;
float width = letter_width;
float height = letter_height;
if (fSetupMsg->FindRect("preview:paper_rect", &page) == B_OK) {
width = page.Width();
height = page.Height();
} else {
page.Set(0, 0, width, height);
}
BString label;
if (fSetupMsg->FindString("preview:paper_size", &label) != B_OK)
label = "Letter";
// Load units
int32 units;
if (fSetupMsg->FindInt32("units", &units) != B_OK)
units = kUnitInch;
// re-calculate the margin from the printable rect in points
BRect margin = page;
if (fSetupMsg->FindRect("preview:printable_rect", &margin) == B_OK) {
margin.top -= page.top;
margin.left -= page.left;
margin.right = page.right - margin.right;
margin.bottom = page.bottom - margin.bottom;
} else {
margin.Set(28.34, 28.34, 28.34, 28.34); // 28.34 dots = 1cm
}
BRect bounds(Bounds());
BBox *panel = new BBox(bounds, "background", B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
AddChild(panel);
bounds.InsetBy(10.0, 10.0);
bounds.right = 230.0;
bounds.bottom = 160.0;
fMarginView = new MarginView(bounds, int32(width), int32(height), margin,
MarginUnit(units));
panel->AddChild(fMarginView);
fMarginView->SetResizingMode(B_FOLLOW_NONE);
BPopUpMenu* m = new BPopUpMenu("Page size");
m->SetRadioMode(true);
bounds.OffsetBy(bounds.Width() + 10.0, 5.0);
float divider = be_plain_font->StringWidth("Orientation: ");
fPageSizeMenu = new BMenuField(bounds, "page_size", "Page size:", m);
panel->AddChild(fPageSizeMenu);
fPageSizeMenu->ResizeToPreferred();
fPageSizeMenu->SetDivider(divider);
fPageSizeMenu->Menu()->SetLabelFromMarked(true);
for (int32 i = 0; pageFormat[i].label != NULL; i++) {
BMessage* message = new BMessage(PAGE_SIZE_CHANGED);
message->AddFloat("width", pageFormat[i].width);
message->AddFloat("height", pageFormat[i].height);
BMenuItem* item = new BMenuItem(pageFormat[i].label, message);
m->AddItem(item);
if (label.Compare(pageFormat[i].label) == 0)
item->SetMarked(true);
}
m = new BPopUpMenu("Orientation");
m->SetRadioMode(true);
bounds.OffsetBy(0.0, fPageSizeMenu->Bounds().Height() + 10.0);
fOrientationMenu = new BMenuField(bounds, "orientation", "Orientation:", m);
panel->AddChild(fOrientationMenu);
fOrientationMenu->ResizeToPreferred();
fOrientationMenu->SetDivider(divider);
fOrientationMenu->Menu()->SetLabelFromMarked(true);
for (int32 i = 0; orientation[i].label != NULL; i++) {
BMessage* message = new BMessage(ORIENTATION_CHANGED);
message->AddInt32("orientation", orientation[i].orientation);
BMenuItem* item = new BMenuItem(orientation[i].label, message);
m->AddItem(item);
if (fCurrentOrientation == orientation[i].orientation)
item->SetMarked(true);
}
//.........这里部分代码省略.........
示例14: BMessage
ExtensionWindow::ExtensionWindow(FileTypesWindow* target, BMimeType& type,
const char* extension)
: BWindow(BRect(100, 100, 350, 200), "Extension", B_MODAL_WINDOW_LOOK,
B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE
| B_ASYNCHRONOUS_CONTROLS),
fTarget(target),
fMimeType(type.Type()),
fExtension(extension)
{
BRect rect = Bounds();
BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(topView);
rect.InsetBy(8.0f, 8.0f);
fExtensionControl = new BTextControl(rect, "extension", "Extension:", extension,
NULL, B_FOLLOW_LEFT_RIGHT);
float labelWidth = fExtensionControl->StringWidth(fExtensionControl->Label()) + 2.0f;
fExtensionControl->SetModificationMessage(new BMessage(kMsgExtensionUpdated));
fExtensionControl->SetDivider(labelWidth);
fExtensionControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
// filter out invalid characters that can't be part of an extension
BTextView* textView = fExtensionControl->TextView();
const char* disallowedCharacters = "/:";
for (int32 i = 0; disallowedCharacters[i]; i++) {
textView->DisallowChar(disallowedCharacters[i]);
}
float width, height;
fExtensionControl->GetPreferredSize(&width, &height);
fExtensionControl->ResizeTo(rect.Width(), height);
topView->AddChild(fExtensionControl);
fAcceptButton = new BButton(rect, "add", extension ? "Done" : "Add",
new BMessage(kMsgAccept), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
fAcceptButton->ResizeToPreferred();
fAcceptButton->MoveTo(Bounds().Width() - 8.0f - fAcceptButton->Bounds().Width(),
Bounds().Height() - 8.0f - fAcceptButton->Bounds().Height());
fAcceptButton->SetEnabled(false);
topView->AddChild(fAcceptButton);
BButton* button = new BButton(rect, "cancel", "Cancel",
new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
button->ResizeToPreferred();
button->MoveTo(fAcceptButton->Frame().left - 10.0f - button->Bounds().Width(),
fAcceptButton->Frame().top);
topView->AddChild(button);
ResizeTo(labelWidth * 4.0f + 24.0f, fExtensionControl->Bounds().Height()
+ fAcceptButton->Bounds().Height() + 28.0f);
SetSizeLimits(button->Bounds().Width() + fAcceptButton->Bounds().Width() + 26.0f,
32767.0f, Frame().Height(), Frame().Height());
// omit the leading dot
if (fExtension.ByteAt(0) == '.')
fExtension.Remove(0, 1);
fAcceptButton->MakeDefault(true);
fExtensionControl->MakeFocus(true);
target->PlaceSubWindow(this);
AddToSubset(target);
}
示例15: bounds
PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
: HWindow(BRect(0,0,400,220), "Page setup", B_TITLED_WINDOW_LOOK,
B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_MINIMIZABLE |
B_NOT_ZOOMABLE),
fResult(B_ERROR),
fSetupMsg(msg),
fAdvancedSettings(*msg),
fPrinterDirName(printerName)
{
fExitSem = create_sem(0, "PageSetup");
if (printerName)
SetTitle(BString(printerName).Append(" page setup").String());
if (fSetupMsg->FindInt32("orientation", &fCurrentOrientation) != B_OK)
fCurrentOrientation = PrinterDriver::PORTRAIT_ORIENTATION;
BRect page;
float width = letter_width;
float height = letter_height;
if (fSetupMsg->FindRect("paper_rect", &page) == B_OK) {
width = page.Width();
height = page.Height();
} else {
page.Set(0, 0, width, height);
}
BString label;
if (fSetupMsg->FindString("pdf_paper_size", &label) != B_OK)
label = "Letter";
int32 compression;
fSetupMsg->FindInt32("pdf_compression", &compression);
int32 units;
if (fSetupMsg->FindInt32("units", &units) != B_OK)
units = kUnitInch;
// re-calculate the margin from the printable rect in points
BRect margin = page;
if (fSetupMsg->FindRect("printable_rect", &margin) == B_OK) {
margin.top -= page.top;
margin.left -= page.left;
margin.right = page.right - margin.right;
margin.bottom = page.bottom - margin.bottom;
} else {
margin.Set(28.34, 28.34, 28.34, 28.34); // 28.34 dots = 1cm
}
BString setting_value;
if (fSetupMsg->FindString("pdf_compatibility", &setting_value) != B_OK)
setting_value = "1.3";
// Load font settings
fFonts = new Fonts();
fFonts->CollectFonts();
BMessage fonts;
if (fSetupMsg->FindMessage("fonts", &fonts) == B_OK)
fFonts->SetTo(&fonts);
// add a *dialog* background
BRect bounds(Bounds());
BBox *panel = new BBox(bounds, "background", B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
AddChild(panel);
bounds.InsetBy(10.0, 10.0);
bounds.right = 230.0;
bounds.bottom = 160.0;
fMarginView = new MarginView(bounds, int32(width), int32(height), margin,
MarginUnit(units));
panel->AddChild(fMarginView);
fMarginView->SetResizingMode(B_FOLLOW_NONE);
BPopUpMenu* m = new BPopUpMenu("Page size");
m->SetRadioMode(true);
bounds.OffsetBy(bounds.Width() + 10.0, 5.0);
float divider = be_plain_font->StringWidth("PDF compatibility: ");
fPageSizeMenu = new BMenuField(bounds, "page_size", "Page size:", m);
panel->AddChild(fPageSizeMenu);
fPageSizeMenu->ResizeToPreferred();
fPageSizeMenu->SetDivider(divider);
fPageSizeMenu->Menu()->SetLabelFromMarked(true);
for (int32 i = 0; pageFormat[i].label != NULL; i++) {
BMessage* message = new BMessage(PAGE_SIZE_CHANGED);
message->AddFloat("width", pageFormat[i].width);
message->AddFloat("height", pageFormat[i].height);
BMenuItem* item = new BMenuItem(pageFormat[i].label, message);
m->AddItem(item);
if (label.Compare(pageFormat[i].label) == 0)
item->SetMarked(true);
}
m = new BPopUpMenu("Orientation");
m->SetRadioMode(true);
bounds.OffsetBy(0.0, fPageSizeMenu->Bounds().Height() + 10.0);
//.........这里部分代码省略.........