本文整理汇总了C++中LLFolderViewItem类的典型用法代码示例。如果您正苦于以下问题:C++ LLFolderViewItem类的具体用法?C++ LLFolderViewItem怎么用?C++ LLFolderViewItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLFolderViewItem类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectItemInAccordionTab
LLFolderViewItem* LLLandmarksPanel::selectItemInAccordionTab(LLPlacesInventoryPanel* inventory_list,
const std::string& tab_name,
const LLUUID& obj_id,
BOOL take_keyboard_focus) const
{
if (!inventory_list)
return NULL;
LLFolderView* root = inventory_list->getRootFolder();
LLFolderViewItem* item = inventory_list->getItemByID(obj_id);
if (!item)
return NULL;
LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(tab_name);
if (!tab->isExpanded())
{
tab->changeOpenClose(false);
}
root->setSelection(item, FALSE, take_keyboard_focus);
LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion");
LLRect screen_rc;
localRectToScreen(item->getRect(), &screen_rc);
accordion->notifyParent(LLSD().with("scrollToShowRect", screen_rc.getValue()));
return item;
}
示例2: setSelection
void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus)
{
LLFolderViewItem* itemp = mFolders->getItemByID(obj_id);
if(itemp && itemp->getListener())
{
itemp->getListener()->arrangeAndSet(itemp,
TRUE,
take_keyboard_focus);
}
}
示例3: getCurSelectedViewModelItem
void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
{
LLFolderViewModelItemInventory* view_model = getCurSelectedViewModelItem();
LLFolderViewItem* item = getCurSelectedItem();
std::string command_name = userdata.asString();
if("add_landmark" == command_name)
{
LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
if(landmark)
{
LLNotificationsUtil::add("LandmarkAlreadyExists");
}
else
{
LLFloaterSidePanelContainer::showPanel("places", LLSD().with("type", "create_landmark"));
}
}
else if ("category" == command_name)
{
if (item && mCurrentSelectedList == mLandmarksInventoryPanel)
{
LLFolderViewModelItem* folder_bridge = NULL;
if (view_model->getInventoryType()
== LLInventoryType::IT_LANDMARK)
{
// for a landmark get parent folder bridge
folder_bridge = item->getParentFolder()->getViewModelItem();
}
else if (view_model->getInventoryType()
== LLInventoryType::IT_CATEGORY)
{
// for a folder get its own bridge
folder_bridge = view_model;
}
menu_create_inventory_item(mCurrentSelectedList,
dynamic_cast<LLFolderBridge*> (folder_bridge), LLSD(
"category"), gInventory.findCategoryUUIDForType(
LLFolderType::FT_LANDMARK));
}
else
{
//in case My Landmarks tab is completely empty (thus cannot be determined as being selected)
menu_create_inventory_item(mLandmarksInventoryPanel, NULL, LLSD("category"),
gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK));
if (mMyLandmarksAccordionTab)
{
mMyLandmarksAccordionTab->changeOpenClose(false);
}
}
}
}
示例4: 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<LLUUID> selected_uuids = 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<LLUUID>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
{
LLFolderViewItem* item = root_folder_view->getItemByID(*iter);
// If no item is found it might be a folder id.
if (!item)
{
item = root_folder_view->getFolderByID(*iter);
}
if (!item) continue;
LLFolderViewEventListener* listenerp = item->getListener();
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() && *iter != 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);
}
示例5: setSelection
void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus)
{
LLFolderViewItem* itemp = mFolders->getItemByID(obj_id);
if(itemp && itemp->getListener())
{
itemp->getListener()->arrangeAndSet(itemp, TRUE, take_keyboard_focus);
mSelectThisID.setNull();
return;
}
else
{
// save the desired item to be selected later (if/when ready)
mSelectThisID = obj_id;
}
}
示例6: get_active_inventory_panel
// 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;
}
示例7: if
void LLPanelOutfitEdit::saveListSelection()
{
if(mWearablesListViewPanel->getVisible())
{
std::set<LLUUID> selected_ids = mInventoryItemsPanel->getRootFolder()->getSelectionList();
if(!selected_ids.size()) return;
for (std::set<LLUUID>::const_iterator item_id = selected_ids.begin(); item_id != selected_ids.end(); ++item_id)
{
mWearableItemsList->selectItemByUUID(*item_id, true);
}
mWearableItemsList->scrollToShowFirstSelectedItem();
}
else if(mInventoryItemsPanel->getVisible())
{
std::vector<LLUUID> selected_ids;
mWearableItemsList->getSelectedUUIDs(selected_ids);
if(!selected_ids.size()) return;
mInventoryItemsPanel->clearSelection();
LLFolderView* root = mInventoryItemsPanel->getRootFolder();
if(!root) return;
for(std::vector<LLUUID>::const_iterator item_id = selected_ids.begin(); item_id != selected_ids.end(); ++item_id)
{
LLFolderViewItem* item = root->getItemByID(*item_id);
if (!item) continue;
LLFolderViewFolder* parent = item->getParentFolder();
if(parent)
{
parent->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
}
mInventoryItemsPanel->getRootFolder()->changeSelection(item, TRUE);
}
mInventoryItemsPanel->getRootFolder()->scrollToShowSelection();
}
}
示例8: buildNewViews
LLFolderViewItem* LLInventoryPanel::buildNewViews(const LLUUID& id)
{
LLInventoryObject const* objectp = gInventory.getObject(id);
LLUUID root_id = mFolderRoot.get()->getListener()->getUUID();
LLFolderViewFolder* parent_folder = NULL;
LLFolderViewItem* itemp = NULL;
if (id == root_id)
{
parent_folder = mFolderRoot.get();
}
else if (objectp)
{
const LLUUID &parent_id = objectp->getParentUUID();
parent_folder = (LLFolderViewFolder*)mFolderRoot.get()->getItemByID(parent_id);
if (parent_folder)
{
if (objectp->getType() <= LLAssetType::AT_NONE ||
objectp->getType() >= LLAssetType::AT_COUNT)
{
llwarns << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : "
<< ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
<< llendl;
return NULL;
}
if ((objectp->getType() == LLAssetType::AT_CATEGORY) &&
(objectp->getActualType() != LLAssetType::AT_LINK_FOLDER))
{
LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(objectp->getType(),
objectp->getType(),
LLInventoryType::IT_CATEGORY,
this,
mFolderRoot.get(),
objectp->getUUID());
if (new_listener)
{
LLFolderViewFolder* folderp = createFolderViewFolder(new_listener);
if (folderp)
{
folderp->setItemSortOrder(mFolderRoot.get()->getSortOrder());
}
itemp = folderp;
}
}
else
{
// Build new view for item.
LLInventoryItem* item = (LLInventoryItem*)objectp;
LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(item->getType(),
item->getActualType(),
item->getInventoryType(),
this,
mFolderRoot.get(),
item->getUUID(),
item->getFlags());
if (new_listener)
{
itemp = createFolderViewItem(new_listener);
}
}
if (itemp)
{
itemp->addToFolder(parent_folder, mFolderRoot.get());
}
}
}
// If this is a folder, add the children of the folder and recursively add any
// child folders.
if (id.isNull()
|| (objectp
&& objectp->getType() == LLAssetType::AT_CATEGORY))
{
LLViewerInventoryCategory::cat_array_t* categories;
LLViewerInventoryItem::item_array_t* items;
mInventory->lockDirectDescendentArrays(id, categories, items);
if(categories)
{
for (LLViewerInventoryCategory::cat_array_t::const_iterator cat_iter = categories->begin();
cat_iter != categories->end();
++cat_iter)
{
const LLViewerInventoryCategory* cat = (*cat_iter);
buildNewViews(cat->getUUID());
}
}
if(items && parent_folder)
{
for (LLViewerInventoryItem::item_array_t::const_iterator item_iter = items->begin();
item_iter != items->end();
++item_iter)
{
const LLViewerInventoryItem* item = (*item_iter);
buildNewViews(item->getUUID());
//.........这里部分代码省略.........
示例9: if
void LLInventoryPanel::buildNewViews(const LLUUID& id)
{
LLFolderViewItem* itemp = NULL;
LLInventoryObject* objectp = gInventory.getObject(id);
if (objectp)
{
if (objectp->getType() <= LLAssetType::AT_NONE ||
objectp->getType() >= LLAssetType::AT_COUNT)
{
llwarns << "LLInventoryPanel::buildNewViews called with objectp->mType == "
<< ((S32) objectp->getType())
<< " (shouldn't happen)" << llendl;
}
else if (objectp->getType() == LLAssetType::AT_CATEGORY) // build new view for category
{
LLInvFVBridge* new_listener = LLInvFVBridge::createBridge(objectp->getType(),
LLInventoryType::IT_CATEGORY,
this,
objectp->getUUID());
if (new_listener)
{
LLFolderViewFolder* folderp = new LLFolderViewFolder(new_listener->getDisplayName(),
new_listener->getIcon(),
mFolders,
new_listener);
folderp->setItemSortOrder(mFolders->getSortOrder());
itemp = folderp;
}
}
else // build new view for item
{
LLInventoryItem* item = (LLInventoryItem*)objectp;
LLInvFVBridge* new_listener = LLInvFVBridge::createBridge(
item->getType(),
item->getInventoryType(),
this,
item->getUUID(),
item->getFlags());
if (new_listener)
{
itemp = new LLFolderViewItem(new_listener->getDisplayName(),
new_listener->getIcon(),
new_listener->getCreationDate(),
mFolders,
new_listener);
}
}
LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolders->getItemByID(objectp->getParentUUID());
if (itemp)
{
if (parent_folder)
{
itemp->addToFolder(parent_folder, mFolders);
}
else
{
llwarns << "Couldn't find parent folder for child " << itemp->getLabel() << llendl;
delete itemp;
}
}
}
if ((id.isNull() ||
(objectp && objectp->getType() == LLAssetType::AT_CATEGORY)))
{
LLViewerInventoryCategory::cat_array_t* categories;
LLViewerInventoryItem::item_array_t* items;
mInventory->lockDirectDescendentArrays(id, categories, items);
if(categories)
{
S32 count = categories->count();
for(S32 i = 0; i < count; ++i)
{
LLInventoryCategory* cat = categories->get(i);
buildNewViews(cat->getUUID());
}
}
if(items)
{
S32 count = items->count();
for(S32 i = 0; i < count; ++i)
{
LLInventoryItem* item = items->get(i);
buildNewViews(item->getUUID());
}
}
mInventory->unlockDirectDescendentArrays(id);
}
}
示例10: t2
void LLInventoryPanel::modelChanged(U32 mask)
{
LLFastTimer t2(LLFastTimer::FTM_REFRESH);
bool handled = false;
if(mask & LLInventoryObserver::LABEL)
{
handled = true;
// label change - empty out the display name for each object
// in this change set.
const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
std::set<LLUUID>::const_iterator id_end = changed_items.end();
LLFolderViewItem* view = NULL;
LLInvFVBridge* bridge = NULL;
for (;id_it != id_end; ++id_it)
{
view = mFolders->getItemByID(*id_it);
if(view)
{
// request refresh on this item (also flags for filtering)
bridge = (LLInvFVBridge*)view->getListener();
if(bridge)
{ // Clear the display name first, so it gets properly re-built during refresh()
bridge->clearDisplayName();
}
view->refresh();
}
}
}
if((mask & (LLInventoryObserver::STRUCTURE
| LLInventoryObserver::ADD
| LLInventoryObserver::REMOVE)) != 0)
{
handled = true;
// Record which folders are open by uuid.
LLInventoryModel* model = getModel();
if (model)
{
const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
std::set<LLUUID>::const_iterator id_end = changed_items.end();
for (;id_it != id_end; ++id_it)
{
// sync view with model
LLInventoryObject* model_item = model->getObject(*id_it);
LLFolderViewItem* view_item = mFolders->getItemByID(*id_it);
if (model_item)
{
if (!view_item)
{
// this object was just created, need to build a view for it
if ((mask & LLInventoryObserver::ADD) != LLInventoryObserver::ADD)
{
llwarns << *id_it << " is in model but not in view, but ADD flag not set" << llendl;
}
buildNewViews(*id_it);
// select any newly created object
// that has the auto rename at top of folder
// root set
if(mFolders->getRoot()->needsAutoRename())
{
setSelection(*id_it, FALSE);
}
}
else
{
// this object was probably moved, check its parent
if ((mask & LLInventoryObserver::STRUCTURE) != LLInventoryObserver::STRUCTURE)
{
llwarns << *id_it << " is in model and in view, but STRUCTURE flag not set" << llendl;
}
LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID());
if (view_item->getParentFolder() != new_parent)
{
view_item->getParentFolder()->extractItem(view_item);
view_item->addToFolder(new_parent, mFolders);
}
}
}
else
{
if (view_item)
{
if ((mask & LLInventoryObserver::REMOVE) != LLInventoryObserver::REMOVE)
{
llwarns << *id_it << " is not in model but in view, but REMOVE flag not set" << llendl;
}
// item in view but not model, need to delete view
view_item->destroyView();
}
else
{
llwarns << *id_it << "Item does not exist in either view or model, but notification triggered" << llendl;
}
}
//.........这里部分代码省略.........
示例11: getActivePanel
BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
{
const std::string command_name = userdata.asString();
if (command_name == "delete")
{
BOOL can_delete = FALSE;
LLFolderView* root = getActivePanel()->getRootFolder();
if (root)
{
can_delete = TRUE;
std::set<LLUUID> selection_set = root->getSelectionList();
if (selection_set.empty()) return FALSE;
for (std::set<LLUUID>::iterator iter = selection_set.begin();
iter != selection_set.end();
++iter)
{
const LLUUID &item_id = (*iter);
LLFolderViewItem *item = root->getItemByID(item_id);
const LLFolderViewEventListener *listener = item->getListener();
llassert(listener);
if (!listener) return FALSE;
can_delete &= listener->isItemRemovable();
can_delete &= !listener->isItemInTrash();
}
return can_delete;
}
return FALSE;
}
if (command_name == "save_texture")
{
return isSaveTextureEnabled(userdata);
}
if (command_name == "find_original")
{
LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item) return FALSE;
const LLUUID& item_id = current_item->getListener()->getUUID();
const LLViewerInventoryItem *item = gInventory.getItem(item_id);
if (item && item->getIsLinkType() && !item->getIsBrokenLink())
{
return TRUE;
}
return FALSE;
}
if (command_name == "find_links")
{
LLFolderView* root = getActivePanel()->getRootFolder();
std::set<LLUUID> selection_set = root->getSelectionList();
if (selection_set.size() != 1) return FALSE;
LLFolderViewItem* current_item = root->getCurSelectedItem();
if (!current_item) return FALSE;
const LLUUID& item_id = current_item->getListener()->getUUID();
const LLInventoryObject *obj = gInventory.getObject(item_id);
if (obj && !obj->getIsLinkType() && LLAssetType::lookupCanLink(obj->getType()))
{
return TRUE;
}
return FALSE;
}
// This doesn't currently work, since the viewer can't change an assetID an item.
if (command_name == "regenerate_link")
{
LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item) return FALSE;
const LLUUID& item_id = current_item->getListener()->getUUID();
const LLViewerInventoryItem *item = gInventory.getItem(item_id);
if (item && item->getIsBrokenLink())
{
return TRUE;
}
return FALSE;
}
if (command_name == "share")
{
LLSidepanelInventory* parent = dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
return parent ? parent->canShare() : FALSE;
}
return TRUE;
}
示例12: if
void LLBuildNewViewsScheduler::buildNewViews(LLInventoryPanel* panelp, LLInventoryObject* objectp)
{
LLFolderViewItem* itemp = NULL;
if (objectp)
{
if (objectp->getType() <= LLAssetType::AT_NONE ||
objectp->getType() >= LLAssetType::AT_COUNT)
{
llwarns << "called with objectp->mType == "
<< ((S32) objectp->getType())
<< " (shouldn't happen)" << llendl;
}
else if (objectp->getType() == LLAssetType::AT_CATEGORY) // build new view for category
{
LLInvFVBridge* new_listener = LLInvFVBridge::createBridge(objectp->getType(),
LLInventoryType::IT_CATEGORY,
panelp,
objectp->getUUID());
if (new_listener)
{
LLFolderViewFolder* folderp = new LLFolderViewFolder(new_listener->getDisplayName(),
new_listener->getIcon(),
panelp->getRootFolder(),
new_listener);
folderp->setItemSortOrder(panelp->getSortOrder());
itemp = folderp;
}
}
else // build new view for item
{
LLInventoryItem* item = (LLInventoryItem*)objectp;
LLInvFVBridge* new_listener = LLInvFVBridge::createBridge(
item->getType(),
item->getInventoryType(),
panelp,
item->getUUID(),
item->getFlags());
if (new_listener)
{
itemp = new LLFolderViewItem(new_listener->getDisplayName(),
new_listener->getIcon(),
new_listener->getCreationDate(),
panelp->getRootFolder(),
new_listener);
}
}
LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)panelp->getRootFolder()->getItemByID(objectp->getParentUUID());
if (itemp)
{
itemp->mDelayedDelete = TRUE;
if (parent_folder)
{
itemp->addToFolder(parent_folder, panelp->getRootFolder());
}
else
{
llwarns << "Couldn't find parent folder for child " << itemp->getLabel() << llendl;
delete itemp;
}
}
}
if (!objectp || (objectp && (objectp->getType() == LLAssetType::AT_CATEGORY)))
{
LLViewerInventoryCategory::cat_array_t* categories;
LLViewerInventoryItem::item_array_t* items;
panelp->getModel()->lockDirectDescendentArrays((objectp != NULL) ? objectp->getUUID() : LLUUID::null, categories, items);
if(categories)
{
S32 count = categories->count();
for(S32 i = 0; i < count; ++i)
{
LLInventoryCategory* cat = categories->get(i);
addJob(panelp, cat);
}
}
if(items)
{
S32 count = items->count();
for(S32 i = 0; i < count; ++i)
{
LLInventoryItem* item = items->get(i);
addJob(panelp, item);
}
}
panelp->getModel()->unlockDirectDescendentArrays(objectp->getUUID());
}
}
示例13: mt
void LLInventoryPanel::buildNewViews(const LLUUID& id)
{
LLMemType mt(LLMemType::MTYPE_INVENTORY_BUILD_NEW_VIEWS);
LLFolderViewItem* itemp = NULL;
LLInventoryObject* objectp = gInventory.getObject(id);
if (objectp)
{
const LLUUID &parent_id = objectp->getParentUUID();
LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolderRoot->getItemByID(parent_id);
if (id == mStartFolderID)
{
parent_folder = mFolderRoot;
}
else if ((mStartFolderID != LLUUID::null) && (!gInventory.isObjectDescendentOf(id, mStartFolderID)))
{
// This item exists outside the inventory's hierarchy, so don't add it.
return;
}
if (objectp->getType() <= LLAssetType::AT_NONE ||
objectp->getType() >= LLAssetType::AT_COUNT)
{
llwarns << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : "
<< ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID()
<< llendl;
return;
}
if ((objectp->getType() == LLAssetType::AT_CATEGORY) &&
(objectp->getActualType() != LLAssetType::AT_LINK_FOLDER))
{
LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(objectp->getType(),
objectp->getType(),
LLInventoryType::IT_CATEGORY,
this,
mFolderRoot,
objectp->getUUID());
if (new_listener)
{
LLFolderViewFolder::Params params;
params.name = new_listener->getDisplayName();
params.icon = new_listener->getIcon();
params.icon_open = new_listener->getOpenIcon();
if (mShowItemLinkOverlays) // if false, then links show up just like normal items
{
params.icon_overlay = LLUI::getUIImage("Inv_Link");
}
params.root = mFolderRoot;
params.listener = new_listener;
params.tool_tip = params.name;
LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(params);
folderp->setItemSortOrder(mFolderRoot->getSortOrder());
itemp = folderp;
// Hide the root folder, so we can show the contents of a folder flat
// but still have the parent folder present for listener-related operations.
if (id == mStartFolderID)
{
folderp->setHidden(TRUE);
}
const LLViewerInventoryCategory *cat = dynamic_cast<LLViewerInventoryCategory *>(objectp);
if (cat && getIsHiddenFolderType(cat->getPreferredType()))
{
folderp->setHidden(TRUE);
}
}
}
else
{
// Build new view for item.
LLInventoryItem* item = (LLInventoryItem*)objectp;
LLInvFVBridge* new_listener = mInvFVBridgeBuilder->createBridge(item->getType(),
item->getActualType(),
item->getInventoryType(),
this,
mFolderRoot,
item->getUUID(),
item->getFlags());
if (new_listener)
{
LLFolderViewItem::Params params;
params.name = new_listener->getDisplayName();
params.icon = new_listener->getIcon();
params.icon_open = new_listener->getOpenIcon();
if (mShowItemLinkOverlays) // if false, then links show up just like normal items
{
params.icon_overlay = LLUI::getUIImage("Inv_Link");
}
params.creation_date = new_listener->getCreationDate();
params.root = mFolderRoot;
params.listener = new_listener;
params.rect = LLRect (0, 0, 0, 0);
params.tool_tip = params.name;
itemp = LLUICtrlFactory::create<LLFolderViewItem> (params);
}
}
if (itemp)
{
//.........这里部分代码省略.........
示例14: getActivePanel
BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
{
const std::string command_name = userdata.asString();
if (command_name == "delete" || command_name == "remove")
{
BOOL can_delete = FALSE;
LLFolderView *folder = getActivePanel()->getRootFolder();
if (folder)
{
std::set<LLUUID> selection_set;
folder->getSelectionList(selection_set);
can_delete = (selection_set.size() > 0);
for (std::set<LLUUID>::iterator iter = selection_set.begin();
iter != selection_set.end();
++iter)
{
const LLUUID &item_id = (*iter);
LLFolderViewItem *item = folder->getItemByID(item_id);
can_delete &= item->getListener()->isItemRemovable();
}
return can_delete;
}
return FALSE;
}
if (command_name == "remove_link")
{
BOOL can_delete = FALSE;
LLFolderView *folder = getActivePanel()->getRootFolder();
if (folder)
{
std::set<LLUUID> selection_set;
folder->getSelectionList(selection_set);
can_delete = (selection_set.size() > 0);
for (std::set<LLUUID>::iterator iter = selection_set.begin();
iter != selection_set.end();
++iter)
{
const LLUUID &item_id = (*iter);
LLViewerInventoryItem *item = gInventory.getItem(item_id);
if (!item || !item->getIsLinkType())
return FALSE;
}
return can_delete;
}
return FALSE;
}
if (command_name == "rename" ||
command_name == "delete_outfit")
{
return (getCorrectListenerForAction() != NULL) && hasItemsSelected();
}
if (command_name == "wear")
{
if (isCOFPanelActive())
{
return FALSE;
}
}
if (command_name == "make_outfit")
{
return TRUE;
}
if (command_name == "edit" ||
command_name == "add"
)
{
return (getCorrectListenerForAction() != NULL);
}
return TRUE;
}