本文整理汇总了C++中BPopUpMenu::AddSeparatorItem方法的典型用法代码示例。如果您正苦于以下问题:C++ BPopUpMenu::AddSeparatorItem方法的具体用法?C++ BPopUpMenu::AddSeparatorItem怎么用?C++ BPopUpMenu::AddSeparatorItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BPopUpMenu
的用法示例。
在下文中一共展示了BPopUpMenu::AddSeparatorItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BMessage
void
PowerStatusReplicant::MouseDown(BPoint point)
{
BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false);
menu->SetFont(be_plain_font);
BMenuItem* item;
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show text label"),
new BMessage(kMsgToggleLabel)));
if (fShowLabel)
item->SetMarked(true);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show status icon"),
new BMessage(kMsgToggleStatusIcon)));
if (fShowStatusIcon)
item->SetMarked(true);
menu->AddItem(new BMenuItem(!fShowTime ? B_TRANSLATE("Show time") :
B_TRANSLATE("Show percent"),
new BMessage(kMsgToggleTime)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Battery info" B_UTF8_ELLIPSIS),
new BMessage(kMsgToggleExtInfo)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS),
new BMessage(B_ABOUT_REQUESTED)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED)));
menu->SetTargetForItems(this);
ConvertToScreen(&point);
menu->Go(point, true, false, true);
}
示例2: BPopUpMenu
// DisplayPopupMenu
bool
SplitManipulator::DisplayPopupMenu(BPoint where)
{
BPopUpMenu* menu = new BPopUpMenu("item popup", false, false);
BMessage* message;
BMenuItem* item;
bool separator = false;
if (fItem->HasVideo()) {
message = new BMessage(MSG_SET_VIDEO_MUTED);
message->AddPointer("item", fItem);
item = new BMenuItem("Enabled Video", message);
item->SetMarked(!fItem->IsVideoMuted());
menu->AddItem(item);
separator = true;
}
if (fItem->HasAudio()) {
message = new BMessage(MSG_SET_AUDIO_MUTED);
message->AddPointer("item", fItem);
item = new BMenuItem("Enabled Audio", message);
item->SetMarked(!fItem->IsAudioMuted());
menu->AddItem(item);
separator = true;
}
if (separator)
menu->AddSeparatorItem();
BMenuItem* selectClipItem = NULL;
if (ClipPlaylistItem* clipItem = dynamic_cast<ClipPlaylistItem*>(fItem)) {
message = new BMessage(MSG_SELECT_AND_SHOW_CLIP);
message->AddPointer("clip", clipItem->Clip());
selectClipItem = new BMenuItem("Select Clip", message);
menu->AddItem(selectClipItem);
} else
separator = false;
if (separator)
menu->AddSeparatorItem();
message = new BMessage(MSG_REMOVE_ITEM);
message->AddPointer("item", fItem);
item = new BMenuItem("Remove Clip", message);
menu->AddItem(item);
menu->SetTargetForItems(fView);
if (selectClipItem)
selectClipItem->SetTarget(fView->Window());
show_popup_menu(menu, where, fView, false);
return true;
}
示例3: BMessage
void
MediaReplicant::MouseDown(BPoint point)
{
int32 buttons = B_PRIMARY_MOUSE_BUTTON;
if (Looper() != NULL && Looper()->CurrentMessage() != NULL)
Looper()->CurrentMessage()->FindInt32("buttons", &buttons);
BPoint where = ConvertToScreen(point);
if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
BPopUpMenu* menu = new BPopUpMenu("", false, false);
menu->SetFont(be_plain_font);
menu->AddItem(new BMenuItem(
B_TRANSLATE("Media preferences" B_UTF8_ELLIPSIS),
new BMessage(kMsgOpenMediaSettings)));
menu->AddItem(new BMenuItem(
B_TRANSLATE("Sound preferences" B_UTF8_ELLIPSIS),
new BMessage(kMsgOpenSoundSettings)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Open MediaPlayer"),
new BMessage(kMsgOpenMediaPlayer)));
menu->AddSeparatorItem();
BMenu* subMenu = new BMenu(B_TRANSLATE("Options"));
menu->AddItem(subMenu);
BMenuItem* item = new BMenuItem(B_TRANSLATE("Control physical output"),
new BMessage(kMsgVolumeWhich));
item->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT);
subMenu->AddItem(item);
item = new BMenuItem(B_TRANSLATE("Beep"),
new BMessage(kMsgToggleBeep));
item->SetMarked(!fDontBeep);
subMenu->AddItem(item);
menu->SetTargetForItems(this);
subMenu->SetTargetForItems(this);
menu->Go(where, true, true, BRect(where - BPoint(4, 4),
where + BPoint(4, 4)));
} else {
// Show VolumeWindow
fVolumeSlider = new VolumeWindow(BRect(where.x, where.y,
where.x + 207, where.y + 19), fDontBeep, fVolumeWhich);
fVolumeSlider->Show();
}
}
示例4: BMessage
void
NetPulseView::MouseDown(BPoint where)
{
int32 buttons;
int32 clicks;
if (Window()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK
|| Window()->CurrentMessage()->FindInt32("clicks", &clicks) != B_OK) {
return;
}
if (buttons == B_SECONDARY_MOUSE_BUTTON) {
BPopUpMenu* popUpMenu = new BPopUpMenu("NetPulseMenu");
popUpMenu->AddItem(new BMenuItem("Connect",
new BMessage(kMsgConnect)));
popUpMenu->AddItem(new BMenuItem("Disconnect",
new BMessage(kMsgDisconnect)));
popUpMenu->AddSeparatorItem();
popUpMenu->AddItem(new BMenuItem("Statistics...",
new BMessage(kMsgStatistics)));
popUpMenu->AddSeparatorItem();
uint32 cookie = 0;
BNetworkInterface interface;
BNetworkRoster& roster = BNetworkRoster::Default();
while (roster.GetNextInterface(&cookie, interface) == B_OK) {
const char* name = interface.Name();
if (strncmp(name, "loop", 4) != 0) {
BMenuItem* menuItem = new BMenuItem(name,
new BMessage(kMsgChangeInterface + cookie));
menuItem->SetMarked(cookie == fCookie);
popUpMenu->AddItem(menuItem);
}
}
popUpMenu->AddSeparatorItem();
popUpMenu->AddItem(new BMenuItem("Quit", new BMessage(kMsgQuit)));
popUpMenu->SetTargetForItems(this);
popUpMenu->FindItem(kMsgConnect)->SetEnabled(!fEnable && fCookie != 0);
popUpMenu->FindItem(kMsgDisconnect)->SetEnabled(fEnable && fCookie != 0);
popUpMenu->FindItem(kMsgStatistics)->SetEnabled(fEnable && fCookie != 0);
popUpMenu->Go(ConvertToScreen(BPoint(0, 0)), true, false, false);
delete popUpMenu;
} else if (buttons == B_PRIMARY_MOUSE_BUTTON && clicks == 2)
be_roster->Launch("application/x-vnd.Haiku-Network");
}
示例5: BMessage
//! Track the mouse without blocking the window
void
CPUButton::MouseDown(BPoint point)
{
BPoint mousePosition;
uint32 mouseButtons;
GetMouse(&mousePosition, &mouseButtons);
if ((B_PRIMARY_MOUSE_BUTTON & mouseButtons) != 0) {
SetValue(!Value());
SetTracking(true);
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
} else if ((B_SECONDARY_MOUSE_BUTTON & mouseButtons) != 0
&& fReplicantInDeskbar) {
BPopUpMenu *menu = new BPopUpMenu(B_TRANSLATE("Deskbar menu"));
menu->AddItem(new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS),
new BMessage(B_ABOUT_REQUESTED)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Remove replicant"),
new BMessage(kDeleteReplicant)));
menu->SetTargetForItems(this);
ConvertToScreen(&point);
menu->Go(point, true, true, true);
}
}
示例6: NewPropertiesMenu
BPopUpMenu* AmControlChangeInfoView::NewPropertiesMenu() const
{
BPopUpMenu* menu = inherited::NewPropertiesMenu();
if (!menu) return menu;
mCachedControlMenu = NewControlMenu();
if (!mCachedControlMenu) return menu;
BMenuItem* item;
if (mCachedControlMenu->CountItems() < 1 ) {
item = new _AmActiveControlItem( "<track has no output filter>", new BMessage('null') );
if (item) {
item->SetEnabled( false );
mCachedControlMenu->AddItem(item);
}
}
item = new BMenuItem(mCachedControlMenu);
if (!item) {
delete mCachedControlMenu;
mCachedControlMenu = NULL;
return menu;
}
menu->AddSeparatorItem();
menu->AddItem(item);
return menu;
}
示例7: BPopUpMenu
/*static*/ BPopUpMenu*
AppearancePrefView::_MakeMenu(uint32 msg, const char** items,
const char* defaultItemName)
{
BPopUpMenu* menu = new BPopUpMenu("");
int32 i = 0;
while (*items) {
if (!strcmp((*items), ""))
menu->AddSeparatorItem();
else {
BMessage* message = new BMessage(msg);
menu->AddItem(new BMenuItem((*items), message));
}
items++;
i++;
}
BMenuItem* defaultItem = menu->FindItem(defaultItemName);
if (defaultItem)
defaultItem->SetMarked(true);
return menu;
}
示例8: mouseRect
// ShowContextMenu
bool
PathManipulator::ShowContextMenu(BPoint where)
{
// Change the selection to the current point if it isn't currently
// selected. This could will only be chosen if the user right-clicked
// a path point directly.
if (fCurrentPathPoint >= 0 && !fSelection->Contains(fCurrentPathPoint)) {
fSelection->MakeEmpty();
_UpdateSelection();
*fOldSelection = *fSelection;
_Select(fCurrentPathPoint, false);
}
BPopUpMenu* menu = new BPopUpMenu("context menu", false, false);
BMessage* message;
BMenuItem* item;
bool hasSelection = fSelection->CountItems() > 0;
if (fCurrentPathPoint < 0) {
message = new BMessage(B_SELECT_ALL);
item = new BMenuItem("Select All", message, 'A');
menu->AddItem(item);
menu->AddSeparatorItem();
}
message = new BMessage(MSG_TRANSFORM);
item = new BMenuItem("Transform", message, 'T');
item->SetEnabled(hasSelection);
menu->AddItem(item);
message = new BMessage(MSG_SPLIT_POINTS);
item = new BMenuItem("Split", message);
item->SetEnabled(hasSelection);
menu->AddItem(item);
message = new BMessage(MSG_FLIP_POINTS);
item = new BMenuItem("Flip", message);
item->SetEnabled(hasSelection);
menu->AddItem(item);
message = new BMessage(MSG_REMOVE_POINTS);
item = new BMenuItem("Remove", message);
item->SetEnabled(hasSelection);
menu->AddItem(item);
// go
menu->SetTargetForItems(fCanvasView);
menu->SetAsyncAutoDestruct(true);
menu->SetFont(be_plain_font);
where = fCanvasView->ConvertToScreen(where);
BRect mouseRect(where, where);
mouseRect.InsetBy(-10.0, -10.0);
where += BPoint(5.0, 5.0);
menu->Go(where, true, false, mouseRect, true);
return true;
}
示例9: messenger
void
PowerStatusReplicant::MouseDown(BPoint point)
{
BMessage* msg = Window()->CurrentMessage();
int32 buttons = msg->GetInt32("buttons", 0);
if ((buttons & B_TERTIARY_MOUSE_BUTTON) != 0) {
BMessenger messenger(this);
messenger.SendMessage(kMsgToggleExtInfo);
} else {
BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING, false, false);
menu->SetFont(be_plain_font);
BMenuItem* item;
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show text label"),
new BMessage(kMsgToggleLabel)));
if (fShowLabel)
item->SetMarked(true);
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show status icon"),
new BMessage(kMsgToggleStatusIcon)));
if (fShowStatusIcon)
item->SetMarked(true);
menu->AddItem(new BMenuItem(!fShowTime ? B_TRANSLATE("Show time") :
B_TRANSLATE("Show percent"), new BMessage(kMsgToggleTime)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("Battery info" B_UTF8_ELLIPSIS),
new BMessage(kMsgToggleExtInfo)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem(B_TRANSLATE("About" B_UTF8_ELLIPSIS),
new BMessage(B_ABOUT_REQUESTED)));
menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(B_QUIT_REQUESTED)));
menu->SetTargetForItems(this);
ConvertToScreen(&point);
menu->Go(point, true, false, true);
}
}
示例10: messenger
void
QueryView::MouseDown(BPoint point)
{
BPoint cursorpoint;
uint32 buttonmask;
GetMouse(&cursorpoint, &buttonmask);
if( buttonmask & B_PRIMARY_MOUSE_BUTTON )
{
//pop-up query results window
BMessenger messenger(this);
messenger.SendMessage(OPEN_QUERY_WIN);
return; //buttons aren't mutually exclusive, so we favor the primary.
}
if( buttonmask & B_SECONDARY_MOUSE_BUTTON )
{
//pop-up context menu
BPopUpMenu* popup = new BPopUpMenu("QueryWatcher");
BMenuItem* headeritem = new BMenuItem( Name(), NULL );
headeritem->SetEnabled(false);
popup->AddItem(headeritem);
popup->AddSeparatorItem();
popup->AddItem(new BMenuItem("Open settings directory", new BMessage(OPEN_SETTINGS_DIR)));
popup->AddSeparatorItem();
popup->AddItem( new BMenuItem("Open query results", new BMessage(OPEN_QUERY_WIN) ) );
popup->AddItem( new BMenuItem("Reset query", new BMessage(RESET_QUERY) ) );
status_t ret;
ret = popup->SetTargetForItems(this);
#ifdef DEBUG
ASSERT(ret == B_OK);
#endif
ConvertToScreen(&point);
popup->Go(point, true, false, true);
delete popup;
}
}
示例11: BPopUpMenu
void
GLObject::MenuInvoked(BPoint point)
{
BPopUpMenu* m = new BPopUpMenu("Object",false,false);
BMenuItem* i;
int c = 1;
m->AddItem(i = new BMenuItem("White",NULL));
if (color == c++)
i->SetMarked(true);
m->AddItem(i = new BMenuItem("Yellow",NULL));
if (color == c++)
i->SetMarked(true);
m->AddItem(i = new BMenuItem("Blue",NULL));
if (color == c++)
i->SetMarked(true);
m->AddItem(i = new BMenuItem("Red",NULL));
if (color == c++)
i->SetMarked(true);
m->AddItem(i = new BMenuItem("Green",NULL));
if (color == c++)
i->SetMarked(true);
m->AddSeparatorItem();
c = 0;
m->AddItem(i = new BMenuItem("Solid",NULL));
if (solidity == c++)
i->SetMarked(true);
m->AddItem(i = new BMenuItem("Translucent",NULL));
if (solidity == c++)
i->SetMarked(true);
m->AddItem(i = new BMenuItem("Transparent",NULL));
if (solidity == c++)
i->SetMarked(true);
i = m->Go(point);
int32 index = m->IndexOf(i);
delete m;
if (index < 5) {
color = index+1;
} else if (index > 5) {
solidity = index-6;
}
changed = true;
setEvent(fObjView->drawEvent);
}
示例12: BPopUpMenu
BPopUpMenu*
TPrefsWindow::_BuildSignatureMenu(char* sig)
{
char name[B_FILE_NAME_LENGTH];
BEntry entry;
BFile file;
BMenuItem* item;
BMessage* msg;
BQuery query;
BVolume vol;
BVolumeRoster volume;
BPopUpMenu* menu = new BPopUpMenu("");
msg = new BMessage(P_SIG);
msg->AddString("signature", B_TRANSLATE("None"));
menu->AddItem(item = new BMenuItem(B_TRANSLATE("None"), msg));
if (!strcmp(sig, B_TRANSLATE("None")))
item->SetMarked(true);
msg = new BMessage(P_SIG);
msg->AddString("signature", B_TRANSLATE("Random"));
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Random"), msg));
if (!strcmp(sig, B_TRANSLATE("Random")))
item->SetMarked(true);
menu->AddSeparatorItem();
volume.GetBootVolume(&vol);
query.SetVolume(&vol);
query.SetPredicate("_signature = *");
query.Fetch();
while (query.GetNextEntry(&entry) == B_NO_ERROR) {
file.SetTo(&entry, O_RDONLY);
if (file.InitCheck() == B_NO_ERROR) {
msg = new BMessage(P_SIG);
file.ReadAttr("_signature", B_STRING_TYPE, 0, name, sizeof(name));
msg->AddString("signature", name);
menu->AddItem(item = new BMenuItem(name, msg));
if (!strcmp(sig, name))
item->SetMarked(true);
}
}
return menu;
}
示例13: ShowPropertyMenu
void SeqToolBarView::ShowPropertyMenu(const AmTool* tool, BPoint where)
{
BPopUpMenu* menu = new BPopUpMenu("properties menu");
if (!menu) return;
BMessage* msg = new BMessage(PROPERTIES_MSG);
if (msg) {
msg->AddString("tool_key", tool->Key() );
BMenuItem* item = new BMenuItem("Properties", msg);
if (item) {
item->SetTarget(this);
menu->AddItem(item);
}
}
msg = new BMessage(EDIT_MSG);
if (msg) {
msg->AddString("tool_key", tool->Key() );
msg->AddString("path", tool->LocalFilePath() );
BMenuItem* item = new BMenuItem("Edit", msg);
if (item) {
item->SetTarget(this);
if (tool->IsReadOnly() ) item->SetEnabled(false);
menu->AddItem(item);
}
}
menu->AddSeparatorItem();
msg = new BMessage(REMOVE_FROM_TOOL_BAR_MSG);
if (msg) {
msg->AddString("tool_key", tool->Key() );
msg->AddPointer("tool_id", tool->Id() );
BMenuItem* item = new BMenuItem("Remove From Tool Bar", msg);
if (item) {
item->SetTarget(this);
menu->AddItem(item);
}
}
menu->SetAsyncAutoDestruct(true);
where = ConvertToScreen(where);
BRect sticky(where.x-5, where.y-5, where.x+5, where.y+5);
menu->Go(where, true, false, sticky, true);
}
示例14: BPopUpMenu
/*static*/ BPopUpMenu*
AppearancePrefView::_MakeMenu(uint32 msg, const char** items,
const char* defaultItemName)
{
BPopUpMenu* menu = new BPopUpMenu("");
while (*items) {
if (strcmp((*items), "") == 0)
menu->AddSeparatorItem();
else {
BMessage* message = new BMessage(msg);
message->AddString("label", *items);
BMenuItem* item = new BMenuItem(B_TRANSLATE(*items), message);
menu->AddItem(item);
if (strcmp(*items, defaultItemName) == 0)
item->SetMarked(true);
}
items++;
}
return menu;
}
示例15: showContextMenu
void MediaRoutingView::showContextMenu(
BPoint point)
{
D_METHOD(("MediaRoutingView::showContextMenu()\n"));
BPopUpMenu *menu = new BPopUpMenu("MediaRoutingView PopUp", false, false, B_ITEMS_IN_COLUMN);
menu->SetFont(be_plain_font);
// add layout options
BMenuItem *item;
BMessage *message = new BMessage(M_LAYOUT_CHANGED);
message->AddInt32("layout", M_ICON_VIEW);
menu->AddItem(item = new BMenuItem("Icon View", message));
if (m_layout == M_ICON_VIEW)
{
item->SetMarked(true);
}
message = new BMessage(M_LAYOUT_CHANGED);
message->AddInt32("layout", M_MINI_ICON_VIEW);
menu->AddItem(item = new BMenuItem("Mini Icon View", message));
if (m_layout == M_MINI_ICON_VIEW)
{
item->SetMarked(true);
}
menu->AddSeparatorItem();
// add 'CleanUp' command
menu->AddItem(new BMenuItem("Clean Up", new BMessage(M_CLEANUP_REQUESTED), 'K'));
// add 'Select All' command
menu->AddItem(new BMenuItem("Select All", new BMessage(M_SELECT_ALL), 'A'));
menu->SetTargetForItems(this);
ConvertToScreen(&point);
point -= BPoint(1.0, 1.0);
menu->Go(point, true, true, true);
}