本文整理汇总了C++中BScrollView::ResizeBy方法的典型用法代码示例。如果您正苦于以下问题:C++ BScrollView::ResizeBy方法的具体用法?C++ BScrollView::ResizeBy怎么用?C++ BScrollView::ResizeBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BScrollView
的用法示例。
在下文中一共展示了BScrollView::ResizeBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}