void LLTeleportHistoryPanel::onAccordionExpand(LLUICtrl* ctrl, const LLSD& param) { bool expanded = param.asBoolean(); // Save accordion tab state to restore it in refresh() setAccordionCollapsedByUser(ctrl, !expanded); // Reset selection upon accordion being collapsed // to disable "Teleport" and "Map" buttons for hidden item. if (!expanded && mLastSelectedFlatlList) { mLastSelectedFlatlList->resetSelection(); } }
void LLPanelPeople::onFilterEdit(const std::string& search_string) { mFilterSubStringOrig = search_string; LLStringUtil::trimHead(mFilterSubStringOrig); // Searches are case-insensitive std::string search_upper = mFilterSubStringOrig; LLStringUtil::toUpper(search_upper); if (mFilterSubString == search_upper) return; mFilterSubString = search_upper; //store accordion tabs state before any manipulation with accordion tabs if(!mFilterSubString.empty()) { notifyChildren(LLSD().with("action","store_state")); } // Apply new filter. mNearbyList->setNameFilter(mFilterSubStringOrig); mOnlineFriendList->setNameFilter(mFilterSubStringOrig); mAllFriendList->setNameFilter(mFilterSubStringOrig); mRecentList->setNameFilter(mFilterSubStringOrig); mGroupList->setNameFilter(mFilterSubStringOrig); setAccordionCollapsedByUser("tab_online", false); setAccordionCollapsedByUser("tab_all", false); showFriendsAccordionsIfNeeded(); //restore accordion tabs state _after_ all manipulations... if(mFilterSubString.empty()) { notifyChildren(LLSD().with("action","restore_state")); } }
void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list) { if(!avatar_list) { llerrs << "Bad parameter" << llendl; return; } bool expanded = param.asBoolean(); setAccordionCollapsedByUser(ctrl, !expanded); if(!expanded) { avatar_list->resetSelection(); } }
BOOL LLTeleportHistoryPanel::postBuild() { mTeleportHistory = LLTeleportHistoryStorage::getInstance(); if (mTeleportHistory) { mTeleportHistoryChangedConnection = mTeleportHistory->setHistoryChangedCallback(boost::bind(&LLTeleportHistoryPanel::onTeleportHistoryChange, this, _1)); } mHistoryAccordion = getChild<LLAccordionCtrl>("history_accordion"); if (mHistoryAccordion) { for (child_list_const_iter_t iter = mHistoryAccordion->beginChild(); iter != mHistoryAccordion->endChild(); iter++) { if (dynamic_cast<LLAccordionCtrlTab*>(*iter)) { LLAccordionCtrlTab* tab = (LLAccordionCtrlTab*)*iter; tab->setRightMouseDownCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionTabRightClick, this, _1, _2, _3, _4)); tab->setDisplayChildren(false); tab->setDropDownStateChangedCallback(boost::bind(&LLTeleportHistoryPanel::onAccordionExpand, this, _1, _2)); // All accordion tabs are collapsed initially setAccordionCollapsedByUser(tab, true); mItemContainers.put(tab); LLFlatListView* fl = getFlatListViewFromTab(tab); if (fl) { fl->setCommitOnSelectionChange(true); fl->setDoubleClickCallback(boost::bind(&LLTeleportHistoryPanel::onDoubleClickItem, this)); fl->setCommitCallback(boost::bind(&LLTeleportHistoryPanel::handleItemSelect, this, fl)); fl->setReturnCallback(boost::bind(&LLTeleportHistoryPanel::onReturnKeyPressed, this)); } } } // Open first 2 accordion tabs if (mItemContainers.size() > 1) { LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 1); tab->setDisplayChildren(true); setAccordionCollapsedByUser(tab, false); } if (mItemContainers.size() > 2) { LLAccordionCtrlTab* tab = mItemContainers.get(mItemContainers.size() - 2); tab->setDisplayChildren(true); setAccordionCollapsedByUser(tab, false); } } LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; registrar.add("TeleportHistory.ExpandAllFolders", boost::bind(&LLTeleportHistoryPanel::onExpandAllFolders, this)); registrar.add("TeleportHistory.CollapseAllFolders", boost::bind(&LLTeleportHistoryPanel::onCollapseAllFolders, this)); registrar.add("TeleportHistory.ClearTeleportHistory", boost::bind(&LLTeleportHistoryPanel::onClearTeleportHistory, this)); mEnableCallbackRegistrar.add("TeleportHistory.GearMenu.Enable", boost::bind(&LLTeleportHistoryPanel::isActionEnabled, this, _2)); mMenuGearButton = getChild<LLMenuButton>("gear_btn"); LLToggleableMenu* gear_menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_teleport_history_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());; if(gear_menu) { mGearMenuHandle = gear_menu->getHandle(); mMenuGearButton->setMenu(gear_menu); } return TRUE; }
void LLPanelPeople::setAccordionCollapsedByUser(const std::string& name, bool collapsed) { setAccordionCollapsedByUser(getChild<LLUICtrl>(name), collapsed); }