本文整理汇总了C++中BView::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::SetName方法的具体用法?C++ BView::SetName怎么用?C++ BView::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BView
的用法示例。
在下文中一共展示了BView::SetName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FontSelectionView
BView*
SettingsWindow::_CreateFontsPage(float spacing)
{
fStandardFontView = new FontSelectionView("standard",
B_TRANSLATE("Standard font:"), true, be_plain_font);
BFont defaultSerifFont = _FindDefaultSerifFont();
fSerifFontView = new FontSelectionView("serif",
B_TRANSLATE("Serif font:"), true, &defaultSerifFont);
fSansSerifFontView = new FontSelectionView("sans serif",
B_TRANSLATE("Sans serif font:"), true, be_plain_font);
fFixedFontView = new FontSelectionView("fixed",
B_TRANSLATE("Fixed font:"), true, be_fixed_font);
fStandardSizesMenu = new BMenuField("standard font size",
B_TRANSLATE("Default standard font size:"), new BPopUpMenu("sizes"),
B_WILL_DRAW);
_BuildSizesMenu(fStandardSizesMenu->Menu(),
MSG_STANDARD_FONT_SIZE_SELECTED);
fFixedSizesMenu = new BMenuField("fixed font size",
B_TRANSLATE("Default fixed font size:"), new BPopUpMenu("sizes"),
B_WILL_DRAW);
_BuildSizesMenu(fFixedSizesMenu->Menu(), MSG_FIXED_FONT_SIZE_SELECTED);
BView* view = BGridLayoutBuilder(spacing / 2, spacing / 2)
.Add(fStandardFontView->CreateFontsLabelLayoutItem(), 0, 0)
.Add(fStandardFontView->CreateFontsMenuBarLayoutItem(), 1, 0)
.Add(fStandardFontView->PreviewBox(), 0, 1, 2)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing), 0, 2, 2)
.Add(fSerifFontView->CreateFontsLabelLayoutItem(), 0, 3)
.Add(fSerifFontView->CreateFontsMenuBarLayoutItem(), 1, 3)
.Add(fSerifFontView->PreviewBox(), 0, 4, 2)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing), 0, 5, 2)
.Add(fSansSerifFontView->CreateFontsLabelLayoutItem(), 0, 6)
.Add(fSansSerifFontView->CreateFontsMenuBarLayoutItem(), 1, 6)
.Add(fSansSerifFontView->PreviewBox(), 0, 7, 2)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing), 0, 8, 2)
.Add(fFixedFontView->CreateFontsLabelLayoutItem(), 0, 9)
.Add(fFixedFontView->CreateFontsMenuBarLayoutItem(), 1, 9)
.Add(fFixedFontView->PreviewBox(), 0, 10, 2)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing), 0, 11, 2)
.Add(fStandardSizesMenu->CreateLabelLayoutItem(), 0, 12)
.Add(fStandardSizesMenu->CreateMenuBarLayoutItem(), 1, 12)
.Add(fFixedSizesMenu->CreateLabelLayoutItem(), 0, 13)
.Add(fFixedSizesMenu->CreateMenuBarLayoutItem(), 1, 13)
.SetInsets(spacing, spacing, spacing, spacing)
.View()
;
view->SetName(B_TRANSLATE("Fonts"));
return view;
}
示例2: BMessage
BView*
SettingsWindow::_CreateFontsPage(float spacing)
{
fStandardFontView = new FontSelectionView("standard",
B_TRANSLATE("Standard font:"), true, be_plain_font);
BFont defaultSerifFont = _FindDefaultSerifFont();
fSerifFontView = new FontSelectionView("serif",
B_TRANSLATE("Serif font:"), true, &defaultSerifFont);
fSansSerifFontView = new FontSelectionView("sans serif",
B_TRANSLATE("Sans serif font:"), true, be_plain_font);
fFixedFontView = new FontSelectionView("fixed",
B_TRANSLATE("Fixed font:"), true, be_fixed_font);
fStandardSizesSpinner = new BSpinner("standard font size",
B_TRANSLATE("Default standard font size:"),
new BMessage(MSG_STANDARD_FONT_SIZE_SELECTED));
fStandardSizesSpinner->SetAlignment(B_ALIGN_RIGHT);
fFixedSizesSpinner = new BSpinner("fixed font size",
B_TRANSLATE("Default fixed font size:"),
new BMessage(MSG_FIXED_FONT_SIZE_SELECTED));
fFixedSizesSpinner->SetAlignment(B_ALIGN_RIGHT);
BView* view = BGridLayoutBuilder(spacing / 2, spacing / 2)
.Add(fStandardFontView->CreateFontsLabelLayoutItem(), 0, 0)
.Add(fStandardFontView->CreateFontsMenuBarLayoutItem(), 1, 0)
.Add(fStandardSizesSpinner->CreateLabelLayoutItem(), 2, 0)
.Add(fStandardSizesSpinner->CreateTextViewLayoutItem(), 3, 0)
.Add(fStandardFontView->PreviewBox(), 1, 1, 3)
.Add(fSerifFontView->CreateFontsLabelLayoutItem(), 0, 2)
.Add(fSerifFontView->CreateFontsMenuBarLayoutItem(), 1, 2)
.Add(fSerifFontView->PreviewBox(), 1, 3, 3)
.Add(fSansSerifFontView->CreateFontsLabelLayoutItem(), 0, 4)
.Add(fSansSerifFontView->CreateFontsMenuBarLayoutItem(), 1, 4)
.Add(fSansSerifFontView->PreviewBox(), 1, 5, 3)
.Add(BSpaceLayoutItem::CreateVerticalStrut(spacing / 2), 0, 6, 2)
.Add(fFixedFontView->CreateFontsLabelLayoutItem(), 0, 7)
.Add(fFixedFontView->CreateFontsMenuBarLayoutItem(), 1, 7)
.Add(fFixedSizesSpinner->CreateLabelLayoutItem(), 2, 7)
.Add(fFixedSizesSpinner->CreateTextViewLayoutItem(), 3, 7)
.Add(fFixedFontView->PreviewBox(), 1, 8, 3)
.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING)
.View();
view->SetName(B_TRANSLATE("Fonts"));
return view;
}
示例3: BMessage
BView*
SettingsWindow::_CreateProxyPage(float spacing)
{
fUseProxyCheckBox = new BCheckBox("use proxy",
B_TRANSLATE("Use proxy server to connect to the internet."),
new BMessage(MSG_USE_PROXY_CHANGED));
fUseProxyCheckBox->SetValue(B_CONTROL_ON);
fProxyAddressControl = new BTextControl("proxy address",
B_TRANSLATE("Proxy server address:"), "",
new BMessage(MSG_PROXY_ADDRESS_CHANGED));
fProxyAddressControl->SetModificationMessage(
new BMessage(MSG_PROXY_ADDRESS_CHANGED));
fProxyAddressControl->SetText(
fSettings->GetValue(kSettingsKeyProxyAddress, ""));
fProxyPortControl = new BTextControl("proxy port",
B_TRANSLATE("Proxy server port:"), "",
new BMessage(MSG_PROXY_PORT_CHANGED));
fProxyPortControl->SetModificationMessage(
new BMessage(MSG_PROXY_PORT_CHANGED));
fProxyPortControl->SetText(
fSettings->GetValue(kSettingsKeyProxyAddress, ""));
BView* view = BGroupLayoutBuilder(B_VERTICAL, spacing / 2)
.Add(fUseProxyCheckBox)
.Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
.Add(fProxyAddressControl->CreateLabelLayoutItem(), 0, 0)
.Add(fProxyAddressControl->CreateTextViewLayoutItem(), 1, 0)
.Add(fProxyPortControl->CreateLabelLayoutItem(), 0, 1)
.Add(fProxyPortControl->CreateTextViewLayoutItem(), 1, 1)
)
.Add(BSpaceLayoutItem::CreateGlue())
.SetInsets(spacing, spacing, spacing, spacing)
.TopView()
;
view->SetName(B_TRANSLATE("Proxy server"));
return view;
}
示例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: _CreateConnectionPage
//.........这里部分代码省略.........
fEncryptionMenuItem[0] = new BMenuItem(B_TRANSLATE("Off"), _CreateEncryptionMenuMessage(0));
fEncryptionMenuItem[1] = new BMenuItem(B_TRANSLATE("Enabled"), _CreateEncryptionMenuMessage(1));
fEncryptionMenuItem[2] = new BMenuItem(B_TRANSLATE("Required"), _CreateEncryptionMenuMessage(2));
menu->AddItem(fEncryptionMenuItem[0]);
menu->AddItem(fEncryptionMenuItem[1]);
menu->AddItem(fEncryptionMenuItem[2]);
fEncryptionMenu = new BMenuField("", B_TRANSLATE("Encryption:"), menu);
//
BString textBuffer;
textBuffer << (int32)fTorrentPreferences->IncomingPort();
fListeningPort->SetText(textBuffer);
textBuffer = B_EMPTY_STRING;
textBuffer << (int32)fTorrentPreferences->PeerLimit();
fMaxConnection->SetText(textBuffer);
textBuffer = B_EMPTY_STRING;
textBuffer << (int32)fTorrentPreferences->PeerLimitPerTorrent();
fTorrentMaxConnection->SetText(textBuffer);
//textBuffer << (int32)fTorrentPreferences->IncomingPort();
//fTorrentUploadSlots->SetText(textBuffer);
fEnableForwardingPort->SetValue(fTorrentPreferences->PortForwardingEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
fEnableDHTValue->SetValue(fTorrentPreferences->DistributedHashTableEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
fEnablePEXValue->SetValue(fTorrentPreferences->PeerExchangeEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
fEnableUTPValue->SetValue(fTorrentPreferences->MicroTransportProtocolEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
fEnableLPDValue->SetValue(fTorrentPreferences->LocalPeerDiscoveryEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
fEncryptionMenuItem[fTorrentPreferences->EncryptionMode()]->SetMarked(true);
//
fListeningPort->SetExplicitMaxSize(BSize(60, 40));
fMaxConnection->SetExplicitMaxSize(BSize(60, 40));
fTorrentMaxConnection->SetExplicitMaxSize(BSize(60, 40));
//fTorrentUploadSlots->SetExplicitMaxSize(BSize(60, 40));
//
//
BView* view = BGroupLayoutBuilder(B_VERTICAL, spacing / 2)
.Add(peerPortLabel)
.Add(BGridLayoutBuilder(-1, spacing / 2)
.SetInsets(spacing / 2, -1, -1, -1)
.Add(fListeningPortLabel, 0, 0)
//.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing), 1, 0)
.Add(fListeningPort, 1, 0)
.Add(fRandomPort, 2, 0)
.Add(fApplyPort, 3, 0)
//.Add(BSpaceLayoutItem::CreateGlue(), 2, 0)
//.Add(BSpaceLayoutItem::CreateGlue(), 3, 0)
//.Add(BSpaceLayoutItem::CreateGlue(), 4, 0)
//
.Add(fEnableForwardingPort, 0, 1, 3, 1)
//
)
.Add(limitsLabel)
.Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
.SetInsets(spacing / 2, -1, -1, -1)
.Add(fMaxConnectionLabel, 0, 0)
.Add(fMaxConnection, 1, 0)
.Add(fApplyMaxConnection, 2, 0)
// padding
//.Add(BSpaceLayoutItem::CreateGlue(), 3, 0)
//.Add(BSpaceLayoutItem::CreateGlue(), 4, 0)
//
.Add(fTorrentMaxConnectionLabel, 0, 1)
.Add(fTorrentMaxConnection, 1, 1)
.Add(fApplyTorrentMaxConnection, 2, 1)
//
//.Add(fTorrentUploadSlotsLabel, 0, 2)
//.Add(fTorrentUploadSlots, 1, 2)
)
.Add(otherLabel)
.Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
.SetInsets(spacing / 2, -1, -1, -1)
.Add(fEnableDHTValue, 0, 0, 3, 1)
.Add(fEnablePEXValue, 0, 1, 3, 1)
.Add(fEnableUTPValue, 0, 2, 3, 1)
.Add(fEnableLPDValue, 0, 3, 3, 1)
//
.Add(fEncryptionMenu->CreateLabelLayoutItem(), 0, 4)
.Add(fEncryptionMenu->CreateMenuBarLayoutItem(), 1, 4)
)
.SetInsets(spacing, spacing, spacing, spacing)
.TopView()
;
view->SetName("Connection");
return view;
}
示例6: _CreateTorrentsPage
BView* PreferencesWindow::_CreateTorrentsPage(float spacing)
{
BStringView* addingLabel = new BStringView("", B_TRANSLATE("Adding"));
BStringView* downloadingLabel = new BStringView("", B_TRANSLATE("Downloading"));
//BStringView* seedingLabel = new BStringView("", B_TRANSLATE("Seeding Limits"));
addingLabel->SetFont(be_bold_font);
downloadingLabel->SetFont(be_bold_font);
//
//
//
//fAutoAddTorrentsFrom = new BCheckBox("auto_add_torrents_from",
// B_TRANSLATE("Automatically add torrents from:"),
// new BMessage(MSG_ADD_TORRENT_FROM_FOLDER_CHANGED));
//fAutoAddTorrentsFrom->SetValue(B_CONTROL_OFF);
//
//
//fAutoAddTorrentsFromFolder = new FolderSelect("auto_add_torrents_from_folder",
// NULL, "/test/path"/*new BMessage(MSG_DOWNLOAD_FOLDER_CHANGED)*/);
//
//fAutoAddTorrentsFromFolder->SetEnabled(false);
BCheckBox* fShowOptionsDialog = new BCheckBox("Show options dialog",
B_TRANSLATE("Show options dialog"),
NULL /*new BMessage(MSG_AUTO_HIDE_INTERFACE_BEHAVIOR_CHANGED)*/);
fShowOptionsDialog->SetValue(B_CONTROL_OFF);
BCheckBox* fStartWhenAdded = new BCheckBox("start_when_added",
B_TRANSLATE("Start when added"),
new BMessage(MSG_START_WHEN_ADDED_BEHAVIOR_CHANGED));
fStartWhenAdded->SetValue(fTorrentPreferences->StartWhenAddedEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
fIncompleteFileNaming = new BCheckBox("incomplete_file_naming",
B_TRANSLATE("Append \".part\" to incomplete files' names"),
new BMessage(MSG_INCOMPLETE_FILENAMING_BEHAVIOR_CHANGED));
fIncompleteFileNaming->SetValue(fTorrentPreferences->IncompleteFileNamingEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
BStringView* fTorrentSaveLocation = new BStringView("", B_TRANSLATE("Save to Location:"));
fTorrentSaveLocationPath = new FolderSelect("download_folder_select",
fTorrentPreferences->DownloadFolder(), new BMessage(MSG_DOWNLOAD_FOLDER_BEHAVIOR_CHANGED));
fIncompleteDirEnabled = new BCheckBox("incomplete_torrent_folder",
B_TRANSLATE("Incomplete torrents folder"),
new BMessage(MSG_INCOMPLETE_FOLDER_BEHAVIOR_CHANGED));
fIncompleteDirEnabled->SetValue(fTorrentPreferences->IncompleteFolderEnabled() ? B_CONTROL_ON : B_CONTROL_OFF);
fIncompleteDirPath = new FolderSelect("incomplete_torrent_folder_path",
fTorrentPreferences->IncompleteFolder(), new BMessage(MSG_INCOMPLETE_FOLDER_PATH_BEHAVIOR_CHANGED));
fIncompleteDirPath->SetEnabled(fTorrentPreferences->IncompleteFolderEnabled());
//
//
//
BView* view = BGroupLayoutBuilder(B_VERTICAL, spacing / 2)
.Add(addingLabel)
//.Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
// .Add(fAutoAddTorrentsFrom, 0, 0)
// .Add(fAutoAddTorrentsFromFolder, 1, 0)
//)
.Add(BGridLayoutBuilder(spacing, spacing / 2)
.SetInsets(spacing / 2, -1, -1, -1)
.Add(fShowOptionsDialog, 0, 0)
.Add(fStartWhenAdded, 0, 1)
)
.Add(downloadingLabel)
.Add(BGridLayoutBuilder(spacing, spacing / 2)
.SetInsets(spacing / 2, -1, -1, -1)
.Add(fIncompleteFileNaming, 0, 0, 2, 1)
.Add(fTorrentSaveLocation, 0, 1)
.Add(fTorrentSaveLocationPath, 1, 1)
.Add(fIncompleteDirEnabled, 0, 2)
.Add(fIncompleteDirPath, 1, 2)
)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing))
.SetInsets(spacing, spacing, spacing, spacing)
.TopView()
;
view->SetName("Torrents");
return view;
}
示例7: BMessage
//.........这里部分代码省略.........
new BMessage(MSG_NEW_WINDOWS_BEHAVIOR_CHANGED));
fNewTabBehaviorCloneCurrentItem = new BMenuItem(
B_TRANSLATE("Clone current page"),
new BMessage(MSG_NEW_TABS_BEHAVIOR_CHANGED));
fNewTabBehaviorOpenHomeItem = new BMenuItem(
B_TRANSLATE("Open start page"),
new BMessage(MSG_NEW_TABS_BEHAVIOR_CHANGED));
fNewTabBehaviorOpenSearchItem = new BMenuItem(
B_TRANSLATE("Open search page"),
new BMessage(MSG_NEW_TABS_BEHAVIOR_CHANGED));
fNewTabBehaviorOpenBlankItem = new BMenuItem(
B_TRANSLATE("Open blank page"),
new BMessage(MSG_NEW_TABS_BEHAVIOR_CHANGED));
fNewWindowBehaviorOpenHomeItem->SetMarked(true);
fNewTabBehaviorOpenBlankItem->SetMarked(true);
BPopUpMenu* newWindowBehaviorMenu = new BPopUpMenu("New windows");
newWindowBehaviorMenu->AddItem(fNewWindowBehaviorOpenHomeItem);
newWindowBehaviorMenu->AddItem(fNewWindowBehaviorOpenSearchItem);
newWindowBehaviorMenu->AddItem(fNewWindowBehaviorOpenBlankItem);
fNewWindowBehaviorMenu = new BMenuField("new window behavior",
B_TRANSLATE("New windows:"), newWindowBehaviorMenu);
BPopUpMenu* newTabBehaviorMenu = new BPopUpMenu("New tabs");
newTabBehaviorMenu->AddItem(fNewTabBehaviorOpenBlankItem);
newTabBehaviorMenu->AddItem(fNewTabBehaviorOpenHomeItem);
newTabBehaviorMenu->AddItem(fNewTabBehaviorOpenSearchItem);
newTabBehaviorMenu->AddItem(fNewTabBehaviorCloneCurrentItem);
fNewTabBehaviorMenu = new BMenuField("new tab behavior",
B_TRANSLATE("New tabs:"), newTabBehaviorMenu);
fDaysInHistoryMenuControl = new BTextControl("days in history",
B_TRANSLATE("Number of days to keep links in History menu:"), "",
new BMessage(MSG_HISTORY_MENU_DAYS_CHANGED));
fDaysInHistoryMenuControl->SetModificationMessage(
new BMessage(MSG_HISTORY_MENU_DAYS_CHANGED));
BString maxHistoryAge;
maxHistoryAge << BrowsingHistory::DefaultInstance()->MaxHistoryItemAge();
fDaysInHistoryMenuControl->SetText(maxHistoryAge.String());
for (uchar i = 0; i < '0'; i++)
fDaysInHistoryMenuControl->TextView()->DisallowChar(i);
for (uchar i = '9' + 1; i <= 128; i++)
fDaysInHistoryMenuControl->TextView()->DisallowChar(i);
fShowTabsIfOnlyOnePage = new BCheckBox("show tabs if only one page",
B_TRANSLATE("Show tabs if only one page is open"),
new BMessage(MSG_TAB_DISPLAY_BEHAVIOR_CHANGED));
fShowTabsIfOnlyOnePage->SetValue(B_CONTROL_ON);
fAutoHideInterfaceInFullscreenMode = new BCheckBox("auto-hide interface",
B_TRANSLATE("Auto-hide interface in full screen mode"),
new BMessage(MSG_AUTO_HIDE_INTERFACE_BEHAVIOR_CHANGED));
fAutoHideInterfaceInFullscreenMode->SetValue(B_CONTROL_OFF);
fAutoHidePointer = new BCheckBox("auto-hide pointer",
B_TRANSLATE("Auto-hide mouse pointer"),
new BMessage(MSG_AUTO_HIDE_POINTER_BEHAVIOR_CHANGED));
fAutoHidePointer->SetValue(B_CONTROL_OFF);
fShowHomeButton = new BCheckBox("show home button",
B_TRANSLATE("Show home button"),
new BMessage(MSG_SHOW_HOME_BUTTON_CHANGED));
fShowHomeButton->SetValue(B_CONTROL_ON);
BView* view = BGroupLayoutBuilder(B_VERTICAL, spacing / 2)
.Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
.Add(fStartPageControl->CreateLabelLayoutItem(), 0, 0)
.Add(fStartPageControl->CreateTextViewLayoutItem(), 1, 0)
.Add(fSearchPageControl->CreateLabelLayoutItem(), 0, 1)
.Add(fSearchPageControl->CreateTextViewLayoutItem(), 1, 1)
.Add(fDownloadFolderControl->CreateLabelLayoutItem(), 0, 2)
.Add(fDownloadFolderControl->CreateTextViewLayoutItem(), 1, 2)
.Add(fNewWindowBehaviorMenu->CreateLabelLayoutItem(), 0, 3)
.Add(fNewWindowBehaviorMenu->CreateMenuBarLayoutItem(), 1, 3)
.Add(fNewTabBehaviorMenu->CreateLabelLayoutItem(), 0, 4)
.Add(fNewTabBehaviorMenu->CreateMenuBarLayoutItem(), 1, 4)
)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing))
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing))
.Add(fShowTabsIfOnlyOnePage)
.Add(fAutoHideInterfaceInFullscreenMode)
.Add(fAutoHidePointer)
.Add(fShowHomeButton)
.Add(fDaysInHistoryMenuControl)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing))
.SetInsets(spacing, spacing, spacing, spacing)
.TopView()
;
view->SetName(B_TRANSLATE("General"));
return view;
}
示例8: BMessage
ErrorWindow::ErrorWindow(BRect frame, ProjectWindow* parent, ErrorList* list)
:
BWindow(frame, B_TRANSLATE("Errors and warnings"), B_DOCUMENT_WINDOW,
B_ASYNCHRONOUS_CONTROLS),
fParent(parent),
fErrorCount(0),
fWarningCount(0)
{
SetSizeLimits(400, 30000, 250, 30000);
MoveTo(100,100);
AddShortcut('M', B_COMMAND_KEY, new BMessage(M_MAKE_PROJECT));
AddShortcut('R', B_COMMAND_KEY, new BMessage(M_RUN_PROJECT));
AddShortcut('R', B_COMMAND_KEY | B_SHIFT_KEY,
new BMessage(M_RUN_IN_TERMINAL));
AddShortcut('R', B_COMMAND_KEY | B_CONTROL_KEY,
new BMessage(M_RUN_IN_DEBUGGER));
AddShortcut('R', B_COMMAND_KEY | B_CONTROL_KEY | B_SHIFT_KEY,
new BMessage(M_RUN_WITH_ARGS));
AddShortcut('-', B_COMMAND_KEY, new BMessage(M_FORCE_REBUILD));
AddShortcut('I', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
if (list != NULL)
fErrors = *list;
if (parent != NULL) {
BString text = B_TRANSLATE("Errors and warnings: ");
text << fParent->GetProject()->GetName();
SetTitle(text.String());
} else
debugger("BUG: Invalid project for error window");
BString startingLabel(B_TRANSLATE("Errors"));
startingLabel << " (10000)";
fErrorBox = new BCheckBox("errorbox", startingLabel.String(),
new BMessage(M_TOGGLE_ERRORS));
fErrorBox->SetLabel(B_TRANSLATE("Errors"));
fErrorBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_CENTER));
startingLabel = B_TRANSLATE("Warnings");
startingLabel << " (10000)";
fWarningBox = new BCheckBox("warningbox", startingLabel.String(),
new BMessage(M_TOGGLE_WARNINGS));
fWarningBox->SetLabel("Warnings");
fWarningBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
B_ALIGN_VERTICAL_CENTER));
fCopyButton = new BButton("copy", B_TRANSLATE("Copy to clipboard"),
new BMessage(M_COPY_ERRORS));
fErrorList = new DListView("errorlist", B_SINGLE_SELECTION_LIST,
B_WILL_DRAW | B_NAVIGABLE);
BScrollView* errorScrollView = fErrorList->MakeScrollView("scroller", true, true);
errorScrollView->ScrollBar(B_HORIZONTAL)->SetSteps(25, 75);
BPopUpMenu* contextMenu = new BPopUpMenu("context_menu", false, false);
contextMenu->AddItem(new BMenuItem(B_TRANSLATE("Copy list to clipboard"),
new BMessage(M_COPY_ERRORS)));
contextMenu->SetTargetForItems(this);
fErrorList->SetContextMenu(contextMenu);
BView* header = BLayoutBuilder::Group<>(B_HORIZONTAL)
.Add(fErrorBox)
.Add(fWarningBox)
.Add(fCopyButton)
.AddGlue()
.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING, 0)
.View();
header->SetName("header");
header->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.Add(header)
.Add(errorScrollView)
.SetInsets(-1.0f)
.End();
if (list != NULL)
RefreshList();
BRect newframe;
BNode node(fParent->GetProject()->GetPath().GetFullPath());
if (node.ReadAttr("error_frame", B_RECT_TYPE, 0, &newframe, sizeof(newframe))) {
if (newframe.left < 100)
newframe.left = 100;
if (newframe.top < 100)
newframe.top = 100;
MoveTo(newframe.left, newframe.top);
ResizeTo(newframe.Width(), newframe.Height());
}
fErrorBox->SetValue(B_CONTROL_ON);
fWarningBox->SetValue(B_CONTROL_ON);
fErrorList->SetInvocationMessage(new BMessage(M_JUMP_TO_MSG));
fErrorList->MakeFocus(true);
}