本文整理汇总了C++中BMenu::AddSeparatorItem方法的典型用法代码示例。如果您正苦于以下问题:C++ BMenu::AddSeparatorItem方法的具体用法?C++ BMenu::AddSeparatorItem怎么用?C++ BMenu::AddSeparatorItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMenu
的用法示例。
在下文中一共展示了BMenu::AddSeparatorItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BWindow
BeCheckersWindow::BeCheckersWindow(BRect frame, const char *title)
: BWindow(frame,
title,
B_TITLED_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE) {
BMenuBar *mb = new BMenuBar(BRect(0, 0, frame.right, 15), "MenuBar");
BMenu *menu = new BMenu("File");
menu->AddItem(new BMenuItem("New", new BMessage(BECHECKERS_NEW), 'N'));
menu->AddItem(new BMenuItem("Open...", new BMessage(BECHECKERS_OPEN), 'O'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Save", new BMessage(BECHECKERS_SAVE), 'S'));
menu->AddItem(new BMenuItem("Save As", new BMessage(BECHECKERS_SAVEAS)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("About BeCheckers...", new BMessage(B_ABOUT_REQUESTED)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q'));
mb->AddItem(menu);
AddChild(mb);
mvIndicationLabel = new BStringView(BRect(0, 472, 450, 485), "Status", "Dark to move");
mvIndicationLabel->SetViewColor(232, 232, 232);
mvIndicationLabel->SetAlignment(B_ALIGN_CENTER);
AddChild(mvIndicationLabel);
StartGame();
}
示例2: BMessage
void
ExpanderWindow::_AddMenuBar(BLayout* layout)
{
fBar = new BMenuBar("menu_bar", B_ITEMS_IN_ROW, B_INVALIDATE_AFTER_LAYOUT);
BMenu* menu = new BMenu(B_TRANSLATE("File"));
menu->AddItem(fSourceItem = new BMenuItem(B_TRANSLATE("Set source…"),
new BMessage(MSG_SOURCE), 'O'));
menu->AddItem(fDestItem = new BMenuItem(B_TRANSLATE("Set destination…"),
new BMessage(MSG_DEST), 'D'));
menu->AddSeparatorItem();
menu->AddItem(fExpandItem = new BMenuItem(B_TRANSLATE("Expand"),
new BMessage(MSG_EXPAND), 'E'));
fExpandItem->SetEnabled(false);
menu->AddItem(fShowItem = new BMenuItem(B_TRANSLATE("Show contents"),
new BMessage(MSG_SHOW), 'L'));
fShowItem->SetEnabled(false);
menu->AddSeparatorItem();
menu->AddItem(fStopItem = new BMenuItem(B_TRANSLATE("Stop"),
new BMessage(MSG_STOP), 'K'));
fStopItem->SetEnabled(false);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W'));
fBar->AddItem(menu);
menu = new BMenu(B_TRANSLATE("Settings"));
menu->AddItem(fPreferencesItem = new BMenuItem(B_TRANSLATE("Settings…"),
new BMessage(MSG_PREFERENCES), 'S'));
fBar->AddItem(menu);
layout->AddView(fBar);
}
示例3: BMessage
BMenu*
PoorManWindow::BuildEditMenu() const
{
BMenu* ptrEditMenu = new BMenu(STR_MNU_EDIT);
BMenuItem* CopyMenuItem = new BMenuItem(STR_MNU_EDIT_COPY,
new BMessage(B_COPY), CMD_EDIT_COPY);
ptrEditMenu->AddItem(CopyMenuItem);
CopyMenuItem->SetTarget(fLoggingView, NULL);
ptrEditMenu->AddSeparatorItem();
BMenuItem* SelectAllMenuItem = new BMenuItem(STR_MNU_EDIT_SELECT_ALL,
new BMessage(B_SELECT_ALL), CMD_EDIT_SELECT_ALL);
ptrEditMenu->AddItem(SelectAllMenuItem);
SelectAllMenuItem->SetTarget(fLoggingView, NULL);
ptrEditMenu->AddSeparatorItem();
BMenuItem* PrefMenuItem = new BMenuItem(STR_MNU_EDIT_PREF,
new BMessage(MSG_MENU_EDIT_PREF));
ptrEditMenu->AddItem(PrefMenuItem);
return ptrEditMenu;
}
示例4: Bounds
GraphWindow::GraphWindow(BRect frame):BWindow(frame, "Graph", B_TITLED_WINDOW,
B_NOT_ZOOMABLE|B_ASYNCHRONOUS_CONTROLS|B_WILL_ACCEPT_FIRST_CLICK)
{
BRect the_rect;
BMenu* tempMenu;
the_rect = Bounds();
menuBar = new BMenuBar(the_rect, "GraphMenuBar");
AddChild(menuBar);
tempMenu = new BMenu("File");
tempMenu->AddItem(new BMenuItem("About", new BMessage(MENU_FILE_ABOUT) ));
tempMenu->AddSeparatorItem();
tempMenu->AddItem(new BMenuItem("Save", new BMessage(MENU_FILE_SAVE), 'S'));
tempMenu->AddSeparatorItem();
tempMenu->AddItem(new BMenuItem("Quit", new BMessage(MENU_FILE_QUIT) , 'Q') );
menuBar->AddItem(tempMenu);
tempMenu = new BMenu("Edit");
tempMenu->AddItem(new BMenuItem("Copy", new BMessage(MENU_EDIT_COPY), 'C' ) );
menuBar->AddItem(tempMenu);
tempMenu = new BMenu("Window");
settingsWindowItem = new BMenuItem("Window Settings", new BMessage(MENU_WINDOW_SETTINGS), '1');
settingsWindowItem->SetMarked(true);
tempMenu->AddItem(settingsWindowItem);
functionWindowItem = new BMenuItem("Function List", new BMessage(MENU_WINDOW_FUNCTION), '2');
functionWindowItem->SetMarked(true);
tempMenu->AddItem(functionWindowItem);
menuBar->AddItem(tempMenu);
menuBar->ResizeToPreferred();
the_rect.top = menuBar->Frame().bottom +1;
AddChild(the_graph = new GraphView( the_rect ));
savePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this) ,NULL,B_FILE_NODE,false);
BRect windowRect;
windowRect.Set(frame.right,frame.top, frame.right+250, frame.top+110);
windowRect.OffsetBy(10,0);
settingsWindow = new SettingsWindow(windowRect);
windowRect.OffsetBy(0,settingsWindow->Frame().Height()+20);
windowRect.right=windowRect.left+250;
windowRect.bottom=windowRect.top+300;
functionWindow = new FunctionListWindow(windowRect);
settingsWindow->AddToSubset(this);
functionWindow->AddToSubset(this);
}
示例5: menuRect
GDWindow::GDWindow(BRect frame)
: BWindow(frame, "GrafDemo 4.6", B_DOCUMENT_WINDOW,0)
{
Lock();
// Add the graph to the window
BRect grafRect = Bounds();
grafRect.top += mb_height + 2;
mGraphView= new GDView(grafRect);
AddChild(mGraphView);
SetSizeLimits(frame.right - frame.left,9999,frame.bottom - frame.top,9999);
// Add the main menu bar and menus
BRect menuRect(0,0,1000,mb_height);
BMenuBar* menuBar = new BMenuBar(menuRect,"MB");
BMenu* fileMenu = new BMenu("File");
BMenuItem* aboutItem = new BMenuItem("About...",new BMessage(B_ABOUT_REQUESTED));
aboutItem->SetTarget(be_app);
fileMenu->AddItem(aboutItem);
fileMenu->AddSeparatorItem();
fileMenu->AddItem(new BMenuItem("Quit",new BMessage(B_QUIT_REQUESTED)));
menuBar->AddItem(fileMenu);
BMenu* editMenu = new BMenu("Edit");
editMenu->AddItem(new BMenuItem("Erase",new BMessage(G_erase_data)));
editMenu->AddItem(new BMenuItem("Reset Axes",new BMessage(G_reset_axes)));
editMenu->SetTargetForItems(mGraphView);
menuBar->AddItem(editMenu);
BMenu* paramsMenu = new BMenu("Params");
BMessage* cFitMesg = new BMessage(G_set_params);
cFitMesg->AddInt16(pName,0);
BMessage* p2Mesg = new BMessage(G_set_params);
p2Mesg->AddInt16(pName,2);
BMessage* p3Mesg = new BMessage(G_set_params);
p3Mesg->AddInt16(pName,3);
BMessage* p4Mesg = new BMessage(G_set_params);
p4Mesg->AddInt16(pName,4);
paramsMenu->AddItem(new BMenuItem("Cubic Spline",cFitMesg));
paramsMenu->AddSeparatorItem();
paramsMenu->AddItem(new BMenuItem("1st Order",p2Mesg));
paramsMenu->AddItem(new BMenuItem("2nd Order",p3Mesg));
paramsMenu->AddItem(new BMenuItem("3rd Order",p4Mesg));
paramsMenu->SetRadioMode(true);
paramsMenu->FindItem("2nd Order")->SetMarked(true);
paramsMenu->SetTargetForItems(mGraphView);
menuBar->AddItem(paramsMenu);
BMenu* axisMenu = new BMenu("Axes");
axisMenu->AddItem(new BMenuItem("Set Axes"B_UTF8_ELLIPSIS,new BMessage(G_change_axis)));
axisMenu->SetTargetForItems(mGraphView);
menuBar->AddItem(axisMenu);
AddChild(menuBar);
Unlock();
}
示例6: BMessage
BMenuBar*
KeymapWindow::_CreateMenu()
{
BMenuBar* menuBar = new BMenuBar(Bounds(), "menubar");
BMenuItem* item;
// Create the File menu
BMenu* menu = new BMenu(TR("File"));
menu->AddItem(new BMenuItem(TR("Open" B_UTF8_ELLIPSIS),
new BMessage(kMsgMenuFileOpen), 'O'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(TR("Save as" B_UTF8_ELLIPSIS),
new BMessage(kMsgMenuFileSaveAs)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(TR("Quit"),
new BMessage(B_QUIT_REQUESTED), 'Q'));
menuBar->AddItem(menu);
// Create keyboard layout menu
fLayoutMenu = new BMenu(TR("Layout"));
fLayoutMenu->SetRadioMode(true);
fLayoutMenu->AddItem(item = new BMenuItem(
fKeyboardLayoutView->GetKeyboardLayout()->Name(),
new BMessage(kChangeKeyboardLayout)));
item->SetMarked(true);
_AddKeyboardLayouts(fLayoutMenu);
menuBar->AddItem(fLayoutMenu);
// Create the Font menu
fFontMenu = new BMenu(TR("Font"));
fFontMenu->SetRadioMode(true);
int32 numFamilies = count_font_families();
font_family family, currentFamily;
font_style currentStyle;
uint32 flags;
be_plain_font->GetFamilyAndStyle(¤tFamily, ¤tStyle);
for (int32 i = 0; i < numFamilies; i++) {
if (get_font_family(i, &family, &flags) == B_OK) {
BMenuItem *item =
new BMenuItem(family, new BMessage(kMsgMenuFontChanged));
fFontMenu->AddItem(item);
if (!strcmp(family, currentFamily))
item->SetMarked(true);
}
}
menuBar->AddItem(fFontMenu);
return menuBar;
}
示例7: BWindow
TSignatureWindow::TSignatureWindow(BRect rect)
: BWindow (rect, MDR_DIALECT_CHOICE ("Signatures","署名の編集"), B_TITLED_WINDOW, 0),
fFile(NULL)
{
BMenu *menu;
BMenuBar *menu_bar;
BMenuItem *item;
BRect r = Bounds();
/*** Set up the menus ****/
menu_bar = new BMenuBar(r, "MenuBar");
menu = new BMenu(MDR_DIALECT_CHOICE ("Signature","S) 署名"));
menu->AddItem(fNew = new BMenuItem(MDR_DIALECT_CHOICE ("New","N) 新規"), new BMessage(M_NEW), 'N'));
fSignature = new TMenu(MDR_DIALECT_CHOICE ("Open","O) 開く"), INDEX_SIGNATURE, M_SIGNATURE);
menu->AddItem(new BMenuItem(fSignature));
menu->AddSeparatorItem();
menu->AddItem(fSave = new BMenuItem(MDR_DIALECT_CHOICE ("Save","S) 保存"), new BMessage(M_SAVE), 'S'));
menu->AddItem(fDelete = new BMenuItem(MDR_DIALECT_CHOICE ("Delete","T) 削除"), new BMessage(M_DELETE), 'T'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE ("Close","W) 閉じる"), new BMessage(B_QUIT_REQUESTED), 'W'));
menu_bar->AddItem(menu);
menu = new BMenu(MDR_DIALECT_CHOICE ("Edit","E) 編集"));
menu->AddItem(fUndo = new BMenuItem(MDR_DIALECT_CHOICE ("Undo","Z) やり直し"), new BMessage(B_UNDO), 'Z'));
fUndo->SetTarget(NULL, this);
menu->AddSeparatorItem();
menu->AddItem(fCut = new BMenuItem(MDR_DIALECT_CHOICE ("Cut","X) 切り取り"), new BMessage(B_CUT), 'X'));
fCut->SetTarget(NULL, this);
menu->AddItem(fCopy = new BMenuItem(MDR_DIALECT_CHOICE ("Copy","C) コピー"), new BMessage(B_COPY), 'C'));
fCopy->SetTarget(NULL, this);
menu->AddItem(fPaste = new BMenuItem(MDR_DIALECT_CHOICE ("Paste","V) 貼り付け"), new BMessage(B_PASTE), 'V'));
fPaste->SetTarget(NULL, this);
menu->AddItem(item = new BMenuItem(MDR_DIALECT_CHOICE ("Select All","A) 全文選択"), new BMessage(M_SELECT), 'A'));
item->SetTarget(NULL, this);
menu_bar->AddItem(menu);
AddChild(menu_bar);
/**** Done with the menu set up *****/
/**** Add on the panel, giving it the width and at least one vertical pixel *****/
fSigView = new TSignatureView(BRect(0, menu_bar->Frame().bottom+1,
rect.Width(), menu_bar->Frame().bottom+2));
AddChild(fSigView);
/* resize the window to the correct height */
fSigView->SetResizingMode(B_FOLLOW_NONE);
ResizeTo(rect.Width()-2, fSigView->Frame().bottom-2);
fSigView->SetResizingMode(B_FOLLOW_ALL);
SetSizeLimits(kSigWidth, RIGHT_BOUNDARY, r.top + 100, RIGHT_BOUNDARY);
}
示例8: BMessage
/* static */ BMenu*
TermWindow::_MakeWindowSizeMenu()
{
BMenu* menu = new (std::nothrow) BMenu(B_TRANSLATE("Window size"));
if (menu == NULL)
return NULL;
const int32 windowSizes[4][2] = {
{ 80, 25 },
{ 80, 40 },
{ 132, 25 },
{ 132, 40 }
};
const int32 sizeNum = sizeof(windowSizes) / sizeof(windowSizes[0]);
for (int32 i = 0; i < sizeNum; i++) {
char label[32];
int32 columns = windowSizes[i][0];
int32 rows = windowSizes[i][1];
snprintf(label, sizeof(label), "%" B_PRId32 "x%" B_PRId32, columns, rows);
BMessage* message = new BMessage(MSG_COLS_CHANGED);
message->AddInt32("columns", columns);
message->AddInt32("rows", rows);
menu->AddItem(new BMenuItem(label, message));
}
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Full screen"),
new BMessage(FULLSCREEN), B_ENTER));
return menu;
}
示例9: BMessage
BMenu*
TPrefsWindow::_BuildReplyPreambleMenu()
{
const char *substitutes[] = {
/* To do: Not yet working, leave out for 2.0.0 beta 4:
"%f - First name",
"%l - Last name",
*/
B_TRANSLATE("%n - Full name"),
B_TRANSLATE("%e - E-mail address"),
B_TRANSLATE("%d - Date"),
"",
B_TRANSLATE("\\n - Newline"),
NULL
};
BMenu *menu = new BMenu(B_EMPTY_STRING);
for (int32 i = 0; substitutes[i]; i++) {
if (*substitutes[i] == '\0') {
menu->AddSeparatorItem();
} else {
menu->AddItem(new BMenuItem(substitutes[i],
new BMessage(P_REPLY_PREAMBLE)));
}
}
return menu;
}
示例10: BuildProtocolMenu
void ChatWindow::BuildProtocolMenu(void) {
BMessage getStatus(IM::GET_CONTACT_STATUS);
getStatus.AddRef("contact", &fEntry);
BMessage statusMsg;
BMenu *menu = fProtocolMenu->Menu();
if (menu == NULL) {
LOG("im_emoclient", liHigh, "BuildProtocolMenu(): fProtocolMenu is NULL.");
return;
}
// You have to do this twice... buggered if I know why...
for (int32 i = 0; i < menu->CountItems(); i++) delete menu->RemoveItem(0L);
for (int32 i = 0; i < menu->CountItems(); i++) delete menu->RemoveItem(0L);
menu->AddItem(new IconMenuItem(NULL, _T("Any Protocol"), NULL,
new BMessage(PROTOCOL_SELECTED)));
if (fMan->SendMessage(&getStatus, &statusMsg) != B_OK) {
LOG("im_emoclient", liHigh, "Failed to get contact statues");
return;
};
BPath iconDir;
find_directory(B_USER_ADDONS_DIRECTORY, &iconDir, true);
iconDir.Append("im_kit/protocols");
menu->AddSeparatorItem();
for (int32 i = 0; statusMsg.FindString("connection", i); i++) {
BString status = statusMsg.FindString("status", i);
IM::Connection connection( statusMsg.FindString("connection", i) );
BString iconPath = iconDir.Path();
iconPath << "/" << connection.Protocol();
BBitmap *icon = ReadNodeIcon(iconPath.String(), kSmallIcon, true);
BString label = connection.String();
label << " (" << _T(status.String()) << ")";
menu->AddItem(
new IconMenuItem(
icon,
label.String(),
connection.String(),
new BMessage(PROTOCOL_SELECTED)
)
);
};
// TODO: Is this call needed or not?
//menu->SetFont(be_plain_font);
fStatusBar->PositionViews();
fInfoView->ResizeTo(fStatusBar->Bounds().Width() - fInfoView->Frame().left,
fInfoView->Bounds().Height());
};
示例11: BMenu
void
ResView::BuildMenus(BMenuBar *menuBar)
{
BMenu *menu = new BMenu("File");
menu->AddItem(new BMenuItem("New" B_UTF8_ELLIPSIS, new BMessage(M_NEW_FILE), 'N'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Open" B_UTF8_ELLIPSIS, new BMessage(M_OPEN_FILE), 'O'));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Save", new BMessage(M_SAVE_FILE), 'S'));
menu->AddItem(new BMenuItem("Save As" B_UTF8_ELLIPSIS, new BMessage(M_SHOW_SAVE_PANEL), 'S',
B_COMMAND_KEY | B_SHIFT_KEY));
menuBar->AddItem(menu);
menu = new BMenu("Resource");
menu->AddItem(new BMenuItem("Add" B_UTF8_ELLIPSIS, new BMessage(M_SELECT_FILE), 'F'));
menu->AddItem(new BMenuItem("Delete", new BMessage(M_DELETE_RESOURCE), 'D'));
menuBar->AddItem(menu);
}
示例12: BWindow
Fenster::Fenster() : BWindow( BRect( 20, 40, 620, 460), "PecoRename", B_TITLED_WINDOW, 0){
// Menü
BMenuBar* MenuBar = new BMenuBar( BRect( 0, 0, 0, 0 ), "MenuBar" );
BMenu* Menu;
Menu = new BMenu(STR_MENU_FILE);
MenuBar->AddItem(Menu);
Menu->AddItem(new BMenuItem(STR_MENU_NEW, new BMessage(MSG_MENU_NEW), 'N'));
Menu->AddItem(new BMenuItem(STR_MENU_OPEN, new BMessage(MSG_SELECT_FILES), 'O'));
Menu->AddSeparatorItem();
Menu->AddItem(new BMenuItem(STR_MENU_ABOUT, new BMessage(B_ABOUT_REQUESTED)));
Menu->AddSeparatorItem();
Menu->AddItem(new BMenuItem(STR_MENU_QUIT, new BMessage(B_QUIT_REQUESTED), 'Q'));
Menu = new BMenu(STR_MENU_TOOLS);
MenuBar->AddItem(Menu);
Menu->AddItem(new BMenuItem(STR_MENU_CREATE_SCRIPT, new BMessage(MSG_MENU_SCRIPT)));
Menu = new BMenu(STR_MENU_HELP);
MenuBar->AddItem(Menu);
Menu->AddItem(new BMenuItem(STR_MENU_DOCU, new BMessage(MSG_MENU_DOCU)));
AddChild( MenuBar );
// Größe bestimmen + Fenster anpassen
float BarWidth, BarHeight;
MenuBar->GetPreferredSize ( &BarWidth, &BarHeight );
SetSizeLimits( 600, 600, 10000, 155 + BarHeight + 5 * be_plain_font->Size() + 2 * be_bold_font->Size());
// Main Frame
BRect MainFrame = Bounds();
MainFrame.top += BarHeight;
MainView* mainView = new MainView( MainFrame );
AddChild( mainView );
BTextControl* TextControl = (BTextControl *)FindView("pfadView");
TextControl->TextView()->MakeEditable(false);
};
示例13: BMessage
void
HWindow::_InitGUI()
{
fEventList = new HEventList();
fEventList->SetType(BMediaFiles::B_SOUNDS);
fEventList->SetSelectionMode(B_SINGLE_SELECTION_LIST);
BMenu* menu = new BMenu("file");
menu->SetRadioMode(true);
menu->SetLabelFromMarked(true);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("<none>"),
new BMessage(M_NONE_MESSAGE)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS),
new BMessage(M_OTHER_MESSAGE)));
BString label(B_TRANSLATE("Sound file:"));
BMenuField* menuField = new BMenuField("filemenu", label, menu);
menuField->SetDivider(menuField->StringWidth(label) + 10);
BSize buttonsSize(be_plain_font->Size() * 2.5, be_plain_font->Size() * 2.5);
BButton* stopbutton = new BButton("stop", "\xE2\x96\xA0",
new BMessage(M_STOP_MESSAGE));
stopbutton->SetEnabled(false);
stopbutton->SetExplicitSize(buttonsSize);
// We need at least one view to trigger B_PULSE_NEEDED events which we will
// intercept in DispatchMessage to trigger the buttons enabling or disabling.
stopbutton->SetFlags(stopbutton->Flags() | B_PULSE_NEEDED);
BButton* playbutton = new BButton("play", "\xE2\x96\xB6",
new BMessage(M_PLAY_MESSAGE));
playbutton->SetEnabled(false);
playbutton->SetExplicitSize(buttonsSize);
BLayoutBuilder::Group<>(this, B_VERTICAL)
.SetInsets(B_USE_WINDOW_SPACING)
.Add(fEventList)
.AddGroup(B_HORIZONTAL)
.Add(menuField)
.AddGroup(B_HORIZONTAL, 0)
.Add(playbutton)
.Add(stopbutton)
.End()
.End();
// setup file menu
_SetupMenuField();
BMenuItem* noneItem = menu->FindItem(B_TRANSLATE("<none>"));
if (noneItem != NULL)
noneItem->SetMarked(true);
_UpdateZoomLimits();
}
示例14: BMessage
void
MainWindow::_BuildMenu(BMenuBar* menuBar)
{
BMenu* menu = new BMenu(B_TRANSLATE("Tools"));
menu->AddItem(new BMenuItem(B_TRANSLATE("Refresh depots"),
new BMessage(MSG_REFRESH_DEPOTS)));
menuBar->AddItem(menu);
menu = new BMenu(B_TRANSLATE("Show"));
fShowFeaturedPackagesItem = new BMenuItem(
B_TRANSLATE("Only featured packages"),
new BMessage(MSG_SHOW_FEATURED_PACKAGES));
menu->AddItem(fShowFeaturedPackagesItem);
menu->AddSeparatorItem();
fShowAvailablePackagesItem = new BMenuItem(
B_TRANSLATE("Available packages"),
new BMessage(MSG_SHOW_AVAILABLE_PACKAGES));
menu->AddItem(fShowAvailablePackagesItem);
fShowInstalledPackagesItem = new BMenuItem(
B_TRANSLATE("Installed packages"),
new BMessage(MSG_SHOW_INSTALLED_PACKAGES));
menu->AddItem(fShowInstalledPackagesItem);
menu->AddSeparatorItem();
fShowDevelopPackagesItem = new BMenuItem(
B_TRANSLATE("Develop packages"),
new BMessage(MSG_SHOW_DEVELOP_PACKAGES));
menu->AddItem(fShowDevelopPackagesItem);
fShowSourcePackagesItem = new BMenuItem(
B_TRANSLATE("Source packages"),
new BMessage(MSG_SHOW_SOURCE_PACKAGES));
menu->AddItem(fShowSourcePackagesItem);
menuBar->AddItem(menu);
}
示例15: new_icon_editor_menu
static BMenu* new_icon_editor_menu()
{
BMenu* menu = new BMenu("Icon");
if (!menu) return NULL;
BMenuItem* item = new BMenuItem("New", new BMessage(NEW_ICON_MSG), 0, 0);
if (item) menu->AddItem(item);
menu->AddSeparatorItem();
item = new BMenuItem("Copy", new BMessage(COPY_ICON_MSG), 0, 0);
if (item) menu->AddItem(item);
item = new BMenuItem("Paste", new BMessage(PASTE_ICON_MSG), 0, 0);
if (item) menu->AddItem(item);
menu->AddSeparatorItem();
item = new BMenuItem("Flip Vertically", new BMessage(FLIP_VERTICALLY_ICON_MSG), 0, 0);
if (item) menu->AddItem(item);
item = new BMenuItem("Flip Horizontally", new BMessage(FLIP_HORIZONTALLY_ICON_MSG), 0, 0);
if (item) menu->AddItem(item);
menu->AddSeparatorItem();
item = new BMenuItem("Fill with Alpha", new BMessage(FILL_WITH_ALPHA_MSG), 0, 0);
if (item) menu->AddItem(item);
return menu;
}