本文整理汇总了C++中BBox::Frame方法的典型用法代码示例。如果您正苦于以下问题:C++ BBox::Frame方法的具体用法?C++ BBox::Frame怎么用?C++ BBox::Frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBox
的用法示例。
在下文中一共展示了BBox::Frame方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BWindow
/*******************************************************
* Our wonderful BWindow, ya its kewl like that.
* we dont do much here but set up the menubar and
* let the view take over. We also nead some message
* redirection and handling
*******************************************************/
ToolTipWindow::ToolTipWindow() : BWindow(BRect(0,0,100,19),"Tool Tip",
B_NO_BORDER_WINDOW_LOOK,
B_FLOATING_ALL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS|B_NOT_RESIZABLE|B_AVOID_FRONT|B_AVOID_FOCUS){
Looper()->SetName(TOOL_TIP_WINDOW);
BView *v = new BView(Bounds(),"",B_FOLLOW_ALL,0);
v->SetViewColor(255,255,120);
AddChild(v);
BRect b = v->Bounds();
b.Set(b.left-1,b.top-1,b.right+1,b.bottom+1);
BBox *bb = new BBox(b,"",B_FOLLOW_ALL);
v->AddChild(bb);
b = bb->Frame();
b.InsetBy(1,1);
b.left = 4;
b.bottom --;
tipv = new BStringView(b,"","...",B_FOLLOW_ALL);
tipv->SetAlignment(B_ALIGN_CENTER);
bb->AddChild(tipv);
Run();
}
示例2: 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);
}
示例3: rect
ConfigWindow::ConfigWindow()
:
BWindow(BRect(100.0, 100.0, 580.0, 540.0), "E-mail", B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
fLastSelectedAccount(NULL),
fSaveSettings(false)
{
// create controls
BRect rect(Bounds());
BView *top = new BView(rect, NULL, B_FOLLOW_ALL, 0);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(top);
// determine font height
font_height fontHeight;
top->GetFontHeight(&fontHeight);
int32 height = (int32)(fontHeight.ascent + fontHeight.descent
+ fontHeight.leading) + 5;
rect.InsetBy(5, 5);
rect.bottom -= 11 + height;
BTabView *tabView = new BTabView(rect, NULL);
BView *view;
rect = tabView->Bounds();
rect.bottom -= tabView->TabHeight() + 4;
tabView->AddTab(view = new BView(rect, NULL, B_FOLLOW_ALL, 0));
tabView->TabAt(0)->SetLabel(B_TRANSLATE("Accounts"));
view->SetViewColor(top->ViewColor());
// accounts listview
rect = view->Bounds().InsetByCopy(8, 8);
rect.right = 140 - B_V_SCROLL_BAR_WIDTH;
rect.bottom -= height + 12;
fAccountsListView = new AccountsListView(rect);
view->AddChild(new BScrollView(NULL, fAccountsListView, B_FOLLOW_ALL, 0,
false, true));
rect.right += B_V_SCROLL_BAR_WIDTH;
rect.top = rect.bottom + 8;
rect.bottom = rect.top + height;
BRect sizeRect = rect;
sizeRect.right = sizeRect.left + 30 + view->StringWidth(
B_TRANSLATE("Add"));
view->AddChild(new BButton(sizeRect, NULL, B_TRANSLATE("Add"),
new BMessage(kMsgAddAccount), B_FOLLOW_BOTTOM));
sizeRect.left = sizeRect.right+3;
sizeRect.right = sizeRect.left + 30 + view->StringWidth(
B_TRANSLATE("Remove"));
view->AddChild(fRemoveButton = new BButton(
sizeRect, NULL, B_TRANSLATE("Remove"),
new BMessage(kMsgRemoveAccount), B_FOLLOW_BOTTOM));
// accounts config view
rect = view->Bounds();
rect.left = fAccountsListView->Frame().right + B_V_SCROLL_BAR_WIDTH + 16;
rect.right -= 10;
view->AddChild(fConfigView = new CenterContainer(rect));
MakeHowToView();
// general settings
rect = tabView->Bounds();
rect.bottom -= tabView->TabHeight() + 4;
tabView->AddTab(view = new CenterContainer(rect));
tabView->TabAt(1)->SetLabel(B_TRANSLATE("Settings"));
rect = view->Bounds().InsetByCopy(8, 8);
rect.right -= 1;
rect.bottom = rect.top + height * 5 + 15;
BBox *box = new BBox(rect);
box->SetLabel(B_TRANSLATE("Mail checking"));
view->AddChild(box);
rect = box->Bounds().InsetByCopy(8, 8);
rect.top += 7;
rect.bottom = rect.top + height + 5;
BRect tile = rect.OffsetByCopy(0, 1);
int32 labelWidth = (int32)view->StringWidth(B_TRANSLATE("Check every")) + 6;
tile.right = 80 + labelWidth;
fIntervalControl = new BTextControl(tile, "time",
B_TRANSLATE("Check every"), NULL, NULL);
fIntervalControl->SetDivider(labelWidth);
box->AddChild(fIntervalControl);
BPopUpMenu *frequencyPopUp = new BPopUpMenu(B_EMPTY_STRING);
const char *frequencyStrings[] = {
B_TRANSLATE("never"),
B_TRANSLATE("minutes"),
B_TRANSLATE("hours"),
B_TRANSLATE("days")
};
BMenuItem *item;
for (int32 i = 0; i < 4; i++) {
frequencyPopUp->AddItem(item = new BMenuItem(frequencyStrings[i],
new BMessage(kMsgIntervalUnitChanged)));
//.........这里部分代码省略.........
示例4: rect
ConfigWindow::ConfigWindow()
: BWindow(BRect(200.0, 200.0, 640.0, 640.0),
"E-mail", B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
fLastSelectedAccount(NULL),
fSaveSettings(false)
{
/*** create controls ***/
BRect rect(Bounds());
BView *top = new BView(rect,NULL,B_FOLLOW_ALL,0);
top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(top);
// determine font height
font_height fontHeight;
top->GetFontHeight(&fontHeight);
int32 height = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 5;
rect.InsetBy(5,5); rect.bottom -= 11 + height;
BTabView *tabView = new BTabView(rect,NULL);
BView *view,*generalView;
rect = tabView->Bounds(); rect.bottom -= tabView->TabHeight() + 4;
tabView->AddTab(view = new BView(rect,NULL,B_FOLLOW_ALL,0));
tabView->TabAt(0)->SetLabel(MDR_DIALECT_CHOICE ("Accounts","アカウント"));
view->SetViewColor(top->ViewColor());
// accounts listview
rect = view->Bounds().InsetByCopy(8,8);
rect.right = 140 - B_V_SCROLL_BAR_WIDTH;
rect.bottom -= height + 12;
fAccountsListView = new AccountsListView(rect);
view->AddChild(new BScrollView(NULL,fAccountsListView,B_FOLLOW_ALL,0,false,true));
rect.right += B_V_SCROLL_BAR_WIDTH;
rect.top = rect.bottom + 8; rect.bottom = rect.top + height;
BRect sizeRect = rect;
sizeRect.right = sizeRect.left + 30 + view->StringWidth(MDR_DIALECT_CHOICE ("Add","追加"));
view->AddChild(new BButton(sizeRect,NULL,MDR_DIALECT_CHOICE ("Add","追加"),
new BMessage(kMsgAddAccount),B_FOLLOW_BOTTOM));
sizeRect.left = sizeRect.right+3;
sizeRect.right = sizeRect.left + 30 + view->StringWidth(MDR_DIALECT_CHOICE ("Remove","削除"));
view->AddChild(fRemoveButton = new BButton(sizeRect,NULL,MDR_DIALECT_CHOICE ("Remove","削除"),
new BMessage(kMsgRemoveAccount),B_FOLLOW_BOTTOM));
// accounts config view
rect = view->Bounds();
rect.left = fAccountsListView->Frame().right + B_V_SCROLL_BAR_WIDTH + 16;
rect.right -= 10;
view->AddChild(fConfigView = new CenterContainer(rect));
MakeHowToView();
// general settings
rect = tabView->Bounds(); rect.bottom -= tabView->TabHeight() + 4;
tabView->AddTab(view = new CenterContainer(rect));
tabView->TabAt(1)->SetLabel(MDR_DIALECT_CHOICE ("General","一般"));
rect = view->Bounds().InsetByCopy(8,8);
rect.right -= 1; rect.bottom = rect.top + height * 5 + 15;
BBox *box = new BBox(rect);
box->SetLabel(MDR_DIALECT_CHOICE ("Retrieval Frequency","メールチェック間隔"));
view->AddChild(box);
rect = box->Bounds().InsetByCopy(8,8);
rect.top += 7; rect.bottom = rect.top + height + 5;
BRect tile = rect.OffsetByCopy(0,1);
int32 labelWidth = (int32)view->StringWidth(MDR_DIALECT_CHOICE ("Check every:","メールチェック間隔:"))+6;
tile.right = 80 + labelWidth;
fIntervalControl = new BTextControl(tile,"time",MDR_DIALECT_CHOICE ("Check every:","メールチェック間隔:"),
NULL,NULL);
fIntervalControl->SetDivider(labelWidth);
box->AddChild(fIntervalControl);
BPopUpMenu *frequencyPopUp = new BPopUpMenu(B_EMPTY_STRING);
const char *frequencyStrings[] = {
MDR_DIALECT_CHOICE ("Never","チェックしない"),
MDR_DIALECT_CHOICE ("Minutes","分毎チェック"),
MDR_DIALECT_CHOICE ("Hours","時間毎チェック"),
MDR_DIALECT_CHOICE ("Days","日間毎チェック")};
BMenuItem *item;
for (int32 i = 0;i < 4;i++)
{
frequencyPopUp->AddItem(item = new BMenuItem(frequencyStrings[i],new BMessage(kMsgIntervalUnitChanged)));
if (i == 1)
item->SetMarked(true);
}
tile.left = tile.right + 5; tile.right = rect.right;
tile.OffsetBy(0,-1);
fIntervalUnitField = new BMenuField(tile,"frequency", B_EMPTY_STRING, frequencyPopUp);
fIntervalUnitField->SetDivider(0.0);
box->AddChild(fIntervalUnitField);
rect.OffsetBy(0,height + 9); rect.bottom -= 2;
fPPPActiveCheckBox = new BCheckBox(rect,"ppp active",
MDR_DIALECT_CHOICE ("only when PPP is active","PPP接続中時のみ"), NULL);
//.........这里部分代码省略.........
示例5: BMessage
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entry)
: BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),
"Application Type", B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
fChangedProperties(0)
{
// add the menu
BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
AddChild(menuBar);
BMenu* menu = new BMenu("File");
fSaveMenuItem = new BMenuItem("Save", new BMessage(kMsgSave), 'S');
fSaveMenuItem->SetEnabled(false);
menu->AddItem(fSaveMenuItem);
BMenuItem* item;
menu->AddItem(item = new BMenuItem("Save into resource file" B_UTF8_ELLIPSIS,
NULL));
item->SetEnabled(false);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED),
'W', B_COMMAND_KEY));
menuBar->AddItem(menu);
// Top view and signature
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);
rect = topView->Bounds().InsetByCopy(8.0f, 8.0f);
fSignatureControl = new BTextControl(rect, "signature", "Signature:", NULL,
new BMessage(kMsgSignatureChanged), B_FOLLOW_LEFT_RIGHT);
fSignatureControl->SetModificationMessage(
new BMessage(kMsgSignatureChanged));
fSignatureControl->SetDivider(fSignatureControl->StringWidth(
fSignatureControl->Label()) + 4.0f);
float width, height;
fSignatureControl->GetPreferredSize(&width, &height);
fSignatureControl->ResizeTo(rect.Width(), height);
topView->AddChild(fSignatureControl);
// filter out invalid characters that can't be part of a MIME type name
BTextView* textView = fSignatureControl->TextView();
textView->SetMaxBytes(B_MIME_TYPE_LENGTH);
const char* disallowedCharacters = "<>@,;:\"()[]?=";
for (int32 i = 0; disallowedCharacters[i]; i++) {
textView->DisallowChar(disallowedCharacters[i]);
}
// "Application Flags" group
BFont font(be_bold_font);
font_height fontHeight;
font.GetHeight(&fontHeight);
width = font.StringWidth("Icon") + 16.0f;
if (width < B_LARGE_ICON + 16.0f)
width = B_LARGE_ICON + 16.0f;
rect.top = fSignatureControl->Frame().bottom + 4.0f;
rect.bottom = rect.top + 100.0f;
rect.right -= width + 8.0f;
BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
topView->AddChild(box);
fFlagsCheckBox = new BCheckBox(rect, "flags", "Application flags",
new BMessage(kMsgToggleAppFlags));
fFlagsCheckBox->SetValue(B_CONTROL_ON);
fFlagsCheckBox->ResizeToPreferred();
box->SetLabel(fFlagsCheckBox);
rect.top = fFlagsCheckBox->Bounds().Height() + 4.0f;
fSingleLaunchButton = new BRadioButton(rect, "single", "Single launch",
new BMessage(kMsgAppFlagsChanged));
fSingleLaunchButton->ResizeToPreferred();
box->AddChild(fSingleLaunchButton);
rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
fMultipleLaunchButton = new BRadioButton(rect, "multiple",
"Multiple launch", new BMessage(kMsgAppFlagsChanged));
fMultipleLaunchButton->ResizeToPreferred();
box->AddChild(fMultipleLaunchButton);
rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
fExclusiveLaunchButton = new BRadioButton(rect, "exclusive",
"Exclusive launch", new BMessage(kMsgAppFlagsChanged));
fExclusiveLaunchButton->ResizeToPreferred();
box->AddChild(fExclusiveLaunchButton);
rect.top = fSingleLaunchButton->Frame().top;
rect.left = fExclusiveLaunchButton->Frame().right + 4.0f;
fArgsOnlyCheckBox = new BCheckBox(rect, "args only", "Args only",
new BMessage(kMsgAppFlagsChanged));
fArgsOnlyCheckBox->ResizeToPreferred();
box->AddChild(fArgsOnlyCheckBox);
//.........这里部分代码省略.........
示例6: clipreg
NetworkWindow::NetworkWindow()
: BWindow(BRect(0, 0, 435, 309),"Network",
B_TITLED_WINDOW,B_NOT_ANCHORED_ON_ACTIVATE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE,
B_CURRENT_WORKSPACE)
{
BScreen screen;
BRect screenframe = screen.Frame(), bounds = Bounds(), workrect(0,0,1,1);
float width,height;
float screenx, screeny;
screenx = ((screenframe.right + 1) / 2) - (bounds.right / 2) - 1;
screeny = ((screenframe.bottom + 1) / 2) - (bounds.bottom / 2) - 1;
MoveTo(screenx, screeny);
fView = new BView(bounds,"View",B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(fView);
fRestart = new BButton(workrect,"Restart_Networking",
"Restart Networking",new BMessage(kRestart_Networking_M),
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fRestart->GetPreferredSize(&width,&height);
fRestart->ResizeTo(width,height);
fRestart->MoveTo(10,bounds.bottom - 10 - height);
// We fake the divider line by using a BBox. We have to call ConstrainClippingRegion
// because otherwise we also see the corners drawn, which doesn't look nice
BBox *vr = new BBox(BRect(width + 18, bounds.bottom - 11 - height, width + 19,
bounds.bottom - 9),
"vertical_rule", B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fView->AddChild(vr);
BRegion clipreg(vr->Bounds().InsetByCopy(0,2));
vr->ConstrainClippingRegion(&clipreg);
fRevert = new BButton(BRect(width + 25,bounds.bottom - 10 - height,width + 26,
bounds.bottom - 10),
"Revert","Revert", new BMessage(kRevert_M),
B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
fRevert->ResizeToPreferred();
fRevert->SetEnabled(false);
fSave = new BButton(workrect,"Save","Save",new BMessage(kSave_M),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
fSave->GetPreferredSize(&width,&height);
fSave->ResizeTo(width,height);
fSave->MoveTo(bounds.right - 10 - width, bounds.bottom - 10 - height);
fSave->MakeDefault(true);
fSave->SetEnabled(false);
BBox *hr = new BBox(BRect(0,bounds.bottom - height - 20,bounds.right,
bounds.bottom - height - 19),
"horizontal_rule",B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);
fView->AddChild(hr);
workrect = Bounds();
workrect.bottom = hr->Frame().top;
workrect.top = 10;
fTabView = new BTabView(workrect,"tab_view",B_WIDTH_FROM_WIDEST, B_FOLLOW_ALL);
fTabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fView->AddChild(fTabView);
bounds.bottom -= fTabView->TabHeight();
fView->AddChild(fRestart);
fView->AddChild(fRevert);
fView->AddChild(fSave);
bounds = fTabView->Bounds();
bounds.bottom -= fTabView->TabHeight();
fIdentityView = new BView(bounds,"Identity",B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
fIdentityView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fIdentity = new BTab();
fTabView->AddTab(fIdentityView,fIdentity);
// We can just pick a view to call StringWidth because we're not using anything
// except the unaltered be_plain_font. Note that for each BTextControl pair we
// just use the longer word of the two in order to save us some speed and code size
float labelwidth = fTabView->StringWidth("Domain name: ");
workrect.Set(10,20,11,21);
fDomain = new BTextControl(workrect,"Domain_Name","Domain name:"," ",
new BMessage(kSOMETHING_HAS_CHANGED_M));
// BTextControl::ResizeToPreferred() is a little strange for our purposes, so we
// get the preferred size and ignore the width that we get.
fDomain->GetPreferredSize(&width, &height);
fDomain->SetAlignment(B_ALIGN_RIGHT,B_ALIGN_LEFT);
fDomain->SetDivider(labelwidth);
workrect.left = 10;
workrect.right = 11;
workrect.top = height + 30;
workrect.bottom = workrect.top + height;
fHost = new BTextControl(workrect,"Host_Name","Host name:",NULL,
new BMessage(kSOMETHING_HAS_CHANGED_M));
//.........这里部分代码省略.........
示例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: b
// constructor
ObjectWindow::ObjectWindow(BRect frame, const char* name)
: BWindow(frame, name, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE)
{
BRect b(Bounds());
b.bottom = b.top + 8;
BMenuBar* menuBar = new BMenuBar(b, "menu bar");
AddChild(menuBar);
BMenu* menu = new BMenu("File");
menuBar->AddItem(menu);
menu->AddItem(new BMenu("Submenu"));
BMenuItem* menuItem = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED),
'Q');
menu->AddItem(menuItem);
b = Bounds();
b.top = menuBar->Bounds().bottom + 1;
b.right = ceilf((b.left + b.right) / 2.0);
BBox* bg = new BBox(b, "bg box", B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW,
B_PLAIN_BORDER);
AddChild(bg);
bg->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
// object view occupies the right side of the window
b.left = b.right + 1.0;
b.right = Bounds().right - B_V_SCROLL_BAR_WIDTH;
b.bottom -= B_H_SCROLL_BAR_HEIGHT;
fObjectView = new ObjectView(b, "object view", B_FOLLOW_ALL,
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
// wrap a scroll view around the object view
BScrollView* scrollView = new BScrollView("object scroller", fObjectView,
B_FOLLOW_ALL, 0, true, true, B_NO_BORDER);
if (BScrollBar* scrollBar = fObjectView->ScrollBar(B_VERTICAL)) {
scrollBar->SetRange(0.0, fObjectView->Bounds().Height());
scrollBar->SetProportion(0.5);
}
if (BScrollBar* scrollBar = fObjectView->ScrollBar(B_HORIZONTAL)) {
scrollBar->SetRange(0.0, fObjectView->Bounds().Width());
scrollBar->SetProportion(0.5);
}
AddChild(scrollView);
b = bg->Bounds();
// controls occupy the left side of the window
b.InsetBy(5.0, 5.0);
BBox* controlGroup = new BBox(b, "controls box",
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, B_FANCY_BORDER);
controlGroup->SetLabel("Controls");
bg->AddChild(controlGroup);
b = controlGroup->Bounds();
b.top += controlGroup->InnerFrame().top;
b.bottom = b.top + 25.0;
b.InsetBy(10.0, 10.0);
b.right = b.left + b.Width() / 2.0 - 5.0;
// new button
fNewB = new BButton(b, "new button", "New Object",
new BMessage(MSG_NEW_OBJECT));
controlGroup->AddChild(fNewB);
SetDefaultButton(fNewB);
// clear button
b.OffsetBy(0, fNewB->Bounds().Height() + 5.0);
fClearB = new BButton(b, "clear button", "Clear", new BMessage(MSG_CLEAR));
controlGroup->AddChild(fClearB);
// object type radio buttons
BMessage* message;
BRadioButton* radioButton;
b.OffsetBy(0, fClearB->Bounds().Height() + 5.0);
message = new BMessage(MSG_SET_OBJECT_TYPE);
message->AddInt32("type", OBJECT_LINE);
radioButton = new BRadioButton(b, "radio 1", "Line", message);
controlGroup->AddChild(radioButton);
radioButton->SetValue(B_CONTROL_ON);
b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
message = new BMessage(MSG_SET_OBJECT_TYPE);
message->AddInt32("type", OBJECT_RECT);
radioButton = new BRadioButton(b, "radio 2", "Rect", message);
controlGroup->AddChild(radioButton);
b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
message = new BMessage(MSG_SET_OBJECT_TYPE);
message->AddInt32("type", OBJECT_ROUND_RECT);
radioButton = new BRadioButton(b, "radio 3", "Round Rect", message);
controlGroup->AddChild(radioButton);
b.OffsetBy(0, radioButton->Bounds().Height() + 5.0);
//.........这里部分代码省略.........
示例9: 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);
}
示例10: BMessage
PPPStatusView::PPPStatusView(BRect rect, ppp_interface_id id)
: BView(rect, "PPPStatusView", B_FOLLOW_NONE, B_PULSE_NEEDED),
fInterface(id)
{
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
rect = Bounds();
rect.InsetBy(5, 5);
rect.left = rect.right - 80;
rect.bottom = rect.top + 25;
fButton = new BButton(rect, "DisconnectButton", kLabelDisconnect,
new BMessage(kMsgDisconnect));
rect.right = rect.left - 10;
rect.left = rect.right - 80;
rect.top += 5;
rect.bottom = rect.top + 15;
fTime = new BStringView(rect, "Time", "");
fTime->SetAlignment(B_ALIGN_RIGHT);
fTime->SetFont(be_fixed_font);
rect.right = rect.left - 10;
rect.left = 5;
BStringView *connectedSince = new BStringView(rect, "ConnectedSince",
kLabelConnectedSince);
connectedSince->SetFont(be_fixed_font);
rect = Bounds();
rect.InsetBy(5, 5);
rect.top += 35;
rect.right = rect.left + (rect.Width() - 5) / 2;
BBox *received = new BBox(rect, "Received");
received->SetLabel(kLabelReceived);
rect = received->Bounds();
rect.InsetBy(10, 15);
rect.bottom = rect.top + 15;
fBytesReceived = new BStringView(rect, "BytesReceived", "");
fBytesReceived->SetAlignment(B_ALIGN_RIGHT);
fBytesReceived->SetFont(be_fixed_font);
rect.top = rect.bottom + 5;
rect.bottom = rect.top + 15;
fPacketsReceived = new BStringView(rect, "PacketsReceived", "");
fPacketsReceived->SetAlignment(B_ALIGN_RIGHT);
fPacketsReceived->SetFont(be_fixed_font);
rect = received->Frame();
rect.OffsetBy(rect.Width() + 5, 0);
BBox *sent = new BBox(rect, "sent");
sent->SetLabel(kLabelSent);
rect = received->Bounds();
rect.InsetBy(10, 15);
rect.bottom = rect.top + 15;
fBytesSent = new BStringView(rect, "BytesSent", "");
fBytesSent->SetAlignment(B_ALIGN_RIGHT);
fBytesSent->SetFont(be_fixed_font);
rect.top = rect.bottom + 5;
rect.bottom = rect.top + 15;
fPacketsSent = new BStringView(rect, "PacketsSent", "");
fPacketsSent->SetAlignment(B_ALIGN_RIGHT);
fPacketsSent->SetFont(be_fixed_font);
received->AddChild(fBytesReceived);
received->AddChild(fPacketsReceived);
sent->AddChild(fBytesSent);
sent->AddChild(fPacketsSent);
AddChild(fButton);
AddChild(fTime);
AddChild(connectedSince);
AddChild(received);
AddChild(sent);
ppp_interface_info_t info;
fInterface.GetInterfaceInfo(&info);
fConnectedSince = info.info.connectedSince;
}
示例11: BMessage
// constructor
ColorPickerPanel::ColorPickerPanel(BRect frame, rgb_color color,
selected_color_mode mode,
BWindow* window,
BMessage* message, BHandler* target)
: Panel(frame, "Pick Color",
B_FLOATING_WINDOW_LOOK, B_FLOATING_SUBSET_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS |
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_CLOSABLE),
fWindow(window),
fMessage(message),
fTarget(target)
{
SetTitle(B_TRANSLATE("Pick a color"));
fColorPickerView = new ColorPickerView("color picker", color, mode);
#if LIB_LAYOUT
MButton* defaultButton = new MButton(B_TRANSLATE("OK"),
new BMessage(MSG_DONE), this);
// interface layout
BView* topView = new VGroup (
fColorPickerView,
new MBorder (
M_RAISED_BORDER, 5, "buttons",
new HGroup (
new Space(minimax(0.0, 0.0, 10000.0, 10000.0, 5.0)),
new MButton(B_TRANSLATE("Cancel"), new BMessage(MSG_CANCEL),
this),
new Space(minimax(5.0, 0.0, 10.0, 10000.0, 1.0)),
defaultButton,
new Space(minimax(2.0, 0.0, 2.0, 10000.0, 0.0)),
0
)
),
0
);
#else // LIB_LAYOUT
frame = BRect(0, 0, 40, 15);
BButton* defaultButton = new BButton(frame, "ok button",
B_TRANSLATE("OK"), new BMessage(MSG_DONE),
B_FOLLOW_RIGHT | B_FOLLOW_TOP);
defaultButton->ResizeToPreferred();
BButton* cancelButton = new BButton(frame, "cancel button",
B_TRANSLATE("Cancel"), new BMessage(MSG_CANCEL),
B_FOLLOW_RIGHT | B_FOLLOW_TOP);
cancelButton->ResizeToPreferred();
frame.bottom = frame.top + (defaultButton->Frame().Height() + 16);
frame.right = frame.left + fColorPickerView->Frame().Width();
BBox* buttonBox = new BBox(frame, "button group",
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP,
B_PLAIN_BORDER);
ResizeTo(frame.Width(),
fColorPickerView->Frame().Height() + frame.Height() + 1);
frame = Bounds();
BView* topView = new BView(frame, "bg", B_FOLLOW_ALL, 0);
topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
buttonBox->MoveTo(frame.left, frame.bottom - buttonBox->Frame().Height());
defaultButton->MoveTo(frame.right - defaultButton->Frame().Width() - 10,
frame.top + 8);
buttonBox->AddChild(defaultButton);
cancelButton->MoveTo(defaultButton->Frame().left - 10
- cancelButton->Frame().Width(),
frame.top + 8);
buttonBox->AddChild(cancelButton);
topView->AddChild(fColorPickerView);
topView->AddChild(buttonBox);
#endif // LIB_LAYOUT
SetDefaultButton(defaultButton);
if (fWindow)
AddToSubset(fWindow);
else
SetFeel(B_FLOATING_APP_WINDOW_FEEL);
AddChild(topView);
}
示例12: BMessage
TimeFormatSettingsView::TimeFormatSettingsView(BRect rect)
: SettingsView(rect, "WindowsSettingsView")
{
rect.OffsetTo(B_ORIGIN);
font_height fontHeight;
be_bold_font->GetHeight(&fontHeight);
rect.bottom = ceilf(fontHeight.ascent + fontHeight.descent) + 10;
BBox *clockBox = new BBox(rect, "Clock");
clockBox->SetLabel("Clock");
AddChild(clockBox);
rect.left = 8;
rect.top = rect.bottom - 8;
f24HrRadioButton = new BRadioButton(rect, "", "24 hour",
new BMessage(kSettingsContentsModified));
f24HrRadioButton->ResizeToPreferred();
clockBox->AddChild(f24HrRadioButton);
const float itemSpacing = f24HrRadioButton->Bounds().Height() + kItemExtraSpacing;
rect.OffsetBy(0, itemSpacing);
f12HrRadioButton = new BRadioButton(rect, "", "12 hour",
new BMessage(kSettingsContentsModified));
f12HrRadioButton->ResizeToPreferred();
clockBox->AddChild(f12HrRadioButton);
float width = max_c(f12HrRadioButton->Frame().right, f24HrRadioButton->Frame().right) + 8.0f;
clockBox->ResizeTo(width, clockBox->Bounds().Height()
+ 3 * f12HrRadioButton->Frame().Height());
rect = clockBox->Frame();
rect.OffsetBy(rect.Width() + 8, 0);
BBox *dateFormatBox = new BBox(rect, "Date order");
dateFormatBox->SetLabel("Date order");
AddChild(dateFormatBox);
rect = f24HrRadioButton->Frame();
fYMDRadioButton = new BRadioButton(rect, "", "Year-month-day",
new BMessage(kSettingsContentsModified));
fYMDRadioButton->ResizeToPreferred();
dateFormatBox->AddChild(fYMDRadioButton);
rect.OffsetBy(0, itemSpacing);
fDMYRadioButton = new BRadioButton(rect, "", "Day-month-year",
new BMessage(kSettingsContentsModified));
fDMYRadioButton->ResizeToPreferred();
dateFormatBox->AddChild(fDMYRadioButton);
rect.OffsetBy(0, itemSpacing);
fMDYRadioButton = new BRadioButton(rect, "", "Month-day-year",
new BMessage(kSettingsContentsModified));
fMDYRadioButton->ResizeToPreferred();
dateFormatBox->AddChild(fMDYRadioButton);
dateFormatBox->ResizeTo(fYMDRadioButton->Bounds().Width() + 16,
dateFormatBox->Bounds().Height());
BPopUpMenu *menu = new BPopUpMenu("Separator");
menu->AddItem(new BMenuItem("None", new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem("Space", new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem("-", new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem("/", new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem("\\", new BMessage(kSettingsContentsModified)));
menu->AddItem(new BMenuItem(".", new BMessage(kSettingsContentsModified)));
rect.left = 0;
rect.top = clockBox->Frame().bottom + 8;
rect.right = Bounds().Width() - 8;
rect.bottom = rect.top + itemSpacing;
fSeparatorMenuField = new BMenuField(rect, "Separator", "Separator:", menu);
fSeparatorMenuField->SetDivider(fSeparatorMenuField->StringWidth(fSeparatorMenuField->Label()) + 8.0f);
fSeparatorMenuField->SetAlignment(B_ALIGN_LEFT);
fSeparatorMenuField->ResizeToPreferred();
AddChild(fSeparatorMenuField);
rect.OffsetBy(0, itemSpacing + 10);
BStringView *exampleView = new BStringView(rect, "", "Examples:");
exampleView->ResizeToPreferred();
AddChild(exampleView);
rect.OffsetBy(0, itemSpacing);
fLongDateExampleView = new BStringView(rect, "", "");
fLongDateExampleView->ResizeToPreferred();
AddChild(fLongDateExampleView);
rect.OffsetBy(0, itemSpacing);
fShortDateExampleView = new BStringView(rect, "", "");
fShortDateExampleView->ResizeToPreferred();
AddChild(fShortDateExampleView);
_UpdateExamples();
}
示例13: r
void
CDPlayer::BuildGUI()
{
fStopColor.red = 80;
fStopColor.green = 164;
fStopColor.blue = 80;
fStopColor.alpha = 255;
fPlayColor.red = 40;
fPlayColor.green = 230;
fPlayColor.blue = 40;
fPlayColor.alpha = 255;
BRect r(Bounds().InsetByCopy(10, 10));
BBox *box = new BBox(r, "", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
AddChild(box);
r = box->Bounds().InsetByCopy(10, 10);
r.bottom = 25;
float labelWidth, labelHeight;
fCDTitle = new BStringView(r, "CDTitle", B_TRANSLATE("CD drive is empty"),
B_FOLLOW_LEFT_RIGHT);
fCDTitle->GetPreferredSize(&labelWidth, &labelHeight);
fCDTitle->ResizeTo(r.Width(), labelHeight);
box->AddChild(fCDTitle);
r.bottom = r.top + labelHeight;
r.OffsetBy(0, r.Height() + 5);
fCurrentTrack = new BStringView(r, "TrackNumber",
"", B_FOLLOW_LEFT_RIGHT);
box->AddChild(fCurrentTrack);
r.OffsetBy(0, r.Height() + 5);
r.right = r.left + (r.Width() / 2);
fTrackTime = new BStringView(r, "TrackTime",
B_TRANSLATE("Track: 88:88 / 88:88"), B_FOLLOW_LEFT_RIGHT);
fTrackTime->ResizeToPreferred();
fTrackTime->SetText(B_TRANSLATE("Track: --:-- / --:--"));
box->AddChild(fTrackTime);
r.OffsetTo(fTrackTime->Frame().right + 5, r.top);
fDiscTime = new BStringView(r, "DiscTime",
B_TRANSLATE("Disc: 88:88 / 88:88"), B_FOLLOW_RIGHT);
fDiscTime->ResizeToPreferred();
fDiscTime->SetText(B_TRANSLATE("Disc: --:-- / --:--"));
box->AddChild(fDiscTime);
float maxWidth = max_c(fDiscTime->Frame().right, fCDTitle->Frame().right);
box->ResizeTo(maxWidth + 5, fDiscTime->Frame().bottom + 10);
fStop = new DrawButton(BRect(0, 0, 1, 1), "Stop",
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "stop_up"),
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "stop_down"),
new BMessage(M_STOP), B_FOLLOW_BOTTOM, B_WILL_DRAW);
fStop->ResizeToPreferred();
fStop->MoveTo(10, box->Frame().bottom + 15);
fStop->SetDisabled(BTranslationUtils::GetBitmap(B_PNG_FORMAT,
"stop_disabled"));
AddChild(fStop);
float stopTop = fStop->Frame().top;
fPlay = new TwoStateDrawButton(BRect(0, 0, 1, 1), "Play",
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_up"),
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_down"),
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_up_on"),
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "play_down"),
new BMessage(M_PLAY), B_FOLLOW_NONE, B_WILL_DRAW);
fPlay->ResizeToPreferred();
fPlay->MoveTo(fStop->Frame().right + 2, stopTop);
AddChild(fPlay);
fPrevTrack = new DrawButton(BRect(0, 0, 1, 1), "PrevTrack",
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "prev_up"),
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "prev_down"),
new BMessage(M_PREV_TRACK), 0, B_WILL_DRAW);
fPrevTrack->ResizeToPreferred();
fPrevTrack->MoveTo(fPlay->Frame().right + 40, stopTop);
AddChild(fPrevTrack);
fNextTrack = new DrawButton(BRect(0, 0, 1, 1), "NextTrack",
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "next_up"),
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "next_down"),
new BMessage(M_NEXT_TRACK), 0, B_WILL_DRAW);
fNextTrack->ResizeToPreferred();
fNextTrack->MoveTo(fPrevTrack->Frame().right + 1, stopTop);
AddChild(fNextTrack);
fRewind = new DoubleShotDrawButton(BRect(0, 0, 1, 1), "Rewind",
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "rew_up"),
BTranslationUtils::GetBitmap(B_PNG_FORMAT, "rew_down"),
new BMessage(M_REWIND), 0, B_WILL_DRAW);
fRewind->ResizeToPreferred();
fRewind->MoveTo(fNextTrack->Frame().right + 40, stopTop);
AddChild(fRewind);
//.........这里部分代码省略.........