本文整理汇总了C++中BScrollView::SetExplicitMinSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BScrollView::SetExplicitMinSize方法的具体用法?C++ BScrollView::SetExplicitMinSize怎么用?C++ BScrollView::SetExplicitMinSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BScrollView
的用法示例。
在下文中一共展示了BScrollView::SetExplicitMinSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BMessage
void
TimeZoneView::_InitView()
{
fZoneList = new BOutlineListView("cityList", B_SINGLE_SELECTION_LIST);
fZoneList->SetSelectionMessage(new BMessage(H_CITY_CHANGED));
fZoneList->SetInvocationMessage(new BMessage(H_SET_TIME_ZONE));
_BuildZoneMenu();
BScrollView* scrollList = new BScrollView("scrollList", fZoneList,
B_FRAME_EVENTS | B_WILL_DRAW, false, true);
scrollList->SetExplicitMinSize(BSize(200, 0));
fCurrent = new TTZDisplay("currentTime", B_TRANSLATE("Current time:"));
fPreview = new TTZDisplay("previewTime", B_TRANSLATE("Preview time:"));
fSetZone = new BButton("setTimeZone", B_TRANSLATE("Set time zone"),
new BMessage(H_SET_TIME_ZONE));
fSetZone->SetEnabled(false);
fSetZone->SetExplicitAlignment(
BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM));
BStringView* text = new BStringView("clockSetTo",
B_TRANSLATE("Hardware clock set to:"));
fLocalTime = new BRadioButton("localTime",
B_TRANSLATE("Local time (Windows compatible)"), new BMessage(kRTCUpdate));
fGmtTime = new BRadioButton("greenwichMeanTime",
B_TRANSLATE("GMT (UNIX compatible)"), new BMessage(kRTCUpdate));
if (fUseGmtTime)
fGmtTime->SetValue(B_CONTROL_ON);
else
fLocalTime->SetValue(B_CONTROL_ON);
_ShowOrHidePreview();
fOldUseGmtTime = fUseGmtTime;
const float kInset = be_control_look->DefaultItemSpacing();
BLayoutBuilder::Group<>(this)
.Add(scrollList)
.AddGroup(B_VERTICAL, kInset)
.Add(text)
.AddGroup(B_VERTICAL, kInset)
.Add(fLocalTime)
.Add(fGmtTime)
.End()
.AddGlue()
.Add(fCurrent)
.Add(fPreview)
.Add(fSetZone)
.End()
.SetInsets(kInset, kInset, kInset, kInset);
}
示例2: BMessage
//.........这里部分代码省略.........
fRemoveTypeButton = new BButton("remove type", B_TRANSLATE("Remove"),
new BMessage(kMsgRemoveType));
fTypeIconView = new IconView("type icon");
BView* iconHolder = BGroupLayoutBuilder(B_HORIZONTAL).Add(fTypeIconView);
fTypeIconView->SetModificationMessage(new BMessage(kMsgTypeIconsChanged));
typeBox->AddChild(BGridLayoutBuilder(padding, padding)
.Add(scrollView, 0, 0, 1, 4)
.Add(fAddTypeButton, 1, 0, 1, 2)
.Add(fRemoveTypeButton, 1, 2, 1, 2)
.Add(iconHolder, 2, 1, 1, 2)
.SetInsets(padding, padding, padding, padding)
.SetColumnWeight(0, 3)
.SetColumnWeight(1, 2)
.SetColumnWeight(2, 1));
iconHolder->SetExplicitAlignment(
BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
// "Version Info" group
BBox* versionBox = new BBox("versionBox");
versionBox->SetLabel(B_TRANSLATE("Version info"));
fMajorVersionControl = new BTextControl(B_TRANSLATE("Version:"),
NULL, NULL);
_MakeNumberTextControl(fMajorVersionControl);
fMiddleVersionControl = new BTextControl(".", NULL, NULL);
_MakeNumberTextControl(fMiddleVersionControl);
fMinorVersionControl = new BTextControl(".", NULL, NULL);
_MakeNumberTextControl(fMinorVersionControl);
fVarietyMenu = new BPopUpMenu("variety", true, true);
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Development"), NULL));
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Alpha"), NULL));
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Beta"), NULL));
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Gamma"), NULL));
item = new BMenuItem(B_TRANSLATE("Golden master"), NULL);
fVarietyMenu->AddItem(item);
item->SetMarked(true);
fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Final"), NULL));
BMenuField* varietyField = new BMenuField("", fVarietyMenu);
fInternalVersionControl = new BTextControl("/", NULL, NULL);
fShortDescriptionControl =
new BTextControl(B_TRANSLATE("Short description:"), NULL, NULL);
// TODO: workaround for a GCC 4.1.0 bug? Or is that really what the standard says?
version_info versionInfo;
fShortDescriptionControl->TextView()->SetMaxBytes(
sizeof(versionInfo.short_info));
BStringView* longLabel = new BStringView(NULL,
B_TRANSLATE("Long description:"));
longLabel->SetExplicitAlignment(labelAlignment);
fLongDescriptionView = new TabFilteringTextView("long desc");
fLongDescriptionView->SetMaxBytes(sizeof(versionInfo.long_info));
scrollView = new BScrollView("desc scrollview", fLongDescriptionView,
B_FRAME_EVENTS | B_WILL_DRAW, false, true);
// TODO: remove workaround (bug #5678)
BSize minScrollSize = scrollView->ScrollBar(B_VERTICAL)->MinSize();
minScrollSize.width += fLongDescriptionView->MinSize().width;
scrollView->SetExplicitMinSize(minScrollSize);
versionBox->AddChild(BGridLayoutBuilder(padding / 2, padding)
.Add(fMajorVersionControl->CreateLabelLayoutItem(), 0, 0)
.Add(fMajorVersionControl->CreateTextViewLayoutItem(), 1, 0)
.Add(fMiddleVersionControl, 2, 0, 2)
.Add(fMinorVersionControl, 4, 0, 2)
.Add(varietyField, 6, 0, 3)
.Add(fInternalVersionControl, 9, 0, 2)
.Add(fShortDescriptionControl->CreateLabelLayoutItem(), 0, 1)
.Add(fShortDescriptionControl->CreateTextViewLayoutItem(), 1, 1, 10)
.Add(longLabel, 0, 2)
.Add(scrollView, 1, 2, 10, 3)
.SetInsets(padding, padding, padding, padding)
.SetRowWeight(3, 3));
// put it all together
SetLayout(new BGroupLayout(B_VERTICAL));
AddChild(menuBar);
AddChild(BGroupLayoutBuilder(B_VERTICAL, padding)
.Add(fSignatureControl)
.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
.Add(flagsBox, 3)
.Add(iconBox, 1))
.Add(typeBox)
.Add(versionBox)
.SetInsets(padding, padding, padding, padding));
SetKeyMenuBar(menuBar);
fSignatureControl->MakeFocus(true);
BMimeType::StartWatching(this);
_SetTo(entry);
}
示例3: messenger
ProjectSettingsWindow::ProjectSettingsWindow(BRect frame, Project* project)
:
BWindow(frame, TR("Project settings"), B_TITLED_WINDOW,
B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS),
fProject(project),
fDirty(false)
{
if (fProject == NULL)
debugger("Bad project given to Project Settings window");
fRefFilter = new TypedRefFilter(NULL, B_DIRECTORY_NODE);
BMessenger messenger(this);
entry_ref projectFolderRef;
BEntry(fProject->GetPath().GetFolder()).GetRef(&projectFolderRef);
fFilePanel = new BFilePanel(B_OPEN_PANEL, &messenger, &projectFolderRef,
B_DIRECTORY_NODE, true, new BMessage(M_ADD_PATH), fRefFilter);
fAutolock = new BAutolock(fProject);
AddCommonFilter(new EscapeCancelFilter());
fTargetText = new AutoTextControl("targetname", TR("Target name:"),
fProject->GetTargetName(), new BMessage(M_TARGET_NAME_CHANGED));
BPopUpMenu* targetTypeMenu = new BPopUpMenu(TR("Target type"));
targetTypeMenu->AddItem(new BMenuItem(TR("Application"),
new BMessage(M_SET_TARGET_TYPE)));
targetTypeMenu->AddItem(new BMenuItem(TR("Shared library"),
new BMessage(M_SET_TARGET_TYPE)));
targetTypeMenu->AddItem(new BMenuItem(TR("Static library"),
new BMessage(M_SET_TARGET_TYPE)));
targetTypeMenu->AddItem(new BMenuItem(TR("Device driver"),
new BMessage(M_SET_TARGET_TYPE)));
fTypeField = new BMenuField("type", TR("Target type:"), targetTypeMenu);
SetToolTip(fTypeField, TR("The kind of program you want to build"));
BMenuItem* item = targetTypeMenu->ItemAt(fProject->TargetType());
if (item != NULL)
item->SetMarked(true);
fIncludeList = new IncludeList(fProject->GetPath().GetFolder());
SetToolTip(fIncludeList,
TR("The folders you want Paladin to search for header files"));
BScrollView* includeScrollView = new BScrollView("includescrollview",
fIncludeList, B_WILL_DRAW, true, true);
includeScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
includeScrollView->SetExplicitMinSize(
BSize(be_plain_font->StringWidth("M") * 34.0f,
be_plain_font->StringWidth("M") * 12.0f));
for (int32 i = 0; i < fProject->CountLocalIncludes(); i++) {
fIncludeList->AddItem(new BStringItem(
fProject->LocalIncludeAt(i).Relative().String()));
}
float buttonWidth = be_plain_font->StringWidth("+") * 2.0f + 3.0f;
BButton* addButton = new BButton("addbutton", TR("+"),
new BMessage(M_SHOW_ADD_PATH));
addButton->SetExplicitSize(BSize(buttonWidth, buttonWidth));
addButton->SetToolTip(TR("Add a file to the include path list"));
BButton* removeButton = new BButton("removebutton", TR("−"),
new BMessage(M_REMOVE_PATH));
removeButton->SetExplicitSize(BSize(buttonWidth, buttonWidth));
removeButton->SetToolTip(TR("Remove the selected path"));
// general tab
fGeneralView = new BView(TR("General"), B_WILL_DRAW);
fGeneralView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BLayoutBuilder::Group<>(fGeneralView, B_VERTICAL, 0)
.AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
.Add(fTargetText->CreateLabelLayoutItem(), 0, 0)
.Add(fTargetText->CreateTextViewLayoutItem(), 1, 0)
.Add(fTypeField->CreateLabelLayoutItem(), 0, 1)
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING, 1, 1)
.Add(fTypeField->CreateMenuBarLayoutItem())
.AddGlue()
.End()
.End()
.AddStrut(B_USE_DEFAULT_SPACING)
.AddGroup(B_VERTICAL, 2.0f)
.Add(new BStringView("include paths", TR("Include paths:")))
.AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
.Add(includeScrollView)
.AddGroup(B_VERTICAL, B_USE_SMALL_SPACING)
.Add(addButton)
.Add(removeButton)
.AddGlue()
.End()
.End()
.End()
.SetInsets(B_USE_DEFAULT_SPACING)
.End();
//.........这里部分代码省略.........
示例4: app
int
main(int argc, char** argv)
{
BApplication app("application/x-vnd.antares-look");
BWindow* window = new Window(BRect(50, 50, 100, 100),
"Look at these pretty controls!", B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS
| B_QUIT_ON_WINDOW_CLOSE);
window->SetLayout(new BGroupLayout(B_HORIZONTAL));
// create some controls
// BListView
BListView* listView = new BListView();
for (int32 i = 0; i < 20; i++) {
BString itemLabel("List item ");
itemLabel << i + 1;
listView->AddItem(new BStringItem(itemLabel.String()));
}
BScrollView* scrollView = new BScrollView("scroller", listView, 0,
true, true);
scrollView->SetExplicitMinSize(BSize(300, 140));
// BColumnListView
BColumnListView* columnListView = new BColumnListView("clv", 0,
B_FANCY_BORDER);
// for (int32 i = 0; i < 20; i++) {
// BString itemLabel("List Item ");
// itemLabel << i + 1;
// columnListView->AddItem(new BStringItem(itemLabel.String()));
// }
BGridView* controls = new BGridView(kInset, kInset);
BGridLayout* layout = controls->GridLayout();
controls->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));
int32 row = 0;
add_controls<BButton>(layout, row);
add_controls<BCheckBox>(layout, row);
add_controls<BRadioButton>(layout, row);
add_menu_fields(layout, row);
add_text_controls(layout, row);
add_sliders(layout, row);
add_status_bars(layout, row);
BColorControl* colorControl = new BColorControl(B_ORIGIN, B_CELLS_32x8,
8.0f, "color control");
layout->AddView(colorControl, 0, row, 4);
BTabView* tabView = new BTabView("tab view", B_WIDTH_FROM_WIDEST);
BView* content = BGroupLayoutBuilder(B_VERTICAL, kInset)
.Add(scrollView)
.Add(columnListView)
.Add(controls)
.SetInsets(kInset, kInset, kInset, kInset);
content->SetName("Tab 1");
tabView->AddTab(content);
BView* tab2 = new BView("Tab 2", 0);
tab2->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
tabView->AddTab(tab2);
tabView->AddTab(new BView("Tab 3", 0));
BMenuBar* menuBar = new BMenuBar("menu bar");
BMenu* menu = new BMenu("File");
menu->AddItem(new BMenuItem("Test Open BFilePanel",
new BMessage(MSG_TEST_OPEN_FILE_PANEL)));
menu->AddItem(new BMenuItem("Test Save BFilePanel",
new BMessage(MSG_TEST_SAVE_FILE_PANEL)));
menu->AddItem(new BMenuItem("Click me!", NULL));
menu->AddItem(new BMenuItem("Another option", NULL));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED)));
menuBar->AddItem(menu);
menu = new BMenu("Edit");
menu->SetEnabled(false);
menu->AddItem(new BMenuItem("Cut", NULL));
menu->AddItem(new BMenuItem("Copy", NULL));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Past", NULL));
menuBar->AddItem(menu);
menu = new BMenu("One Item");
menu->AddItem(new BMenuItem("Only", NULL));
menuBar->AddItem(menu);
menu = new BMenu("Sub Menu");
BMenu* subMenu = new BMenu("Click me");
subMenu->AddItem(new BMenuItem("Either", NULL));
subMenu->AddItem(new BMenuItem("Or", NULL));
subMenu->SetRadioMode(true);
menu->AddItem(subMenu);
menuBar->AddItem(menu);
BButton* okButton = new BButton("OK", new BMessage(B_QUIT_REQUESTED));
window->AddChild(BGroupLayoutBuilder(B_VERTICAL)
.Add(menuBar)
//.........这里部分代码省略.........
示例5: BMessage
TeamMonitorWindow::TeamMonitorWindow()
:
BWindow(BRect(0, 0, 350, 100), B_TRANSLATE("Team monitor"),
B_TITLED_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
| B_CLOSE_ON_ESCAPE | B_AUTO_UPDATE_SIZE_LIMITS,
B_ALL_WORKSPACES),
fQuitting(false),
fUpdateRunner(NULL)
{
BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
float inset = 10;
layout->SetInsets(inset, inset, inset, inset);
layout->SetSpacing(inset);
SetLayout(layout);
layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fListView = new BListView("teams");
fListView->SetSelectionMessage(new BMessage(TM_SELECTED_TEAM));
BScrollView* scrollView = new BScrollView("scroll_teams", fListView,
0, B_SUPPORTS_LAYOUT, false, true, B_FANCY_BORDER);
scrollView->SetExplicitMinSize(BSize(B_SIZE_UNSET, 150));
fKillButton = new BButton("kill", B_TRANSLATE("Kill application"),
new BMessage(TM_KILL_APPLICATION));
fKillButton->SetEnabled(false);
fQuitButton = new BButton("quit", B_TRANSLATE("Quit application"),
new BMessage(TM_QUIT_APPLICATION));
fQuitButton->SetEnabled(false);
fDescriptionView = new TeamDescriptionView;
BButton* forceReboot = new BButton("force", B_TRANSLATE("Force reboot"),
new BMessage(TM_FORCE_REBOOT));
fRestartButton = new BButton("restart", B_TRANSLATE("Restart the desktop"),
new BMessage(TM_RESTART_DESKTOP));
fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(TM_CANCEL));
SetDefaultButton(fCancelButton);
BGroupLayoutBuilder(layout)
.Add(scrollView)
.AddGroup(B_HORIZONTAL)
.Add(fKillButton)
.Add(fQuitButton)
.AddGlue()
.End()
.Add(fDescriptionView)
.AddGroup(B_HORIZONTAL)
.Add(forceReboot)
.AddGlue()
.Add(fRestartButton)
.AddGlue(inset)
.Add(fCancelButton);
CenterOnScreen();
fRestartButton->Hide();
AddShortcut('T', B_COMMAND_KEY | B_OPTION_KEY,
new BMessage(kMsgLaunchTerminal));
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
gLocalizedNamePreferred
= BLocaleRoster::Default()->IsFilesystemTranslationPreferred();
gTeamMonitorWindow = this;
this->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY,
B_ANY_SOURCE, B_KEY_DOWN, FilterKeyDown));
if (be_app->Lock()) {
be_app->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY,
B_ANY_SOURCE, B_LOCALE_CHANGED, FilterLocaleChanged));
be_app->Unlock();
}
}
示例6: BMessage
FindWindow::FindWindow(BString workingDir)
: DWindow(BRect(100,100,600,500), B_TRANSLATE("Find in project"), B_TITLED_WINDOW,
B_CLOSE_ON_ESCAPE),
fIsRegEx(false),
fIgnoreCase(true),
fMatchWord(false),
fThreadID(-1),
fThreadMode(0),
fThreadQuitFlag(0),
fFileList(20, true),
fWorkingDir(""),
fProject(NULL)
{
SetSizeLimits(650, 30000, 400, 30000);
MakeCenteredOnShow(true);
fMenuBar = new BMenuBar("menubar");
fFindButton = new BButton("findbutton", B_TRANSLATE("Replace all"),
new BMessage(M_FIND));
fFindButton->SetLabel(B_TRANSLATE("Find"));
fFindButton->SetEnabled(false);
fFindBox = new DTextView("findbox");
fFindBox->SetFlags(fFindBox->Flags() | B_NAVIGABLE_JUMP);
BScrollView *findBoxScroll = fFindBox->MakeScrollView("findscroll", true, true);
fReplaceBox = new DTextView("replacebox");
fReplaceBox->SetFlags(fFindBox->Flags() | B_NAVIGABLE_JUMP);
BScrollView *replaceBoxScroll = fReplaceBox->MakeScrollView("replacescroll", true, true);
BGroupLayout* hGroup = new BGroupLayout(B_HORIZONTAL,0);
BView* hView = new BView("hview",0,hGroup);
fReplaceButton = new BButton("replacebutton", B_TRANSLATE("Replace"),
new BMessage(M_REPLACE));
fReplaceButton->SetEnabled(false);
//hGroup->AddView(fReplaceButton);
// hidden until we decide we need an individual replace in a multi
// file dialog box (doubtful - could click on file and do it from
// within pe)
fReplaceAllButton = new BButton("replaceallbutton", B_TRANSLATE("Replace all"),
new BMessage(M_REPLACE_ALL));
fReplaceAllButton->SetEnabled(false);
hGroup->AddView(fReplaceAllButton);
BStringView *resultLabel = new BStringView("resultlabel", B_TRANSLATE("Results:"));
fResultList = new DListView("resultlist", B_MULTIPLE_SELECTION_LIST);
BScrollView* resultsScroll = fResultList->MakeScrollView("resultscroll", true, true);
resultsScroll->SetExplicitMinSize(BSize(650,150));
fResultList->SetInvocationMessage(new BMessage(M_SHOW_RESULT));
BLayoutBuilder::Group<>(this, B_VERTICAL)
.Add(fMenuBar)
.Add(findBoxScroll)
.Add(fFindButton)
.Add(replaceBoxScroll)
.Add(hView)
.Add(resultLabel)
.Add(resultsScroll)
.End();
BMenu *menu = new BMenu(B_TRANSLATE("Search"));
menu->AddItem(new BMenuItem(B_TRANSLATE("Find"), new BMessage(M_FIND), 'F', B_COMMAND_KEY));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Replace"), new BMessage(M_REPLACE), 'R', B_COMMAND_KEY));
menu->AddItem(new BMenuItem(B_TRANSLATE("Replace all"), new BMessage(M_REPLACE_ALL), 'R',
B_COMMAND_KEY | B_SHIFT_KEY));
fMenuBar->AddItem(menu);
menu = new BMenu(B_TRANSLATE("Options"));
menu->AddItem(new BMenuItem(B_TRANSLATE("Regular expression"), new BMessage(M_TOGGLE_REGEX)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Ignore case"), new BMessage(M_TOGGLE_CASE_INSENSITIVE)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Match whole word"), new BMessage(M_TOGGLE_MATCH_WORD)));
fMenuBar->AddItem(menu);
BMenuItem *item = fMenuBar->FindItem(B_TRANSLATE("Ignore case"));
if (fIgnoreCase)
item->SetMarked(true);
menu = new BMenu(B_TRANSLATE("Project"));
menu->SetRadioMode(true);
gProjectList->Lock();
for (int32 i = 0; i < gProjectList->CountItems(); i++)
{
Project *proj = gProjectList->ItemAt(i);
BMessage *msg = new BMessage(M_SET_PROJECT);
msg->AddPointer("project", proj);
BMenuItem *projItem = new BMenuItem(proj->GetName(), msg);
menu->AddItem(projItem);
if (gCurrentProject == proj)
{
projItem->SetMarked(true);
fProject = proj;
}
}
gProjectList->Unlock();
//.........这里部分代码省略.........