void CPasteFunctionDialog::FillList() { int i, grp; BListItem *item; grp = fMenu->IndexOf(fMenu->FindMarked()) - 1; item = fList->LastItem(); while (item) { fList->RemoveItem(item); delete item; item = fList->LastItem(); } for (i = 0; i < gFuncCount; i++) if (grp == -1 || gFuncArrayByName[i].groupNr == grp) { const char *s = gFuncPasteStrings[gFuncArrayByName[i].funcNr]; char *sp = strchr(s, ','); while (sp) { *sp = gListSeparator; sp = strchr(sp + 1, ','); } fList->AddItem(new BStringItem(s)); } UpdateDesc(); } /* CPasteFunctionDialog::FillList */
bool CLuaCFGMenu::CoreHandleEvent(NNCurses::CWidget *emitter, int event) { if (CLuaWidget::CoreHandleEvent(emitter, event)) return true; if (m_pMenu->Empty()) return false; if (emitter == m_pMenu) { if (event == EVENT_DATACHANGED) { UpdateDesc(); return true; } else if (event == EVENT_CALLBACK) { SEntry *entry = GetCurEntry(); std::string item = m_pMenu->Value(); if (entry) { switch (entry->type) { case TYPE_STRING: { std::string ret = NNCurses::InputBox(CreateText(GetTranslation("Please enter a new value for %s"), GetTranslation(item.c_str())), entry->val); if (!ret.empty()) entry->val = ret; break; } case TYPE_DIR: { std::string ret = NNCurses::DirectoryBox(CreateText(GetTranslation("Please choose a new value for %s"), GetTranslation(item.c_str())), entry->val); if (!ret.empty()) entry->val = ret; break; } case TYPE_LIST: case TYPE_BOOL: ShowChoiceMenu(); break; } LuaDataChanged(); return true; } } } return false; }
void CPasteFunctionDialog::MessageReceived(BMessage *inMessage) { switch (inMessage->what) { case msg_MenuChanged: FillList(); break; case msg_FuncChanged: UpdateDesc(); break; default: CDialog::MessageReceived(inMessage); } } /* CPasteFunctionDialog::MessageReceived */
void CLuaCFGMenu::CoreUpdateLanguage() { for (TVarType::iterator it=GetVariables().begin(); it!=GetVariables().end(); it++) m_pMenu->SetName(it->first, GetTranslation(it->first)); UpdateDesc(); }