void Inventory::setItem(int index, int id, int quantity, int refine, unsigned char color, bool equipment) { if (index < 0 || index >= static_cast<int>(mSize)) { logger->log("Warning: invalid inventory index: %d", index); return; } if (!mItems[index] && id > 0) { Item *item = new Item(id, quantity, refine, color, equipment); item->setInvIndex(index); mItems[index] = item; mUsed++; distributeSlotsChangedEvent(); } else if (id > 0 && mItems[index]) { mItems[index]->setId(id, color); mItems[index]->setQuantity(quantity); mItems[index]->setRefine(refine); mItems[index]->setEquipment(equipment); } else if (mItems[index]) { removeItemAt(index); } }
void Inventory::setItem(int index, int id, int quantity) { if (index < 0 || index >= mSize) { logger->log("Warning: invalid inventory index: %d", index); return; } if (!mItems[index] && id > 0) { Item *item = new Item(id, quantity); item->setInvIndex(index); mItems[index] = item; mUsed++; distributeSlotsChangedEvent(); } else if (id > 0) { mItems[index]->setId(id); mItems[index]->setQuantity(quantity); } else if (mItems[index]) { removeItemAt(index); } }
void ArrayList::removeItem(int item) { int position; position = searchItem(item) ; if ( position == NULL_VALUE ) return ; //nothing to remove removeItemAt(position) ; }
void QMenuData::removePopup( QPopupMenu *popup ) { int index = 0; QMenuItem *mi = findPopup( popup, &index ); if ( mi ) removeItemAt( index ); }
void Inventory::setItem(int index, int id, int quantity, bool equipment) { if (index < 0 || index >= mSize) { logger->log("Warning: invalid inventory index: %d", index); return; } if (!mItems[index] && id > 0) { Item *item = new Item(id, quantity, equipment); item->setInvIndex(index); mItems[index] = item; mItems[index]->setEquipment(equipment); } else if (id > 0) { mItems[index]->setId(id); mItems[index]->setQuantity(quantity); mItems[index]->setEquipment(equipment); } else if (mItems[index]) { removeItemAt(index); } }
void Inventory::removeItem(int id) { for (unsigned i = 0; i < mSize; i++) { if (mItems[i] && mItems[i]->getId() == id) removeItemAt(i); } }
void Inventory::removeItem(const int id) { for (unsigned i = 0; i < mSize; i++) { const Item *const item = mItems[i]; if ((item != nullptr) && item->mId == id) removeItemAt(i); } }
void StackLayout::doRelayout() { const List<DisplayItem *> &items = getItems(); DisplayItem *inputField = items.getAt(0); int bottom; if (isItemVisible(inputField)) { setItemSize(inputField, getWidth(), font->getLineHeight()); bottom = getHeight() - inputField->getHeight(); setItemPosition(inputField, 0, bottom); } else { bottom = getHeight(); } int i = 0; upperItemNr = 0; while (bottom > 0 && i + firstLevelVisible < stack->getLength()) { upperItemNr++; DisplayItem *item; if (items.getLength() <= upperItemNr) { item = stack->getAt(i + firstLevelVisible)->getDisplayItem(*font); addItem(item); } else { item = items.getAt(upperItemNr); if (item == NULL) { item = stack->getAt(i + firstLevelVisible)->getDisplayItem(*font); setItemAt(upperItemNr, item); } } if (item) { int nw = getNumberWidth(upperItemNr + firstLevelVisible); setItemSize(item, getWidth() - nw, -1); int h = item->getHeight(); if (h < font->getLineHeight()) h = font->getLineHeight(); bottom -= h; int w = item->getWidth(); if (w < getWidth() - nw) setItemPosition(item, getWidth() - w, bottom); else setItemPosition(item, nw, bottom); } else { bottom -= font->getLineHeight(); } i++; } while (items.getLength() > upperItemNr + 1) { removeItemAt(upperItemNr + 1); } while (bottom > 0) { upperItemNr++; bottom -= font->getLineHeight(); } upperItemScanStart = -bottom; }
/** * Add an item to the menu. It will be inserted into the * proper popup menu basing on its type. * * @param cmds new abstract commands * @param numOfCmds number of new abstract commands * @return status of this call */ MidpError CommandManager::setCommands(MidpCommand* cmds, int numOfCmds) { MidpError err = KNI_OK; int i = count()-1; // Remove any popup menu for (; i >= 0; i--) { removeItemAt(0); } // Clear existing popup menu content actionMenu->clear(); goMenu->clear(); helpMenu->clear(); // reset state of menu bar when item is active actItem = -1; // Insert each command to each popup menu basing on its type for (i = 0; i < numOfCmds; i++) { QString text; pcsl_string* short_label = &cmds[i].shortLabel_str; GET_PCSL_STRING_DATA_AND_LENGTH(short_label) { if(PCSL_STRING_PARAMETER_ERROR(short_label)) { REPORT_ERROR(LC_HIGHUI, "out-of-memory error" " in CommandManager::setCommands"); } else { text.setUnicodeCodes(short_label_data, short_label_len); } } RELEASE_PCSL_STRING_DATA_AND_LENGTH if (cmds[i].type == COMMAND_TYPE_HELP) { helpMenu->insertItemTrunc(text, cmds[i].id); } else if (cmds[i].type == COMMAND_TYPE_BACK || cmds[i].type == COMMAND_TYPE_OK || cmds[i].type == COMMAND_TYPE_CANCEL || cmds[i].type == COMMAND_TYPE_STOP) { goMenu->insertItemTrunc(text, cmds[i].id); } else { actionMenu->insertItemTrunc(text, cmds[i].id); } } // Only add non-empty popup menus if (goMenu->count() > 0) { insertItem(GO_MENUITEM_TEXT, goMenu, -1, 0); } if (actionMenu->count() > 0) { insertItem(ACTION_MENUITEM_TEXT, actionMenu, -1, 0); } if (helpMenu->count() > 0) { insertItem(HELP_MENUITEM_TEXT, helpMenu, -1, 0); } return err; }
void Inventory::setItem(const int index, const int id, const ItemTypeT type, const int quantity, const uint8_t refine, const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, const Equipm equipment, const Equipped equipped) { if (index < 0 || index >= CAST_S32(mSize)) { reportAlways("Warning: invalid inventory index: %d", index); return; } Item *const item1 = mItems[index]; if ((item1 == nullptr) && id > 0) { Item *const item = new Item(id, type, quantity, refine, color, identified, damaged, favorite, equipment, equipped); item->setInvIndex(index); mItems[index] = item; mUsed++; distributeSlotsChangedEvent(); } else if (id > 0 && (item1 != nullptr)) { item1->setId(id, color); item1->setQuantity(quantity); item1->setRefine(refine); item1->setEquipment(equipment); item1->setIdentified(identified); item1->setDamaged(damaged); item1->setFavorite(favorite); } else if (item1 != nullptr) { removeItemAt(index); } }
void Inventory::setItem(const int index, const int id, const int type, const int quantity, const uint8_t refine, const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, const Equipm equipment, const Equipped equipped) { if (index < 0 || index >= static_cast<int>(mSize)) { logger->log("Warning: invalid inventory index: %d", index); return; } Item *const item1 = mItems[index]; if (!item1 && id > 0) { Item *const item = new Item(id, type, quantity, refine, color, identified, damaged, favorite, equipment, equipped); item->setInvIndex(index); mItems[index] = item; mUsed++; distributeSlotsChangedEvent(); } else if (id > 0 && item1) { item1->setId(id, color); item1->setQuantity(quantity); item1->setRefine(refine); item1->setEquipment(equipment); item1->setIdentified(identified); item1->setDamaged(damaged); item1->setFavorite(favorite); } else if (item1) { removeItemAt(index); } }
void PanelKMenu::updateRecent() { if (!RecentlyLaunchedApps::self().m_bNeedToUpdate) { return; } RecentlyLaunchedApps::self().m_bNeedToUpdate = false; int nId = serviceMenuEndId() + 1; // remove previous items if (RecentlyLaunchedApps::self().m_nNumMenuItems > 0) { // -1 --> menu title int i = KickerSettings::showMenuTitles() ? -1 : 0; for (; i < RecentlyLaunchedApps::self().m_nNumMenuItems; i++) { removeItem(nId + i); entryMap_.remove(nId + i); } RecentlyLaunchedApps::self().m_nNumMenuItems = 0; if (!KickerSettings::showMenuTitles()) { removeItemAt(0); } } // insert new items QStringList RecentApps; RecentlyLaunchedApps::self().getRecentApps(RecentApps); if (RecentApps.count() > 0) { bool bNeedSeparator = KickerSettings::showMenuTitles(); for (QList<QString>::iterator it = RecentApps.fromLast(); /*nop*/; --it) { KService::Ptr s = KService::serviceByDesktopPath(*it); if (!s) { RecentlyLaunchedApps::self().removeItem(*it); } else { if (bNeedSeparator) { bNeedSeparator = false; addSeparator(); /* FIXME: no more titles! int id = insertTitle( RecentlyLaunchedApps::self().caption(), nId - 1, 0); setItemEnabled( id, false ); */ } insertMenuItem(s, nId++, KickerSettings::showMenuTitles() ? 1 : 0); RecentlyLaunchedApps::self().m_nNumMenuItems++; } if (it == RecentApps.begin()) break; } if (!KickerSettings::showMenuTitles()) { insertSeparator(RecentlyLaunchedApps::self().m_nNumMenuItems); } } }
void MenuControl::_removeItemAt(size_t _index) { removeItemAt(_index); _updateSizeForEmpty(); }
void MenuControl::removeItem(MenuItem* _item) { removeItemAt(getItemIndex(_item)); }
//! Remove item void removeItem(ItemType _item) { removeItemAt(getItemIndex(_item)); }
void ListBox::_removeItemAt(size_t _index) { removeItemAt(_index); }
void Inventory::clear() { for (int i = 0; i < mSize; i++) removeItemAt(i); }
void PanelView::removeItem(PanelBase * _item) { size_t index = findItem(_item); MYGUI_ASSERT(index != MyGUI::ITEM_NONE, "item is not found"); removeItemAt(index); }
void ComboBox::_removeItemAt(size_t _index) { removeItemAt(_index); }
WMenuItem * WEXPORT WPopupMenu::removeItem( WMenuItem *item ) { /*************************************************************/ return( removeItemAt( _children.indexOfSame( item ) ) ); }
void Inventory::clear() { for (unsigned i = 0; i < mSize; i++) removeItemAt(i); }
void TabControl::removeItem(TabItem* _item) { removeItemAt(getItemIndex(_item)); }
void TabControl::_removeItemAt(size_t _index) { removeItemAt(_index); }