本文整理汇总了C++中BScrollView::Frame方法的典型用法代码示例。如果您正苦于以下问题:C++ BScrollView::Frame方法的具体用法?C++ BScrollView::Frame怎么用?C++ BScrollView::Frame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BScrollView
的用法示例。
在下文中一共展示了BScrollView::Frame方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Bounds
void
TSignatureView::AttachedToWindow()
{
BRect rect = Bounds();
float name_text_length = StringWidth(kNameText);
float sig_text_length = StringWidth(kSigText);
float divide_length;
if (name_text_length > sig_text_length)
divide_length = name_text_length;
else
divide_length = sig_text_length;
rect.InsetBy(8,0);
rect.top+= 8;
fName = new TNameControl(rect, kNameText, new BMessage(NAME_FIELD));
AddChild(fName);
fName->SetDivider(divide_length + 10);
fName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
rect.OffsetBy(0,fName->Bounds().Height()+5);
rect.bottom = rect.top + kSigHeight;
rect.left = fName->TextView()->Frame().left;
BRect text = rect;
text.OffsetTo(10,0);
fTextView = new TSigTextView(rect, text);
BScrollView *scroller = new BScrollView("SigScroller", fTextView, B_FOLLOW_ALL, 0, false, true);
AddChild(scroller);
scroller->ResizeBy(-1 * scroller->ScrollBar(B_VERTICAL)->Frame().Width() - 9, 0);
scroller->MoveBy(7,0);
/* back up a bit to make room for the label */
rect = scroller->Frame();
BStringView *stringView = new BStringView(rect, "SigLabel", kSigText);
AddChild(stringView);
float tWidth, tHeight;
stringView->GetPreferredSize(&tWidth, &tHeight);
/* the 5 is for the spacer in the TextView */
rect.OffsetBy(-1 *(tWidth) - 5, 0);
rect.right = rect.left + tWidth;
rect.bottom = rect.top + tHeight;
stringView->MoveTo(rect.LeftTop());
stringView->ResizeTo(rect.Width(), rect.Height());
/* Resize the View to the correct height */
scroller->SetResizingMode(B_FOLLOW_NONE);
ResizeTo(Frame().Width(), scroller->Frame().bottom + 8);
scroller->SetResizingMode(B_FOLLOW_ALL);
}
示例2: r
StartWindow::StartWindow(void)
: DWindow(BRect(0,0,400,300),"Paladin",B_DOCUMENT_WINDOW, B_NOT_ZOOMABLE)
{
RegisterWindow();
AddShortcut('O',B_COMMAND_KEY, new BMessage(M_SHOW_OPEN_PROJECT));
AddShortcut('N',B_COMMAND_KEY, new BMessage(M_NEW_PROJECT));
AddShortcut('I',B_COMMAND_KEY, new BMessage(M_SHOW_IMPORT));
AddCommonFilter(new EscapeCancelFilter());
MakeCenteredOnShow(true);
BView *top = GetBackgroundView();
fNewButton = MakeButton("new","NewProjectButtonUp.png","NewProjectButtonDown.png",
M_NEW_PROJECT);
top->AddChild(fNewButton);
fNewButton->MoveTo(10,10);
ClickableStringView *label = MakeLabel(fNewButton,TR("Create a new project"));
top->AddChild(label);
label->SetMessage(new BMessage(M_NEW_PROJECT));
fOpenButton = MakeButton("open","OpenProjectButtonUp.png",
"OpenProjectButtonDown.png", M_SHOW_OPEN_PROJECT);
top->AddChild(fOpenButton);
fOpenButton->MoveTo(10,fNewButton->Frame().bottom + 10.0);
label = MakeLabel(fOpenButton,"Open a project");
top->AddChild(label);
label->SetMessage(new BMessage(M_SHOW_OPEN_PROJECT));
fOpenRecentButton = MakeButton("openrecent","OpenRecentButtonUp.png",
"OpenRecentButtonDown.png", M_OPEN_SELECTION);
top->AddChild(fOpenRecentButton);
fOpenRecentButton->MoveTo(10,fOpenButton->Frame().bottom + 10.0);
SetToolTip(fOpenRecentButton,TR("Open a project in the list on the right. You "
"can also press Command + a number key."));
label = MakeLabel(fOpenRecentButton,TR("Open the selected project"));
top->AddChild(label);
label->SetMessage(new BMessage(M_OPEN_SELECTION));
BRect r(Bounds());
r.left = label->Frame().right + 20.0;
r.right -= B_V_SCROLL_BAR_WIDTH + 10.0;
r.top += 10.0;
r.bottom -= 10.0;
fListView = new StartWindowList(r);
BScrollView *scrollView = new BScrollView("scroller",fListView,0,
B_FOLLOW_ALL, false, true);
top->AddChild(scrollView);
fListView->SetInvocationMessage(new BMessage(M_OPEN_SELECTION));
SetToolTip(fListView, "Open a recent project. You can also press Command + a number key.");
fQuickImportButton = MakeButton("quickimport","QuickImportButtonUp.png",
"QuickImportButtonDown.png",M_SHOW_IMPORT);
top->AddChild(fQuickImportButton);
fQuickImportButton->MoveTo(10,fOpenRecentButton->Frame().bottom + 10.0);
label = MakeLabel(fQuickImportButton,"Import an existing project");
top->AddChild(label);
label->SetMessage(new BMessage(M_SHOW_IMPORT));
SetToolTip(label,TR("Quickly make a project by importing all source files and resource files.\n"
"You can also import a BeIDE project."));
SetToolTip(fQuickImportButton,
TR("Quickly make a project by importing all source files and resource files.\n"
"You can also import a BeIDE project."));
fOnlineImportButton = MakeButton("onlineimport","OnlineImportButtonUp.png",
"OnlineImportButtonDown.png",M_ONLINE_IMPORT);
top->AddChild(fOnlineImportButton);
fOnlineImportButton->MoveTo(10,fQuickImportButton->Frame().bottom + 10.0);
label = MakeLabel(fOnlineImportButton,"Import a project from online");
top->AddChild(label);
label->SetMessage(new BMessage(M_ONLINE_IMPORT));
SetToolTip(label,TR("Import a project from an online repository"));
SetToolTip(fQuickImportButton,
TR("Import a project from an online repository"));
#ifdef DISABLE_ONLINE_IMPORT
fOnlineImportButton->Hide();
SetSizeLimits(scrollView->Frame().left + 110.0,30000,
fQuickImportButton->Frame().bottom + 10.0,30000);
ResizeTo(scrollView->Frame().left + 160.0,fQuickImportButton->Frame().bottom + 10.0);
#else
SetSizeLimits(scrollView->Frame().left + 110.0,30000,
fOnlineImportButton->Frame().bottom + 10.0,30000);
ResizeTo(scrollView->Frame().left + 160.0,fOnlineImportButton->Frame().bottom + 10.0);
#endif
BMessenger msgr(this);
BEntry entry(gProjectPath.GetFullPath());
entry_ref ref;
//.........这里部分代码省略.........
示例3: r
SCMImportWindow::SCMImportWindow(void)
: DWindow(BRect(0,0,350,300), "Import from Repository")
{
MakeCenteredOnShow(true);
BView *top = GetBackgroundView();
BMenu *menu = new BMenu("Providers");
for (int32 i = 0; i < fProviderMgr.CountImporters(); i++)
{
SCMProjectImporter *importer = fProviderMgr.ImporterAt(i);
if (!importer)
continue;
BMessage *msg = new BMessage(M_USE_PROVIDER);
menu->AddItem(new BMenuItem(importer->GetName(), msg));
}
// Disable custom commands for now
// menu->AddSeparatorItem();
// menu->AddItem(new BMenuItem("Custom", new BMessage(M_USE_CUSTOM_PROVIDER)));
menu->SetLabelFromMarked(true);
menu->ItemAt(0L)->SetMarked(true);
BRect r(Bounds());
r.InsetBy(10.0, 10.0);
r.bottom = 40.0;
fProviderField = new BMenuField(r, "repofield", "Provider: ", menu,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
float pw, ph;
fProviderField->GetPreferredSize(&pw, &ph);
fProviderField->ResizeTo(r.Width(), ph);
top->AddChild(fProviderField);
r = fProviderField->Frame();
menu = new BMenu("Methods");
if (gHgAvailable)
menu->AddItem(new BMenuItem("Mercurial", new BMessage(M_UPDATE_COMMAND)));
if (gGitAvailable)
menu->AddItem(new BMenuItem("Git", new BMessage(M_UPDATE_COMMAND)));
if (gSvnAvailable)
menu->AddItem(new BMenuItem("Subversion", new BMessage(M_UPDATE_COMMAND)));
menu->SetLabelFromMarked(true);
menu->ItemAt(0L)->SetMarked(true);
fProvider = fProviderMgr.ImporterAt(0);
r.OffsetBy(0.0, r.Height() + 10.0);
fSCMField = new BMenuField(r, "scmfield", "Method: ", menu,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
top->AddChild(fSCMField);
r.OffsetBy(0.0, r.Height() + 10.0);
fProjectBox = new AutoTextControl(r, "project", "Project: ", "",
new BMessage(M_UPDATE_COMMAND),
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
fProjectBox->GetPreferredSize(&pw, &ph);
fProjectBox->ResizeTo(r.Width(), ph);
r = fProjectBox->Frame();
top->AddChild(fProjectBox);
r.OffsetBy(0.0, r.Height() + 10.0);
fAnonymousBox = new BCheckBox(r, "anonymous", "Anonymous check-out",
new BMessage(M_TOGGLE_ANONYMOUS));
top->AddChild(fAnonymousBox);
fAnonymousBox->ResizeToPreferred();
fAnonymousBox->SetValue(B_CONTROL_ON);
r.OffsetBy(0.0, fAnonymousBox->Bounds().Height() + 10.0);
fUserNameBox = new AutoTextControl(r, "username", "Username: ", "",
new BMessage(M_UPDATE_COMMAND),
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
top->AddChild(fUserNameBox);
fUserNameBox->SetEnabled(false);
r.OffsetBy(0.0, r.Height() + 10.0);
fRepository = new AutoTextControl(r, "repository", "Repository (opt.): ", "",
new BMessage(M_UPDATE_COMMAND),
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
fRepository->GetPreferredSize(&pw, &ph);
fRepository->ResizeTo(r.Width(), ph);
r = fRepository->Frame();
top->AddChild(fRepository);
r.OffsetBy(0.0, r.Height() + 10.0);
fCommandLabel = new BStringView(r, "commandlabel", "Command: ",
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
fCommandLabel->ResizeToPreferred();
top->AddChild(fCommandLabel);
r.OffsetBy(0.0, fCommandLabel->Bounds().Height() + 5.0);
r.bottom = r.top + 75.0;
r.right -= B_V_SCROLL_BAR_WIDTH;
BRect textRect = r.OffsetToCopy(0.0, 0.0).InsetByCopy(10.0, 10.0);
fCommandView = new BTextView(r, "command", textRect, B_FOLLOW_ALL);
BScrollView *scroll = new BScrollView("scrollview", fCommandView,
//.........这里部分代码省略.........
示例4: 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);
//.........这里部分代码省略.........
示例5: BMessage
//.........这里部分代码省略.........
float keyCellWidth = be_plain_font->StringWidth("Caps Lock") + 20;
fColumnListView->AddColumn(new CLVColumn(B_TRANSLATE("Key"),
CreateKeysPopUp(), keyCellWidth, CLV_SORT_KEYABLE));
minListWidth += keyCellWidth + 1;
BPopUpMenu* popup = new BPopUpMenu(NULL, false);
popup->AddItem(new BMenuItem(
B_TRANSLATE("(Choose application with file requester)"), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*InsertString \"Your Text Here\""), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*MoveMouse +20 +0"), NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*MoveMouseTo 50% 50%"), NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*MouseButton 1"), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*LaunchHandler text/html"), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\""),
NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*MouseDown"), NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*MouseUp"), NULL));
popup->AddItem(new BMenuItem(
B_TRANSLATE("*SendMessage application/x-vnd.Be-TRAK 'Tfnd'"), NULL));
popup->AddItem(new BMenuItem(B_TRANSLATE("*Beep"), NULL));
fColumnListView->AddColumn(new CLVColumn(B_TRANSLATE("Application"), popup,
323.0, CLV_SORT_KEYABLE));
minListWidth += 323.0 + 1;
minListWidth += B_V_SCROLL_BAR_WIDTH;
fColumnListView->SetSortFunction(ShortcutsSpec::MyCompare);
top->AddChild(containerView);
fColumnListView->SetSelectionMessage(new BMessage(HOTKEY_ITEM_SELECTED));
fColumnListView->SetTarget(this);
fAddButton = new BButton(BRect(0, 0, 0, 0), "add",
B_TRANSLATE("Add new shortcut"), new BMessage(ADD_HOTKEY_ITEM),
B_FOLLOW_BOTTOM);
fAddButton->ResizeToPreferred();
fAddButton->MoveBy(spacing,
Bounds().bottom - fAddButton->Bounds().bottom - spacing);
top->AddChild(fAddButton);
fRemoveButton = new BButton(BRect(0, 0, 0, 0), "remove",
B_TRANSLATE("Remove selected shortcut"),
new BMessage(REMOVE_HOTKEY_ITEM), B_FOLLOW_BOTTOM);
fRemoveButton->ResizeToPreferred();
fRemoveButton->MoveBy(fAddButton->Frame().right + spacing,
Bounds().bottom - fRemoveButton->Bounds().bottom - spacing);
top->AddChild(fRemoveButton);
fRemoveButton->SetEnabled(false);
fSaveButton = new BButton(BRect(0, 0, 0, 0), "save",
B_TRANSLATE("Save & apply"), new BMessage(SAVE_KEYSET),
B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT);
fSaveButton->ResizeToPreferred();
fSaveButton->MoveBy(Bounds().right - fSaveButton->Bounds().right - spacing,
Bounds().bottom - fSaveButton->Bounds().bottom - spacing);
top->AddChild(fSaveButton);
fSaveButton->SetEnabled(false);
containerView->ResizeBy(0,
-(fAddButton->Bounds().bottom + 2 * spacing + 2));
float minButtonBarWidth = fRemoveButton->Frame().right
+ fSaveButton->Bounds().right + 2 * spacing;
float minWidth = max_c(minListWidth, minButtonBarWidth);
float menuBarHeight = menuBar->Bounds().bottom;
float buttonBarHeight = Bounds().bottom - containerView->Frame().bottom;
float minHeight = menuBarHeight + 200 + buttonBarHeight;
SetSizeLimits(minWidth, MAX_WIDTH, minHeight, MAX_HEIGHT);
// SetSizeLimits() will resize the window to the minimum size.
CenterOnScreen();
entry_ref windowSettingsRef;
if (_GetWindowSettingsFile(&windowSettingsRef)) {
// The window settings file is not accepted via B_REFS_RECEIVED; this
// is a behind-the-scenes file that the user will never see or
// interact with.
BFile windowSettingsFile(&windowSettingsRef, B_READ_ONLY);
BMessage loadMsg;
if (loadMsg.Unflatten(&windowSettingsFile) == B_OK)
_LoadWindowSettings(loadMsg);
}
entry_ref keySetRef;
if (_GetSettingsFile(&keySetRef)) {
BMessage msg(B_REFS_RECEIVED);
msg.AddRef("refs", &keySetRef);
msg.AddString("startupRef", "please");
PostMessage(&msg);
// Tell ourselves to load this file if it exists.
}
Show();
}
示例6: cat
RecipeEditor::RecipeEditor(const BRect &frame, const BMessenger &msgr,
const int32 &number, const char *category)
: BWindow(frame,"Add Recipe",B_FLOATING_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS),
fMessenger(msgr),
fNumber(number),
fCategory(category)
{
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
AddShortcut('Q', B_COMMAND_KEY, new BMessage(M_QUIT_APP));
BView *back = new BView(Bounds(),"back",B_FOLLOW_ALL, B_WILL_DRAW);
back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(back);
fCategories = new BMenu("Categories");
CppSQLite3Query query = DBQuery("select category from categories order by category;",
"RecipeEditor:get categories");
while(!query.eof())
{
BString cat(DeescapeIllegalCharacters(query.getStringField(0)));
BMessage *menumsg = new BMessage(M_CATEGORY_CHANGED);
menumsg->AddString("name",cat);
fCategories->AddItem(new BMenuItem(cat.String(),menumsg));
query.nextRow();
}
fCategories->SetRadioMode(true);
fCategories->SetLabelFromMarked(true);
if(fCategories->CountItems()>0)
fCategories->ItemAt(0)->SetMarked(true);
BRect r(10,10,10 + fCategories->MaxContentWidth(),11);
BMenuField *field = new BMenuField(r,"field","Category",fCategories,
B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP);
back->AddChild(field);
field->ResizeToPreferred();
r = field->Frame();
if(category)
{
BMenuItem *marked = fCategories->FindItem(category);
if(marked)
marked->SetMarked(true);
}
else
{
BMenuItem *marked = fCategories->ItemAt(0L);
if(marked)
marked->SetMarked(true);
}
r.OffsetBy(0,r.Height() + 10);
fNameBox = new AutoTextControl(r,"namebox","Name: ",NULL,NULL,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
B_WILL_DRAW | B_PULSE_NEEDED | B_NAVIGABLE |
B_NAVIGABLE_JUMP);
fNameBox->SetEscapeCancel(true);
fNameBox->SetDivider(be_plain_font->StringWidth("Name ") + 5);
back->AddChild(fNameBox);
fNameBox->ResizeToPreferred();
r = fNameBox->Frame();
r.right = Bounds().right - 10;
fNameBox->ResizeTo(r.Width(), r.Height());
r.OffsetBy(0,r.Height() + 10);
BStringView *label = new BStringView(r,"inglabel","Ingredients:");
back->AddChild(label);
r.OffsetBy(0,r.Height() + 10);
r.bottom = r.top + 100;
r.right -= B_V_SCROLL_BAR_WIDTH;
BRect textrect = r.OffsetToCopy(0,0);
textrect.InsetBy(10,10);
fIngredientBox = new BTextView(r, "ingredients", textrect, B_FOLLOW_ALL,
B_WILL_DRAW | B_PULSE_NEEDED | B_NAVIGABLE |
B_NAVIGABLE_JUMP);
fIngredientBox->SetDoesUndo(true);
BScrollView *ingredscroll = new BScrollView("ingredients_scroller",fIngredientBox,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,0,false, true);
back->AddChild(ingredscroll);
r = ingredscroll->Frame();
label = new BStringView(BRect(10,10,11,11),"dirlabel","Directions:");
label->ResizeToPreferred();
label->MoveTo(10, r.bottom + 10);
back->AddChild(label);
r.OffsetBy(0,r.Height() + 20 + label->Frame().Height());
r.right -= B_V_SCROLL_BAR_WIDTH;
textrect = r.OffsetToCopy(0,0);
textrect.InsetBy(10,10);
fDirectionsBox = new BTextView(r, "directions", textrect, B_FOLLOW_ALL,
B_WILL_DRAW | B_PULSE_NEEDED | B_NAVIGABLE |
B_NAVIGABLE_JUMP);
fDirectionsBox->SetDoesUndo(true);
//.........这里部分代码省略.........
示例7: boundsRect
NetworkPrefsView::NetworkPrefsView (BRect bounds, const char *name)
: BView (
bounds,
name,
B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
fNickUpButton (NULL),
fNickDnButton (NULL),
fNickPrompt (NULL),
fNetPrompt (NULL),
fDupePrompt (NULL),
fServerPrefs (NULL)
{
SetViewColor (ui_color (B_PANEL_BACKGROUND_COLOR));
BMenu *menu (new BMenu (B_TRANSLATE("Network")));
menu->AddItem (new BMenuItem (B_TRANSLATE("Defaults"), new BMessage (M_NETWORK_DEFAULTS)));
menu->AddSeparatorItem ();
BString itemText = B_TRANSLATE("Add network" B_UTF8_ELLIPSIS);
menu->AddItem (new BMenuItem (itemText.String(), new BMessage (M_ADD_NEW_NETWORK)));
menu->AddItem (fRemoveItem = new BMenuItem (B_TRANSLATE("Remove current network"), new BMessage (M_REMOVE_CURRENT_NETWORK)));
itemText = B_TRANSLATE("Duplicate current network" B_UTF8_ELLIPSIS);
menu->AddItem (fDupeItem = new BMenuItem (itemText.String(), new BMessage (M_DUPE_CURRENT_NETWORK)));
fNetworkMenu = new BMenuField (BRect (0, 0, 100, 30), "NetList", NULL, menu);
fMainNetBox = new BBox (Bounds ().InsetByCopy (5, 5));
fMainNetBox->SetLabel (fNetworkMenu);
AddChild (fMainNetBox);
BRect boundsRect (Bounds ().InsetByCopy (10, 15));
boundsRect.right /= 2;
boundsRect.right -= 8;
boundsRect.top += 15;
boundsRect.bottom -= 30;
fNetDetailsBox = new BBox (boundsRect);
fNetDetailsBox->SetLabel (B_TRANSLATE("Network Details"));
fMainNetBox->AddChild (fNetDetailsBox);
fPersonalBox = new BBox (boundsRect);
fPersonalBox->SetLabel (B_TRANSLATE("Personal Details"));
fMainNetBox->AddChild (fPersonalBox);
fPersonalBox->MoveBy (boundsRect.Width () + 16, 0);
boundsRect.left += 10;
boundsRect.right = boundsRect.left + 10;
boundsRect.top = 10;
boundsRect.bottom += 20;
BStringView *stringView1 (new BStringView(boundsRect, NULL,
B_TRANSLATE("Primary server: ")));
stringView1->ResizeToPreferred();
fNetDetailsBox->AddChild(stringView1);
stringView1->MoveTo(fNetDetailsBox->Frame().left, fNetDetailsBox->Frame().top);
fConnectServer = new BStringView(boundsRect, NULL, "irc.freenode.net");
fConnectServer->ResizeToPreferred();
fNetDetailsBox->AddChild(fConnectServer);
fConnectServer->MoveTo(stringView1->Frame().left, stringView1->Frame().bottom);
fAlternates = new BStringView(boundsRect, NULL, B_TRANSLATE("Fallbacks: %1"));
fAlternates->ResizeToPreferred();
fNetDetailsBox->AddChild(fAlternates);
fAlternates->MoveTo(fConnectServer->Frame().left, fConnectServer->Frame().bottom);
itemText = B_TRANSLATE("Edit servers" B_UTF8_ELLIPSIS);
fServerButton = new BButton (boundsRect, NULL, itemText.String(),
new BMessage (M_SERVER_DIALOG));
fServerButton->ResizeToPreferred ();
fServerButton->MoveTo (fNetDetailsBox->Frame().right - (fServerButton->Frame().Width() + 20),
fAlternates->Frame().bottom + 10.0);
fNetDetailsBox->AddChild (fServerButton);
itemText = B_TRANSLATE("Autoexec");
itemText += ":";
BStringView *stringView4 (new BStringView (boundsRect, NULL, itemText.String()));
stringView4->ResizeToPreferred ();
stringView4->MoveTo (fNetDetailsBox->Frame().left, fServerButton->Frame ().bottom);
fNetDetailsBox->AddChild (stringView4);
boundsRect = fNetDetailsBox->Frame ();
boundsRect.right -= (20 + B_V_SCROLL_BAR_WIDTH);;
boundsRect.top = stringView4->Frame ().bottom + 5;
boundsRect.bottom -= 65;
fTextView = new InvokingTextView (boundsRect, NULL, new BMessage(M_NETPREFS_TEXT_INVOKE), this, B_FOLLOW_NONE, B_WILL_DRAW);
BScrollView *scrollView (new BScrollView (NULL, fTextView, B_FOLLOW_LEFT | B_FOLLOW_TOP,
0, false, true));
fTextView->MakeEditable (true);
fTextView->SetStylable (false);
fNetDetailsBox->AddChild (scrollView);
fLagCheckBox = new BCheckBox (boundsRect, NULL, B_TRANSLATE("Enable lag checking"),
new BMessage (M_NET_CHECK_LAG));
fLagCheckBox->ResizeToPreferred ();
fLagCheckBox->MoveTo (scrollView->Frame().left,
scrollView->Frame ().bottom + 5);
fNetDetailsBox->AddChild (fLagCheckBox);
fStartupBox = new BCheckBox (boundsRect, NULL, B_TRANSLATE("Connect to this network when Vision starts up"),
new BMessage (M_CONNECT_ON_STARTUP));
fStartupBox->ResizeToPreferred ();
fStartupBox->MoveTo (fNetDetailsBox->Frame ().left, fMainNetBox->Frame ().bottom - (fStartupBox->Bounds ().Height () + 12));
fMainNetBox->AddChild (fStartupBox);
fNickDefaultsBox = new BCheckBox (boundsRect, NULL, B_TRANSLATE("Use Defaults"),
new BMessage (M_USE_NICK_DEFAULTS));
fNickDefaultsBox->ResizeToPreferred ();
fNickDefaultsBox->MoveTo (fNetDetailsBox->Frame ().left, fNetDetailsBox->Frame ().top);
fPersonalBox->AddChild (fNickDefaultsBox);
itemText = B_TRANSLATE("Preferred Nicknames:");
BStringView *stringView5 (new BStringView (boundsRect, NULL, B_TRANSLATE("Preferred Nicknames:")));
stringView5->ResizeToPreferred ();
stringView5->MoveTo (fNetDetailsBox->Frame ().left, fNickDefaultsBox->Frame ().bottom + 5);
fPersonalBox->AddChild (stringView5);
fListView = new BListView (scrollView->Frame (), NULL);
fListView->SetSelectionMessage (new BMessage (M_NICK_SELECTED));
//.........这里部分代码省略.........