static void populateContextMenuItems(ExecState* exec, JSArray* array, ContextMenu& menu) { for (size_t i = 0; i < array->length(); ++i) { JSObject* item = asObject(array->getIndex(exec, i)); JSValue label = item->get(exec, Identifier::fromString(exec, "label")); JSValue type = item->get(exec, Identifier::fromString(exec, "type")); JSValue id = item->get(exec, Identifier::fromString(exec, "id")); JSValue enabled = item->get(exec, Identifier::fromString(exec, "enabled")); JSValue checked = item->get(exec, Identifier::fromString(exec, "checked")); JSValue subItems = item->get(exec, Identifier::fromString(exec, "subItems")); if (!type.isString()) continue; String typeString = type.toWTFString(exec); if (typeString == "separator") { ContextMenuItem item(SeparatorType, ContextMenuItemTagNoAction, String()); menu.appendItem(item); } else if (typeString == "subMenu" && subItems.inherits(JSArray::info())) { ContextMenu subMenu; JSArray* subItemsArray = asArray(subItems); populateContextMenuItems(exec, subItemsArray, subMenu); ContextMenuItem item(SubmenuType, ContextMenuItemTagNoAction, label.toWTFString(exec), &subMenu); menu.appendItem(item); } else { ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(exec)); ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, label.toWTFString(exec)); if (!enabled.isUndefined()) menuItem.setEnabled(enabled.toBoolean(exec)); if (!checked.isUndefined()) menuItem.setChecked(checked.toBoolean(exec)); menu.appendItem(menuItem); } } }
void MSStringPopupMenu::receiveEvent(MSEvent& aEvent_) { if (aEvent_.type()==MSIndexedEvent::symbol()) { MSIndexedEvent& aIndexedEvent=(MSIndexedEvent&)aEvent_; const MSIndexVector& aIndexVector=aIndexedEvent.index(); if (aIndexVector.length()==0) updateData(); else { const MSStringVector& aStringVector=stringVector(); unsigned currentCount(itemCount()); if (aStringVector.length()!=currentCount) updateData(); else { MSMenuItem *pMenuItem; for (unsigned i=0;i<aIndexVector.length();i++) { pMenuItem=menuItem(aIndexVector(i)); if (pMenuItem!=0) pMenuItem->label(aStringVector(aIndexVector(i))); } } } } else updateData(); }
void wxCrafterTab::OnItemMenu(wxTreeEvent& event) { m_treeCtrl->SelectItem( event.GetItem() ); wxMenu menu; wxMenuItem *menuItem(NULL); menuItem = new wxMenuItem(&menu, ID_MENU_NEW_FRAME, _("New wxFrame..."), _("New wxFrame..."), wxITEM_NORMAL); menuItem->SetBitmap(wxXmlResource::Get()->LoadBitmap(wxT("wxframe"))); menu.Append(menuItem); menuItem = new wxMenuItem(&menu, ID_MENU_NEW_DIALOG, _("New wxDialog..."), _("New wxDialog..."), wxITEM_NORMAL); menuItem->SetBitmap(wxXmlResource::Get()->LoadBitmap(wxT("wxdialog"))); menu.Append(menuItem); menuItem = new wxMenuItem(&menu, ID_MENU_NEW_PANEL, _("New wxPanel..."), _("New wxPanel..."), wxITEM_NORMAL); menuItem->SetBitmap(wxXmlResource::Get()->LoadBitmap(wxT("wxpanel"))); menu.Append(menuItem); menuItem = new wxMenuItem(&menu, ID_MENU_NEW_WIZARD, _("New wxWizard..."), _("New wxWizard..."), wxITEM_NORMAL); menuItem->SetBitmap(wxXmlResource::Get()->LoadBitmap(wxT("wxwizard"))); menu.Append(menuItem); menu.AppendSeparator(); menuItem = new wxMenuItem(&menu, ID_MENU_NEW_POPUPWINDOW, _("New wxPopupWindow..."), _("New wxPopupWindow..."), wxITEM_NORMAL); menuItem->SetBitmap(wxXmlResource::Get()->LoadBitmap(wxT("wxpopupwindow"))); menu.Append(menuItem); menuItem = new wxMenuItem(&menu, ID_MENU_NEW_IMGLIST, _("New wxImageList..."), _("New wxImageList..."), wxITEM_NORMAL); menuItem->SetBitmap(wxXmlResource::Get()->LoadBitmap(wxT("wximglist"))); menu.Append(menuItem); m_treeCtrl->PopupMenu( &menu ); }
void MSPulldownMenu::right(void) { MSMenuItem *ni, *mi=menuItem(selectedItem()); if (mi!=0&&mi->cascade()==MSTrue) { mi->arm(); mi->grab(); } else if ((ni=nextRightItem())!=0&&(mi==0||(ni!=mi&&ni->item()>mi->item()))) { undrawSelectedItem(); selectedItem(ni->item()); drawSelectedItem(); if (ni->cascade()==MSTrue) { ni->arm(); ni->grab(); } } else if (item()!=0) { item()->menu()->grabAndSelect(); item()->menu()->right(); } }
static bool populateContextMenuItems(v8::Isolate* isolate, const v8::Local<v8::Array>& itemArray, ContextMenu& menu) { v8::Local<v8::Context> context = isolate->GetCurrentContext(); for (size_t i = 0; i < itemArray->Length(); ++i) { v8::Local<v8::Object> item = itemArray->Get(context, i).ToLocalChecked().As<v8::Object>(); v8::Local<v8::Value> type; v8::Local<v8::Value> id; v8::Local<v8::Value> label; v8::Local<v8::Value> enabled; v8::Local<v8::Value> checked; v8::Local<v8::Value> subItems; if (!item->Get(context, v8AtomicString(isolate, "type")).ToLocal(&type) || !item->Get(context, v8AtomicString(isolate, "id")).ToLocal(&id) || !item->Get(context, v8AtomicString(isolate, "label")).ToLocal(&label) || !item->Get(context, v8AtomicString(isolate, "enabled")) .ToLocal(&enabled) || !item->Get(context, v8AtomicString(isolate, "checked")) .ToLocal(&checked) || !item->Get(context, v8AtomicString(isolate, "subItems")) .ToLocal(&subItems)) return false; if (!type->IsString()) continue; String typeString = toCoreStringWithNullCheck(type.As<v8::String>()); if (typeString == "separator") { ContextMenuItem item(ContextMenuItem( SeparatorType, ContextMenuItemCustomTagNoAction, String(), String())); menu.appendItem(item); } else if (typeString == "subMenu" && subItems->IsArray()) { ContextMenu subMenu; v8::Local<v8::Array> subItemsArray = v8::Local<v8::Array>::Cast(subItems); if (!populateContextMenuItems(isolate, subItemsArray, subMenu)) return false; TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, labelString, label, false); ContextMenuItem item(SubmenuType, ContextMenuItemCustomTagNoAction, labelString, String(), &subMenu); menu.appendItem(item); } else { int32_t int32Id; if (!v8Call(id->Int32Value(context), int32Id)) return false; ContextMenuAction typedId = static_cast<ContextMenuAction>( ContextMenuItemBaseCustomTag + int32Id); TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, labelString, label, false); ContextMenuItem menuItem( (typeString == "checkbox" ? CheckableActionType : ActionType), typedId, labelString, String()); if (checked->IsBoolean()) menuItem.setChecked(checked.As<v8::Boolean>()->Value()); if (enabled->IsBoolean()) menuItem.setEnabled(enabled.As<v8::Boolean>()->Value()); menu.appendItem(menuItem); } } return true; }
QAction* toTool::getAction(void) { if (toolAction) return toolAction; toolAction = new QAction(toMainWindow::lookup()); if (toolbarImage()) toolAction->setIcon(QIcon(QPixmap(pictureXPM()))); if (menuItem()) toolAction->setText(menuItem()); if (toolbarTip()) toolAction->setToolTip(toolbarTip()); connect(toolAction, SIGNAL(triggered()), this, SLOT(createWindow())); return toolAction; }
// TODO: Move this to a new test file!!! Doesn't belong here!! TEST(LoadoutTest, TestTenthsCounter) { F32 val = 4.3f; FloatCounterMenuItem menuItem("Test", val, 0.1f, 2.1f, 40.5f, 1, "what", "ever", "man"); EXPECT_EQ("4.3", menuItem.getValue()); // 4.3 EXPECT_FLOAT_EQ(val, Zap::stof(menuItem.getValue())); }
void MemCheckOutputView::OnContextMenu(wxDataViewEvent& event) { // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::OnContextMenu()")); if(m_currentPageIsEmptyView) return; bool unmarked, marked; GetStatusOfErrors(unmarked, marked); const wxDataViewItem& dataItem = event.GetItem(); wxMenuItem* menuItem(NULL); wxMenu menu; menuItem = menu.Append(XRCID("memcheck_jump_to_location"), wxT("Jump to location")); menuItem->Enable(dataItem.IsOk() && !m_dataViewCtrlErrorsModel->IsContainer(dataItem)); menu.AppendSeparator(); menuItem = menu.Append(XRCID("memcheck_mark_all_errors"), "Mark all"); menuItem->Enable(unmarked); menuItem = menu.Append(XRCID("memcheck_unmark_all_errors"), wxT("Unmark all")); menuItem->Enable(marked); menu.AppendSeparator(); menuItem = menu.Append(XRCID("memcheck_suppress_error"), wxT("Suppress this error")); menuItem->Enable(dataItem.IsOk() && m_choiceSuppFile->GetSelection() != wxNOT_FOUND); menuItem = menu.Append(XRCID("memcheck_suppress_marked_errors"), wxT("Suppress all marked errors")); menuItem->Enable(marked && m_choiceSuppFile->GetSelection() != wxNOT_FOUND); menu.AppendSeparator(); menuItem = menu.Append(XRCID("memcheck_row_to_clip"), wxT("Copy line as string to clipboard")); menuItem->Enable(dataItem.IsOk()); menuItem = menu.Append(XRCID("memcheck_error_to_clip"), wxT("Copy error as string to clipboard")); menuItem->Enable(dataItem.IsOk()); menuItem = menu.Append(XRCID("memcheck_marked_errors_to_clip"), wxT("Copy marked errors to clipboard")); menuItem->Enable(marked); menu.Connect(XRCID("memcheck_jump_to_location"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemCheckOutputView::OnJumpToLocation), new wxDataViewEvent(event), (wxEvtHandler*)this); menu.Connect(XRCID("memcheck_mark_all_errors"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemCheckOutputView::OnMarkAllErrors), new wxDataViewEvent(event), (wxEvtHandler*)this); menu.Connect(XRCID("memcheck_unmark_all_errors"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemCheckOutputView::OnUnmarkAllErrors), new wxDataViewEvent(event), (wxEvtHandler*)this); menu.Connect(XRCID("memcheck_suppress_error"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemCheckOutputView::OnSuppressError), new wxDataViewEvent(event), (wxEvtHandler*)this); menu.Connect(XRCID("memcheck_suppress_marked_errors"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemCheckOutputView::OnSuppressMarkedErrors), new wxDataViewEvent(event), (wxEvtHandler*)this); menu.Connect(XRCID("memcheck_row_to_clip"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemCheckOutputView::OnRowToClip), new wxDataViewEvent(event), (wxEvtHandler*)this); menu.Connect(XRCID("memcheck_error_to_clip"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemCheckOutputView::OnErrorToClip), new wxDataViewEvent(event), (wxEvtHandler*)this); menu.Connect(XRCID("memcheck_marked_errors_to_clip"), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MemCheckOutputView::OnMarkedErrorsToClip), new wxDataViewEvent(event), (wxEvtHandler*)this); m_dataViewCtrlErrors->PopupMenu(&menu); }
void ClientAgent::SetEditStates(BMenu* menu, bool targetonly) { if (menu != NULL) { if (targetonly) { menu->SetTargetForItems(fInput->TextView()); return; } BMenuItem* menuItem(menu->FindItem(S_CW_EDIT_CUT)); int32 start(0), finish(0); fInput->TextView()->GetSelection(&start, &finish); if (start == finish) { menuItem->SetEnabled(false); } else { menuItem->SetEnabled(true); menuItem->SetTarget(fInput->TextView()); } menuItem = menu->FindItem(S_CW_EDIT_COPY); if (start == finish) { BString string; // check text display fText->GetSelectionText(string); if (string.Length() > 0) { menuItem->SetTarget(fInput->TextView()); menuItem->SetEnabled(true); } else { menuItem->SetEnabled(false); } } else { menuItem->SetTarget(fInput->TextView()); menuItem->SetEnabled(true); } menuItem = menu->FindItem(S_CW_EDIT_PASTE); menuItem->SetTarget(fInput->TextView()); BClipboard clipboard("system"); BMessage* clip((BMessage*)NULL); if (clipboard.Lock()) { if ((clip = clipboard.Data())) { if (clip->HasData("text/plain", B_MIME_TYPE)) menuItem->SetEnabled(true); else menuItem->SetEnabled(false); } clipboard.Unlock(); } menuItem = menu->FindItem(S_CW_EDIT_SELECT_ALL); if (fInput->TextView()->TextLength() == 0) menuItem->SetTarget(fText); else menuItem->SetTarget(fInput->TextView()); } }
void MSOptionPopupMenu::popup(MSBoolean warp_,unsigned long eventTime_) { if (warp_==MSTrue) { selectedItem(optionMenu()->selectedItem()); MSMenuItem *item=menuItem(selectedItem()); if (item!=0) XWarpPointer(display(),None,window(),0,0,0,0, item->x()+item->width()/2,item->y()+item->height()/2); } show(); lastShowTime(eventTime_); }
/*! Returns the PDU form of this envelope, encoded as described in 3GPP TS 11.14. \sa fromPdu() */ QByteArray QSimEnvelope::toPdu() const { QByteArray data; // Output the event list before the device identities. if ( d->type == QSimEnvelope::EventDownload ) { data += (char)0x99; data += (char)0x01; data += (char)(d->event); } // Add the device identity section (ME/Keypad/... to SIM). // According to 3GPP TS 51.010-4, the tag should be 0x02 for // MO-SMS control by SIM. if ( d->type == QSimEnvelope::MOSMSControl ) data += (char)0x02; else data += (char)0x82; data += (char)0x02; data += (char)sourceDevice(); data += (char)destinationDevice(); // Add parameters specific to this type of envelope. switch ( type() ) { case MenuSelection: { data += (char)0x90; data += (char)0x01; data += (char)menuItem(); if ( requestHelp() ) { data += (char)0x15; data += (char)0x00; } } break; default: break; } // Add any extension data that is specified. data += extensionData(); // Add the outermost envelope tag layer and return. QByteArray env; env += (char)type(); writeBerLength( env, data.size() ); env += data; return env; }
void GfxMenu::select() { GfxMenuItem *mi = menuItem()->item(list()->current()); if(mi->count()) { GfxCanvasList *l = listForItem(mi, mapFrom(list()->currentItem(), static_cast<MenuListItem *>(list()->currentItem())->rect().topLeft())); tl.move(list()->x(), -240, 300); list()->setActive(false); tl.move(l->x(), 0, 300); _listStack << l; list()->setActive(true); _miStack << mi; } else { itemactivated(); } }
void MSPulldownMenu::left(void) { MSMenuItem *ni,*mi=menuItem(selectedItem()); if ((ni=nextLeftItem())!=0&&(mi==0||(ni!=mi&&ni->item()<mi->item()))) { undrawSelectedItem(); selectedItem(ni->item()); drawSelectedItem(); } else if (item()!=0) { item()->menu()->grabAndSelect(); item()->menu()->left(); } }
void MSOptionPopupMenu::update(const MSIndexVector& index_) { if (MSView::model()!=0) { if (index_.length()==0) { if (optionsModel().length()==itemCount()) { MSMenuItem *mi; int i,n=itemCount(); for(i=0;i<n;i++) { mi=(MSMenuItem *)itemVector()(i); mi->label(optionsModel()(i)); } computeSize(); optionMenu()->setSelectedItem(0); optionMenu()->computeSize(); } else rebuildMenu(); } else { MSIndexVector iv(index_); iv.sortUp(); if (iv(0)==itemCount()) { for (unsigned i=0,j=itemCount();i<iv.length();i++,j++) { MSMenuItem *pMenuItem=new MSMenuItem(this,optionsModel()(j),0,j); setItem(pMenuItem,j); } } else { for (unsigned i=0;i<iv.length();i++) { unsigned index=iv(i); MSMenuItem *mi=menuItem(index); if (mi!=0) mi->label(optionsModel()(index)); } } } computeSize(); optionMenu()->computeSize(); } }
static bool populateContextMenuItems(v8::Local<v8::Array>& itemArray, ContextMenu& menu, v8::Isolate* isolate) { for (size_t i = 0; i < itemArray->Length(); ++i) { v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(itemArray->Get(i)); v8::Local<v8::Value> type = item->Get(v8AtomicString(isolate, "type")); v8::Local<v8::Value> id = item->Get(v8AtomicString(isolate, "id")); v8::Local<v8::Value> label = item->Get(v8AtomicString(isolate, "label")); v8::Local<v8::Value> enabled = item->Get(v8AtomicString(isolate, "enabled")); v8::Local<v8::Value> checked = item->Get(v8AtomicString(isolate, "checked")); v8::Local<v8::Value> subItems = item->Get(v8AtomicString(isolate, "subItems")); if (!type->IsString()) continue; String typeString = toCoreStringWithNullCheck(type.As<v8::String>()); if (typeString == "separator") { ContextMenuItem item(ContextMenuItem(SeparatorType, ContextMenuItemCustomTagNoAction, String())); menu.appendItem(item); } else if (typeString == "subMenu" && subItems->IsArray()) { ContextMenu subMenu; v8::Local<v8::Array> subItemsArray = v8::Local<v8::Array>::Cast(subItems); if (!populateContextMenuItems(subItemsArray, subMenu, isolate)) return false; V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithNullCheck>, labelString, label, false); ContextMenuItem item(SubmenuType, ContextMenuItemCustomTagNoAction, labelString, &subMenu); menu.appendItem(item); } else { ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id->ToInt32()->Value()); V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithNullCheck>, labelString, label, false); ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, labelString); if (checked->IsBoolean()) menuItem.setChecked(checked->ToBoolean()->Value()); if (enabled->IsBoolean()) menuItem.setEnabled(enabled->ToBoolean()->Value()); menu.appendItem(menuItem); } } return true; }
static void populateContextMenuItems(v8::Local<v8::Array>& itemArray, ContextMenu& menu) { for (size_t i = 0; i < itemArray->Length(); ++i) { v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(itemArray->Get(i)); v8::Local<v8::Value> type = item->Get(v8::String::New("type")); v8::Local<v8::Value> id = item->Get(v8::String::New("id")); v8::Local<v8::Value> label = item->Get(v8::String::New("label")); v8::Local<v8::Value> enabled = item->Get(v8::String::New("enabled")); v8::Local<v8::Value> checked = item->Get(v8::String::New("checked")); v8::Local<v8::Value> subItems = item->Get(v8::String::New("subItems")); if (!type->IsString()) continue; String typeString = toWebCoreStringWithNullCheck(type); if (typeString == "separator") { ContextMenuItem item(ContextMenuItem(SeparatorType, ContextMenuItemCustomTagNoAction, String())); menu.appendItem(item); } else if (typeString == "subMenu" && subItems->IsArray()) { ContextMenu subMenu; v8::Local<v8::Array> subItemsArray = v8::Local<v8::Array>::Cast(subItems); populateContextMenuItems(subItemsArray, subMenu); ContextMenuItem item(SubmenuType, ContextMenuItemCustomTagNoAction, toWebCoreStringWithNullCheck(label), &subMenu); menu.appendItem(item); } else { ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id->ToInt32()->Value()); ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, toWebCoreStringWithNullCheck(label)); if (checked->IsBoolean()) menuItem.setChecked(checked->ToBoolean()->Value()); if (enabled->IsBoolean()) menuItem.setEnabled(enabled->ToBoolean()->Value()); menu.appendItem(menuItem); } } }
int MSOptionPopupMenu::menuItemXOffset(int item_) { MSMenuItem *mi=menuItem(item_); return (mi!=0)?mi->x():0; }
void PancakeHouseMenu::addItem(const string& name, const string& description, bool vegetarian, double price) { shared_ptr<MenuItem> menuItem(new MenuItem(name, description, vegetarian, price)); menuItems.push_back(menuItem); }
void GfxMenu::itemactivated() { emit menuItem()->item(list()->current())->activated(); }
void UIMenu::addOption(char *c, unsigned long code) { _options.push_back( menuItem( c, code ) ); reshape(); }
void MenuServices::run(const std::vector<std::string> &cmd, std::stack<std::unique_ptr<MenuBase>> &menuStack) { if (cmd.size() > 0) { if (cmd[0] == "find") { std::vector<std::string> knownServices = { // services std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_BRIGHTNESS, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_POWER_SWITCH, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_CONNECTION_MANAGER, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_AV_TRANSPORT, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_CONTENT_DIRECTORY, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_RENDERING_CONTROL, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_SCHEDULED_RECORDING, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_WAN_IF_CONFIG, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_LAYER3_FORWARDING, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_WAN_CABLE_LINK_CONFIG, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_WAN_DSL_LINK_CONFIG, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_WAN_ETHERNET_CONFIG, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_WAN_POTS_LINK_CONFIG, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_WAN_IP_CONNECTION, std::string(OC_RSRVD_WELL_KNOWN_URI) + "?rt=" + UPNP_OIC_TYPE_LAN_HOST_CONFIG }; for (auto service : knownServices) { OC::OCPlatform::findResource("", service, CT_DEFAULT, onFindResourceCb); } } else if (cmd[0] == "list") { if (!m_avTransport.empty()) { std::cout << "AV Transport Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_avTransport) { printResourceCompact(r); std::cout << std::endl; } } if (!m_brightness.empty()) { std::cout << "Brightness Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_brightness) { printResourceCompact(r); std::cout << std::endl; } } if (!m_binarySwitch.empty()) { std::cout << "Binary Switch Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_binarySwitch) { printResourceCompact(r); std::cout << std::endl; } } if (!m_connectionManager.empty()) { std::cout << "Connection Manager Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_connectionManager) { printResourceCompact(r); std::cout << std::endl; } } if (!m_contentDirectory.empty()) { std::cout << "Content Dirctory Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_contentDirectory) { printResourceCompact(r); std::cout << std::endl; } } if (!m_layer3Forwarding.empty()) { std::cout << "Layer 3 Forwarding Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_layer3Forwarding) { printResourceCompact(r); std::cout << std::endl; } } if (!m_renderingControl.empty()) { std::cout << "Rendering Control Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_renderingControl) { printResourceCompact(r); std::cout << std::endl; } } if (!m_scheduledRecording.empty()) { std::cout << "Scheduled Recording Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_scheduledRecording) { printResourceCompact(r); std::cout << std::endl; } } if (!m_wanIfConfig.empty()) { std::cout << "WAN IF Config Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_wanIfConfig) { printResourceCompact(r); std::cout << std::endl; } } if (!m_wanCableLinkConfig.empty()) { std::cout << "WAN Cable Link Config Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_wanCableLinkConfig) { printResourceCompact(r); std::cout << std::endl; } } if (!m_wanDSLLinkConfig.empty()) { std::cout << "WAN DSL Link Config Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_wanDSLLinkConfig) { printResourceCompact(r); std::cout << std::endl; } } if (!m_wanEthernetConfig.empty()) { std::cout << "WAN Ethernet Config Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_wanEthernetConfig) { printResourceCompact(r); std::cout << std::endl; } } if (!m_wanPotsLinkConfig.empty()) { std::cout << "WAN POTS Config Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_wanPotsLinkConfig) { printResourceCompact(r); std::cout << std::endl; } } if (!m_wanIPConnection.empty()) { std::cout << "WAN IP Connection Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_wanIPConnection) { printResourceCompact(r); std::cout << std::endl; } } if (!m_lanHostConfig.empty()) { std::cout << "LAN Host Config Service(s) found:" << std::endl; std::cout << "---------------------------------------------" << std::endl; for ( auto r : m_lanHostConfig) { printResourceCompact(r); std::cout << std::endl; } } } else if ("av" == cmd[0]) { std::unique_ptr<MenuAVTransport> menuItem(new MenuAVTransport); menuItem->init(m_avTransport); menuStack.push(std::move(menuItem)); } else if ("brightness" == cmd[0]) { std::unique_ptr<MenuBrightness> menuItem(new MenuBrightness); menuItem->init(m_brightness); menuStack.push(std::move(menuItem)); } else if ("switch" == cmd[0]) { std::unique_ptr<MenuBinarySwitch> menuItem(new MenuBinarySwitch); menuItem->init(m_binarySwitch); menuStack.push(std::move(menuItem)); } else if ("connection" == cmd[0]) { std::unique_ptr<MenuConnectionManager> menuItem(new MenuConnectionManager); menuItem->init(m_connectionManager); menuStack.push(std::move(menuItem)); } else if ("content" == cmd[0]) { std::unique_ptr<MenuContentDirectory> menuItem(new MenuContentDirectory); menuItem->init(m_contentDirectory); menuStack.push(std::move(menuItem)); } else if ("layer3" == cmd[0]) { std::unique_ptr<MenuLayer3Forwarding> menuItem(new MenuLayer3Forwarding); menuItem->init(m_layer3Forwarding); menuStack.push(std::move(menuItem)); } else if ("rendering" == cmd[0]) { std::unique_ptr<MenuRenderingControl> menuItem(new MenuRenderingControl); menuItem->init(m_renderingControl); menuStack.push(std::move(menuItem)); } else if ("recording" == cmd[0]) { std::cout << "Scheduled Recording Menu not yet Implemented" << std::endl; } else if ("ifconfig" == cmd[0]) { std::unique_ptr<MenuWANCommonInterface> menuItem(new MenuWANCommonInterface); menuItem->init(m_wanIfConfig); menuStack.push(std::move(menuItem)); } else if ("cableconfig" == cmd[0]) { std::cout << "WAN Cable Link Config Menu not yet Implemented" << std::endl; } else if ("dslconfig" == cmd[0]) { std::cout << "WAN DSL Link Config Menu not yet Implemented" << std::endl; } else if ("netconfig" == cmd[0]) { std::cout << "WAN Ethernet Config Menu not yet Implemented" << std::endl; } else if ("potsconfig" == cmd[0]) { std::cout << "WAN POTS Config Menu not yet Implemented" << std::endl; } else if ("ipconnection" == cmd[0]) { std::unique_ptr<MenuWANIpConnection> menuItem(new MenuWANIpConnection); menuItem->init(m_wanIPConnection); menuStack.push(std::move(menuItem)); } else if ("lanhost" == cmd[0]) { std::unique_ptr<MenuLANHostConfigManagement> menuItem(new MenuLANHostConfigManagement); menuItem->init(m_lanHostConfig); menuStack.push(std::move(menuItem)); } else if ("clear" == cmd[0]) { m_avTransport.clear(); m_binarySwitch.clear(); m_brightness.clear(); m_connectionManager.clear(); m_contentDirectory.clear(); m_layer3Forwarding.clear(); m_renderingControl.clear(); m_scheduledRecording.clear(); m_wanIfConfig.clear(); print(); } else if ("q" == cmd[0]) { m_quit = true; } else if ("b" == cmd[0]) { if (menuStack.size() <= 1) { print(); return; //do nothing } else { menuStack.pop(); menuStack.top()->print(); } } else if ("h" == cmd[0]) { help(); } else { std::cout << "unknown command." << std::endl; print(); } } }