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