本文整理汇总了C++中BScrollView::SetResizingMode方法的典型用法代码示例。如果您正苦于以下问题:C++ BScrollView::SetResizingMode方法的具体用法?C++ BScrollView::SetResizingMode怎么用?C++ BScrollView::SetResizingMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BScrollView
的用法示例。
在下文中一共展示了BScrollView::SetResizingMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:
// Private function to switch between follow bottom behaviour
void
OutputFormatView::MakeFollowBottom(bool flag)
{
scroll_view->SetResizingMode(B_FOLLOW_LEFT_RIGHT | (flag ? B_FOLLOW_TOP_BOTTOM : B_FOLLOW_TOP));
cancel_button->SetResizingMode(B_FOLLOW_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
the_button->SetResizingMode(B_FOLLOW_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
info_caption->SetResizingMode(B_FOLLOW_LEFT_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
info_view->SetResizingMode(B_FOLLOW_LEFT_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
if (config_caption)
config_caption->SetResizingMode(B_FOLLOW_LEFT_RIGHT | (flag ? B_FOLLOW_BOTTOM : B_FOLLOW_TOP));
}
示例3: r
//.........这里部分代码省略.........
// 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,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
0, false, true);
top->AddChild(scroll);
fCommandView->MakeEditable(false);
fOK = new BButton(r, "ok", "Import", new BMessage(M_SCM_IMPORT),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
fOK->ResizeToPreferred();
fOK->MoveTo(Bounds().right - 10.0 - fOK->Bounds().Width(),
scroll->Frame().bottom + 10.0);
ResizeTo(Bounds().Width(), fOK->Frame().bottom + 10.0);
scroll->SetResizingMode(B_FOLLOW_ALL);
top->AddChild(fOK);
fOK->MakeDefault(true);
fOK->SetEnabled(false);
UpdateCommand();
fProviderField->MakeFocus(true);
}
示例4: cat
//.........这里部分代码省略.........
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);
BScrollView *dirscroll = new BScrollView("directions_scroller",fDirectionsBox,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,0,false, true);
back->AddChild(dirscroll);
fOK = new BButton(BRect(10,10,11,11),"ok","Cancel", new BMessage(M_ADD_RECIPE),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
fOK->ResizeToPreferred();
fOK->SetLabel("OK");
fOK->MoveTo(Bounds().right - fOK->Bounds().Width() - 10,
Bounds().bottom - fOK->Bounds().Height() - 10);
r = fOK->Frame();
back->AddChild(fOK);
r.OffsetBy(-r.Width() - 10, 0);
fCancel = new BButton(r,"cancel","Cancel",new BMessage(B_QUIT_REQUESTED),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
back->AddChild(fCancel);
field->MakeFocus(true);
ResizeTo(Bounds().Width(),
fDirectionsBox->Parent()->Frame().bottom + 20 + fOK->Bounds().Height());
dirscroll->SetResizingMode(B_FOLLOW_ALL);
// This is the part that's different for editing a recipe as opposed to
// just adding one to the database
if(number >= 0 && category)
{
SetTitle("Edit Recipe");
BString name, ingredients, directions;
if(GetRecipe(number,category,name,ingredients,directions))
{
BMenuItem *item = fCategories->FindItem(category);
if(item)
item->SetMarked(true);
fNameBox->SetText(name.String());
fIngredientBox->SetText(ingredients.String());
fDirectionsBox->SetText(directions.String());
fOK->SetMessage(new BMessage(M_EDIT_RECIPE));
}
}
AddShortcut(B_ENTER, B_COMMAND_KEY, new BMessage(fOK->Command()));
}