void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view) { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view); if(!accordion_tab) return; if(std::find(beginChild(), endChild(), accordion_tab) != endChild()) removeChild(accordion_tab); for (std::vector<LLAccordionCtrlTab*>::iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter) { if (accordion_tab == (*iter)) { mAccordionTabs.erase(iter); break; } } // if removed is selected - reset selection if (mSelectedTab == view) { mSelectedTab = NULL; } }
//virtual BOOL LLUICtrl::postBuild() { // // Find all of the children that want to be in front and move them to the front // if (getChildCount() > 0) { std::vector<LLUICtrl*> childrenToMoveToFront; for (LLView::child_list_const_iter_t child_it = beginChild(); child_it != endChild(); ++child_it) { LLUICtrl* uictrl = dynamic_cast<LLUICtrl*>(*child_it); if (uictrl && uictrl->mRequestsFront) { childrenToMoveToFront.push_back(uictrl); } } for (std::vector<LLUICtrl*>::iterator it = childrenToMoveToFront.begin(); it != childrenToMoveToFront.end(); ++it) { sendChildToFront(*it); } } return LLView::postBuild(); }
void LLAccordionCtrl::addCollapsibleCtrl(LLView* view) { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(view); if(!accordion_tab) return; if(std::find(beginChild(), endChild(), accordion_tab) == endChild()) addChild(accordion_tab); mAccordionTabs.push_back(accordion_tab); accordion_tab->setDropDownStateChangedCallback( boost::bind(&LLAccordionCtrl::onCollapseCtrlCloseOpen, this, mAccordionTabs.size() - 1) ); arrange(); }
Core::RefCntPtr<ElementNode> ElementNode::findFirstElement(const tstring& name_) const { for (const_iterator it = beginChild(); it != endChild(); ++it) { ElementNodePtr element = Core::dynamic_ptr_cast<ElementNode>(*it); if ( (!element.empty()) && (element->name() == name_) ) return element; } return ElementNodePtr(); }
//Fixing a hole in alert logic. If the alert isn't modal, clicking 'x' to close its floater would result //in a dangling notification. To address this we try to find the most reasonable button to emulate clicking. //Close tends to be the best, as it's most accurate, and is the default for alerts that lack defined buttons. //Next up is cancel, which is the correct behavior for a majority of alert notifications //After that, try 'ok', which is the only button that exists for a few alert notifications. 'ok' for these equates to 'dismiss'. //Finally, if none of the above are found, issue the respond procedure with the dummy button name 'close'. void LLAlertDialog::onClose(bool app_quitting) { if(mNote.get() && !mNote->isRespondedTo() && !mNote->isIgnored()) { LLButton* btn = NULL; bool found_cancel = false; for(child_list_const_iter_t it = beginChild(); it != endChild(); ++it) { LLButton* cur_btn = dynamic_cast<LLButton*>(*it); if(!cur_btn) continue; if( LLStringUtil::compareInsensitive(cur_btn->getName(), "close") == 0 )//prefer 'close' over anything else. { btn = cur_btn; break; } else if(LLStringUtil::compareInsensitive(cur_btn->getName(), "cancel") == 0 )//prefer 'cancel' over 'ok'. { btn = cur_btn; found_cancel = true; } else if(!found_cancel && LLStringUtil::compareInsensitive(cur_btn->getName(), "ok") == 0 )//accept 'ok' as last resort. { btn = cur_btn; } } LLSD response = mNote->getResponseTemplate(); if(btn) response[btn->getName()] = true; else { //We found no acceptable button so just feed it a fake one. //LLNotification::getSelectedOption will return -1 in notification callbacks. response["Close"] = true; } mNote->respond(response); } LLModalDialog::onClose(app_quitting); }