本文整理汇总了C++中BMenuBar::SubmenuAt方法的典型用法代码示例。如果您正苦于以下问题:C++ BMenuBar::SubmenuAt方法的具体用法?C++ BMenuBar::SubmenuAt怎么用?C++ BMenuBar::SubmenuAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BMenuBar
的用法示例。
在下文中一共展示了BMenuBar::SubmenuAt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
}
}
示例2: MenusBeginning
void SeqStudioWindow::MenusBeginning()
{
inherited::MenusBeginning();
BMenuBar* bar = KeyMenuBar();
if (!bar) return;
BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(ENDPOINT_LIST_STR) );
if (!table) return;
if (mDeviceCtrl && mDeviceCtrl->Menu() ) add_device_menu_items(mDeviceCtrl->Menu() );
// MIDI Port menu
if (mPortMenu) {
bool deleteEnabled = false;
_EndpointRow* r = dynamic_cast<_EndpointRow*>(table->CurrentSelection() );
if (r && !r->mIsValid && r->mEndpoint.channel < 0) deleteEnabled = true;
BMenuItem* deleteItem = mPortMenu->FindItem(DELETE_STR);
if (deleteItem && deleteItem->IsEnabled() != deleteEnabled) deleteItem->SetEnabled(deleteEnabled);
}
// Attributes menu
BMenu* menu;
BMenuItem* item;
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);
}
}
}
}
}