本文整理汇总了C++中BMenu::FindItem方法的典型用法代码示例。如果您正苦于以下问题:C++ BMenu::FindItem方法的具体用法?C++ BMenu::FindItem怎么用?C++ BMenu::FindItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMenu
的用法示例。
在下文中一共展示了BMenu::FindItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDiagonalWipesMenuItem
BMenuItem* TTransitionMenu::GetDiagonalWipesMenuItem(int16 menuID)
{
BMenuItem* wipesItem = FindItem("Diagonal Wipes");
BMenu* subMenu = wipesItem->Submenu();
switch (menuID)
{
// Wipes Submenu
case kWipeTopLeftBottomRight:
return (subMenu->FindItem(TRAN_WIPE_TOP_LEFT_BOTTOM_RIGHT_MSG) );
break;
case kWipeTopRightBottomLeft:
return (subMenu->FindItem(TRAN_WIPE_TOP_RIGHT_BOTTON_LEFT_MSG) );
break;
case kWipeBottomLeftTopRight:
return (subMenu->FindItem(TRAN_WIPE_BOTTOM_LEFT_TOP_RIGHT_MSG) );
break;
case kWipeBottomRightTopLeft:
return (subMenu->FindItem(TRAN_WIPE_BOTTOM_RIGHT_TOP_LEFT_MSG) );
break;
default:
return NULL;
}
}
示例2: GetStraightWipesMenuItem
BMenuItem* TTransitionMenu::GetStraightWipesMenuItem(int16 menuID)
{
BMenuItem* wipesItem = FindItem("Straight Wipes");
BMenu* subMenu = wipesItem->Submenu();
switch (menuID)
{
// Wipes Submenu
case kWipeRight:
return (subMenu->FindItem(TRAN_WIPE_RIGHT_MSG) );
break;
case kWipeLeft:
return (subMenu->FindItem(TRAN_WIPE_LEFT_MSG) );
break;
case kWipeDown:
return (subMenu->FindItem(TRAN_WIPE_DOWN_MSG) );
break;
case kWipeTop:
return (subMenu->FindItem(TRAN_WIPE_UP_MSG) );
break;
default:
return NULL;
}
}
示例3: AdjustFileMenu
void TCueSheetWindow::AdjustFileMenu()
{
BMenu* theMenu = fAppMenu->GetFileMenu();
if (theMenu) {
// Save item
BMenuItem* saveItem = theMenu->FindItem(FILE_SAVE_MSG);
if (saveItem) {
if (fCueSheetView->IsDirty())
saveItem->SetEnabled(true);
else
saveItem->SetEnabled(false);
}
// Revert item
BMenuItem* revertItem = theMenu->FindItem(FILE_REVERT_MSG);
if (saveItem) {
if (fCueSheetView->IsDirty())
revertItem->SetEnabled(true);
else
revertItem->SetEnabled(false);
}
}
}
示例4: BMessage
void
PPPoEView::MessageReceived(BMessage *message)
{
switch(message->what) {
case kMsgSelectInterface: {
BMenuItem *item = fInterface->Menu()->FindMarked();
if(item)
fInterfaceName = item->Label();
} break;
case kMsgSelectOther:
(new TextRequestDialog("InterfaceName", NULL, kRequestInterfaceName,
fInterfaceName.String()))->Go(new BInvoker(
new BMessage(kMsgFinishSelectOther), this));
break;
case kMsgFinishSelectOther: {
int32 which;
message->FindInt32("which", &which);
const char *name = message->FindString("text");
BMenu *menu = fInterface->Menu();
BMenuItem *item;
if(which != 1 || !name || strlen(name) == 0) {
item = menu->FindItem(fInterfaceName.String());
if(item && menu->IndexOf(item) <= menu->CountItems() - 2)
item->SetMarked(true);
else
fOtherInterface->SetMarked(true);
return;
}
fInterfaceName = name;
item = menu->FindItem(fInterfaceName.String());
if(item && menu->IndexOf(item) <= menu->CountItems() - 2) {
item->SetMarked(true);
return;
}
BString label(kLabelOtherInterface);
label << " " << name;
fOtherInterface->SetLabel(label.String());
fOtherInterface->SetMarked(true);
// XXX: this is needed to tell the owning menu to update its label
} break;
default:
BView::MessageReceived(message);
}
}
示例5:
void
MainWindow::MenusBeginning()
{
BRow* sel = teamView->CurrentSelection();
bool is_sel = (sel != NULL);
BMenu *menu = (BMenu *)FindView("MenuBar");
BMenuItem *item = menu->FindItem(IE_MAINWINDOW_MAINKILL);
if (item) item->SetEnabled(is_sel);
item = menu->FindItem(IE_MAINWINDOW_MAINSUSPEND);
if (item) item->SetEnabled(is_sel);
item = menu->FindItem(IE_MAINWINDOW_MAINRESUME);
if (item) item->SetEnabled(is_sel);
priorityMenu->SetEnabled(is_sel);
priorityMenu->Update();
}
示例6: fontMsg
void
ControlView::_UpdateAndSendStyle(const BMessage* message)
{
_DeselectOldItems();
const char* style;
const char* family;
if (message->FindString("_style", &style) == B_OK
&& message->FindString("_family", &family) == B_OK) {
BMenuItem* familyItem = fFontFamilyMenu->FindItem(family);
if (familyItem && !familyItem->IsMarked()) {
familyItem->SetMarked(true);
BMenu* submenu = familyItem->Submenu();
if (submenu) {
BMenuItem* styleItem = submenu->FindItem(style);
if (styleItem && !styleItem->IsMarked())
styleItem->SetMarked(true);
}
printf("Family: %s, Style: %s\n", family, style);
}
BString string;
string << family << " " << style;
if (fFontMenuField)
fFontMenuField->MenuItem()->SetLabel(string.String());
}
BMessage fontMsg(FONTSTYLE_CHANGED_MSG);
if (fontMsg.AddMessage("_fontMessage", message) == B_OK)
fMessenger->SendMessage(&fontMsg);
}
示例7: address
/***********************************************************
* SetFrom
***********************************************************/
void
HAddressView::SetFrom(const char* in_address)
{
if( ::strlen(in_address) == 0)
return;
BString address(in_address);
// Compare existing accounts
char name[B_FILE_NAME_LENGTH];
BPath path;
::find_directory(B_USER_SETTINGS_DIRECTORY,&path);
path.Append(APP_NAME);
path.Append("Accounts");
BDirectory dir(path.Path());
status_t err = B_OK;
BEntry entry;
bool changed = false;
while(err == B_OK)
{
if( (err = dir.GetNextEntry(&entry)) != B_OK )
break;
BFile file(&entry,B_READ_ONLY);
if(file.InitCheck() == B_OK && entry.IsFile())
{
BMessage msg;
msg.Unflatten(&file);
BString myAddress;
PRINT(("%s\n",in_address));
if(msg.FindString("address",&myAddress) != B_OK)
myAddress = "";
// Change account
if(address.FindFirst(myAddress) != B_ERROR)
{
entry.GetName(name);
ChangeAccount(name);
// Set From menu
BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
BMenu *menu = field->Menu();
BMenuItem *item = menu->FindItem(name);
if(item)
item->SetMarked(true);
changed=true;
break;
}
}
}
if(!changed && cast_as(Window()->FindView("HMailView"),BTextView))
{
BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
BMenuItem *item(NULL);
item = field->Menu()->FindMarked();
if(item)
{
ChangeAccount(item->Label());
item->SetMarked(true);
}
}
}
示例8: 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();
}
示例9: 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();
}
示例10: GetCurtainsMenuItem
BMenuItem* TTransitionMenu::GetCurtainsMenuItem(int16 menuID)
{
BMenuItem* wipesItem = FindItem("Curtains");
BMenu* subMenu = wipesItem->Submenu();
switch (menuID)
{
case kCurtainsIn:
return (subMenu->FindItem(TRAN_CURTAINS_IN_MSG) );
break;
case kCurtainsOut:
return (subMenu->FindItem(TRAN_CURTAINS_OUT_MSG) );
break;
default:
return NULL;
}
}
示例11: MenusBeginning
void SeqManageRosterWindow::MenusBeginning()
{
inherited::MenusBeginning();
BMenuBar* bar = KeyMenuBar();
if (!bar) return;
BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(TABLE_STR) );
if (!table) return;
BMenu* menu;
BMenuItem* item;
// Entry menu
bool canEdit = false, canDuplicate = false;
BString key, filePath;
bool readOnly;
if (GetSelectionInfo(key, filePath, &readOnly) == B_OK) {
canEdit = !readOnly;
canDuplicate = true;
}
if ( (menu = bar->SubmenuAt(ENTRY_MENU_INDEX)) != NULL) {
if ( (item = menu->FindItem(EDIT_ENTRY_MSG)) != NULL) item->SetEnabled(canEdit);
if ( (item = menu->FindItem(DUPLICATE_ENTRY_MSG)) != NULL) item->SetEnabled(canDuplicate);
if ( (item = menu->FindItem(DELETE_ENTRY_MSG)) != NULL) item->SetEnabled(canEdit);
}
// Attributes menu
if ( (menu = bar->SubmenuAt(ATTRIBUTES_MENU_INDEX)) != NULL) {
for (int32 k = 0; (item = menu->ItemAt(k)) != NULL; k++) {
const char* n;
if (item->Message() && item->Message()->FindString(COLUMN_NAME_STR, &n) == B_OK) {
BColumn* col = column_named(n, table);
if (col && col->IsVisible() ) {
if (!item->IsMarked() ) item->SetMarked(true);
} else {
if (item->IsMarked() ) item->SetMarked(false);
}
}
}
}
}
示例12: AdjustCueMenu
void TCueSheetWindow::AdjustCueMenu()
{
BMenu* theMenu = fAppMenu->GetCueMenu();
if (theMenu) {
// Get Cue Info
// Enable if any items are selected
BMenuItem* cueInfoItem = theMenu->FindItem(CUESHEET_GETINFO_MSG);
if (cueInfoItem)
cueInfoItem->SetEnabled( fCueSheetView->ItemsSelected() );
// Default Cue Setup
// Enable if any items are selected
//BMenuItem *cueInfoItem = theMenu->FindItem(CUESHEET_GETINFO_MSG);
//if (cueInfoItem)
// cueInfoItem->SetEnabled( fCueSheetView->ItemsSelected() );
// Show Cue Contents
// Enable if any items are selected
BMenuItem* showContentsItem = theMenu->FindItem(CUESHEET_SHOWCONTENTS_MSG);
if (showContentsItem)
showContentsItem->SetEnabled( fCueSheetView->ItemsSelected() );
// Show All Cue Contents
// Enable if we have cues
BMenuItem* showAllContentsItem = theMenu->FindItem(CUESHEET_SHOWALLCONTENTS_MSG);
if (showAllContentsItem)
showAllContentsItem->SetEnabled( fCueSheetView->HasCues() );
// Hide All Cue Contents
// Enable if we have cues
BMenuItem* hideAllContentsItem = theMenu->FindItem(CUESHEET_HIDEALLCONTENTS_MSG);
if (hideAllContentsItem)
hideAllContentsItem->SetEnabled( fCueSheetView->HasCues() );
// Cue Setup
// Enable if any items are selected
BMenuItem* setupItem = theMenu->FindItem(CUESHEET_SETUP_MSG);
if (setupItem)
setupItem->SetEnabled( fCueSheetView->ItemsSelected() );
// Open Cue Editor
// Enable if any items are selected
BMenuItem* editItem = theMenu->FindItem(CUESHEET_EDIT_MSG);
if (editItem)
editItem->SetEnabled( fCueSheetView->ItemsSelected() );
// Add Keyframes
// Enable if any items are selected
BMenuItem* keyframeItem = theMenu->FindItem(CUESHEET_KEYFRAME_MSG);
if (keyframeItem)
keyframeItem->SetEnabled( fCueSheetView->ItemsSelected() );
}
}
示例13: if
void
PPPoEView::ReloadInterfaces()
{
// delete all items and request a new bunch from the pppoe kernel module
BMenu *menu = fInterface->Menu();
while(menu->CountItems() > 2)
delete menu->RemoveItem((int32) 0);
fOtherInterface->SetLabel(kLabelOtherInterface);
PPPManager manager;
char *interfaces = new char[8192];
// reserve enough space for approximately 512 entries
int32 count = manager.ControlModule("pppoe", PPPoE_GET_INTERFACES, interfaces,
8192);
BMenuItem *item;
char *name = interfaces;
int32 insertAt;
for(int32 index = 0; index < count; index++) {
item = new BMenuItem(name, new BMessage(kMsgSelectInterface));
insertAt = FindNextMenuInsertionIndex(menu, name);
if(insertAt > menu->CountItems() - 2)
insertAt = menu->CountItems() - 2;
item->SetTarget(this);
menu->AddItem(item, insertAt);
name += strlen(name) + 1;
}
// set interface or some default value if nothing was found
if(Addon()->InterfaceName() && strlen(Addon()->InterfaceName()) > 0)
fInterfaceName = Addon()->InterfaceName();
else if(count > 0)
fInterfaceName = interfaces;
else
fInterfaceName = "";
delete interfaces;
item = menu->FindItem(fInterfaceName.String());
if(item && menu->IndexOf(item) <= menu->CountItems() - 2)
item->SetMarked(true);
else if(Addon()->InterfaceName()) {
BString label(kLabelOtherInterface);
label << " " << fInterfaceName;
fOtherInterface->SetLabel(label.String());
fOtherInterface->SetMarked(true);
}
}
示例14: AdjustStageMenu
void TCueSheetWindow::AdjustStageMenu()
{
BMenu* theMenu = fAppMenu->GetStageMenu();
if (theMenu) {
// Stage Item
//BMenuItem *stageItem = theMenu->FindItem(WINDOWS_STAGE_MSG);
//if (stageItem)
// Live Drag Item
BMenuItem* updateItem = theMenu->FindItem(STAGE_LUPDATE_MSG);
if (updateItem)
updateItem->SetMarked( fCueSheetView->GetLiveUpdate() );
}
}
示例15: GetRevealMenuItem
BMenuItem* TTransitionMenu::GetRevealMenuItem(int16 menuID)
{
BMenuItem* wipesItem = FindItem("Reveal");
BMenu* subMenu = wipesItem->Submenu();
switch (menuID)
{
case kRevealRight:
return (subMenu->FindItem(TRAN_REVEAL_RIGHT_MSG) );
break;
case kRevealLeft:
return (subMenu->FindItem(TRAN_REVEAL_LEFT_MSG) );
break;
case kRevealDown:
return (subMenu->FindItem(TRAN_REVEAL_DOWN_MSG) );
break;
case kRevealUp:
return (subMenu->FindItem(TRAN_REVEAL_UP_MSG) );
break;
case kRevealTopLeftBottomRight:
return (subMenu->FindItem(TRAN_REVEAL_TOP_LEFT_BOTTOM_RIGHT_MSG) );
break;
case kRevealTopRightBottomLeft:
return (subMenu->FindItem(TRAN_REVEAL_TOP_RIGHT_BOTTON_LEFT_MSG) );
break;
case kRevealBottomLeftTopRight:
return (subMenu->FindItem(TRAN_REVEAL_BOTTOM_LEFT_TOP_RIGHT_MSG) );
break;
case kRevealBottomRightTopLeft:
return (subMenu->FindItem(TRAN_REVEAL_BOTTOM_RIGHT_TOP_LEFT_MSG) );
break;
default:
return NULL;
}
}