本文整理汇总了C++中BScrollView::PreferredSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BScrollView::PreferredSize方法的具体用法?C++ BScrollView::PreferredSize怎么用?C++ BScrollView::PreferredSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BScrollView
的用法示例。
在下文中一共展示了BScrollView::PreferredSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BMessage
ExpanderWindow::ExpanderWindow(BRect frame, const entry_ref* ref,
BMessage* settings)
:
BWindow(frame, B_TRANSLATE_SYSTEM_NAME("Expander"), B_TITLED_WINDOW,
B_NORMAL_WINDOW_FEEL),
fSourcePanel(NULL),
fDestPanel(NULL),
fSourceChanged(true),
fListingThread(NULL),
fListingStarted(false),
fExpandingThread(NULL),
fExpandingStarted(false),
fSettings(*settings),
fPreferences(NULL)
{
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 0);
SetLayout(layout);
_AddMenuBar(layout);
fDestButton = new BButton(B_TRANSLATE("Destination"),
new BMessage(MSG_DEST));
fSourceButton = new BButton(B_TRANSLATE("Source"),
new BMessage(MSG_SOURCE));
fExpandButton = new BButton(B_TRANSLATE("Expand"),
new BMessage(MSG_EXPAND));
BSize size = fDestButton->PreferredSize();
size.width = max_c(size.width, fSourceButton->PreferredSize().width);
size.width = max_c(size.width, fExpandButton->PreferredSize().width);
fDestButton->SetExplicitMaxSize(size);
fSourceButton->SetExplicitMaxSize(size);
fExpandButton->SetExplicitMaxSize(size);
fListingText = new BTextView("listingText");
fListingText->SetText("");
fListingText->MakeEditable(false);
fListingText->SetStylable(false);
fListingText->SetWordWrap(false);
BFont font = be_fixed_font;
fListingText->SetFontAndColor(&font);
BScrollView* scrollView = new BScrollView("", fListingText,
B_INVALIDATE_AFTER_LAYOUT, true, true);
BView* topView = layout->View();
const float spacing = be_control_look->DefaultItemSpacing();
topView->AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing)
.AddGroup(B_HORIZONTAL, spacing)
.AddGroup(B_VERTICAL, 5.0)
.Add(fSourceButton)
.Add(fDestButton)
.Add(fExpandButton)
.End()
.AddGroup(B_VERTICAL, spacing)
.Add(fSourceText = new BTextControl(NULL, NULL,
new BMessage(MSG_SOURCETEXT)))
.Add(fDestText = new BTextControl(NULL, NULL,
new BMessage(MSG_DESTTEXT)))
.AddGroup(B_HORIZONTAL, spacing)
.Add(fShowContents = new BCheckBox(
B_TRANSLATE("Show contents"),
new BMessage(MSG_SHOWCONTENTS)))
.Add(fStatusView = new BStringView(NULL, NULL))
.End()
.End()
.End()
.Add(scrollView)
.SetInsets(spacing, spacing, spacing, spacing)
);
size = topView->PreferredSize();
fSizeLimit = size.Height() - scrollView->PreferredSize().height - spacing;
ResizeTo(Bounds().Width(), fSizeLimit);
SetSizeLimits(size.Width(), 32767.0f, fSizeLimit, fSizeLimit);
SetZoomLimits(Bounds().Width(), fSizeLimit);
fPreviousHeight = -1;
Show();
}