本文整理汇总了C++中LLFolderViewItem::getViewModelItem方法的典型用法代码示例。如果您正苦于以下问题:C++ LLFolderViewItem::getViewModelItem方法的具体用法?C++ LLFolderViewItem::getViewModelItem怎么用?C++ LLFolderViewItem::getViewModelItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLFolderViewItem
的用法示例。
在下文中一共展示了LLFolderViewItem::getViewModelItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canShareSelectedItems
// static
bool LLAvatarActions::canShareSelectedItems(LLInventoryPanel* inv_panel /* = NULL*/)
{
using namespace action_give_inventory;
if (!inv_panel)
{
LLInventoryPanel* active_panel = get_active_inventory_panel();
if (!active_panel) return false;
inv_panel = active_panel;
}
// check selection in the panel
LLFolderView* root_folder = inv_panel->getRootFolder();
if (!root_folder)
{
return false;
}
const std::set<LLFolderViewItem*> inventory_selected = root_folder->getSelectionList();
if (inventory_selected.empty()) return false; // nothing selected
bool can_share = true;
std::set<LLFolderViewItem*>::const_iterator it = inventory_selected.begin();
const std::set<LLFolderViewItem*>::const_iterator it_end = inventory_selected.end();
for (; it != it_end; ++it)
{
LLViewerInventoryCategory* inv_cat = gInventory.getCategory(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
// any category can be offered.
if (inv_cat)
{
continue;
}
// check if inventory item can be given
LLFolderViewItem* item = *it;
if (!item) return false;
LLInvFVBridge* bridge = dynamic_cast<LLInvFVBridge*>(item->getViewModelItem());
if (bridge && bridge->canShare())
{
continue;
}
// there are neither item nor category in inventory
can_share = false;
break;
}
return can_share;
}
示例2: onMenuVisibilityChange
void LLLandmarksPanel::onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param)
{
bool new_visibility = param["visibility"].asBoolean();
// We don't have to update items visibility if the menu is hiding.
if (!new_visibility) return;
BOOL are_any_items_in_trash = FALSE;
BOOL are_all_items_in_trash = TRUE;
LLFolderView* root_folder_view = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : NULL;
if(root_folder_view)
{
const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
std::set<LLFolderViewItem*> selected_items = root_folder_view->getSelectionList();
// Iterate through selected items to find out if any of these items are in Trash
// or all the items are in Trash category.
for (std::set<LLFolderViewItem*>::const_iterator iter = selected_items.begin(); iter != selected_items.end(); ++iter)
{
LLFolderViewItem* item = *iter;
// If no item is found it might be a folder id.
if (!item) continue;
LLFolderViewModelItemInventory* listenerp = static_cast<LLFolderViewModelItemInventory*>(item->getViewModelItem());
if(!listenerp) continue;
// Trash category itself should not be included because it can't be
// actually restored from trash.
are_all_items_in_trash &= listenerp->isItemInTrash() && listenerp->getUUID() != trash_id;
// If there are any selected items in Trash including the Trash category itself
// we show "Restore Item" in context menu and hide other irrelevant items.
are_any_items_in_trash |= listenerp->isItemInTrash();
}
}
// Display "Restore Item" menu entry if at least one of the selected items
// is in Trash or the Trash category itself is among selected items.
// Hide other menu entries in this case.
// Enable this menu entry only if all selected items are in the Trash category.
toggle_restore_menu((LLMenuGL*)ctrl, are_any_items_in_trash, are_all_items_in_trash);
}