void LLAccordionCtrlTab::restoreOpenCloseState() { if(!mWasStateStored) return; if(getDisplayChildren() != mStoredOpenCloseState) { changeOpenClose(getDisplayChildren()); } mWasStateStored = false; }
void LLAccordionCtrlTab::storeOpenCloseState() { if(mWasStateStored) return; mStoredOpenCloseState = getDisplayChildren(); mWasStateStored = true; }
S32 LLAccordionCtrlTab::notify(const LLSD& info) { if(info.has("action")) { std::string str_action = info["action"]; if(str_action == "select_first") { showAndFocusHeader(); return 1; } else if( str_action == "select_last" ) { if(getDisplayChildren() == false) { showAndFocusHeader(); } else { LLView* view = getAccordionView(); if(view) view->notify(LLSD().with("action","select_last")); } } } return 0; }
LLStatView::~LLStatView() { // Children all cleaned up by default view destructor. if (mSetting.length() > 0) { BOOL open = getDisplayChildren(); gSavedSettings.setBOOL(mSetting, open); /* Flawfinder: ignore */ } }
LLStatView::~LLStatView() { // Children all cleaned up by default view destructor. if (mSetting.length() > 0) { BOOL isopen = getDisplayChildren(); LLUI::sSettingGroups["config"]->setBOOL(mSetting, isopen); } }
LLStatView::LLStatView(const LLStatView::Params& p) : LLContainerView(p), mSetting(p.setting) { BOOL isopen = getDisplayChildren(); if (mSetting.length() > 0) { isopen = LLUI::sSettingGroups["config"]->getBOOL(mSetting); } setDisplayChildren(isopen); }
void LLAccordionCtrlTab::changeOpenClose(bool is_open) { if(is_open) mExpandedHeight = getRect().getHeight(); setDisplayChildren(!is_open); reshape(getRect().getWidth(), getRect().getHeight(), FALSE); if (mCommitSignal) { (*mCommitSignal)(this, getDisplayChildren()); } }
void LLAccordionCtrlTab::setDisplayChildren(bool display) { mDisplayChildren = display; LLRect rect = getRect(); rect.mBottom = rect.mTop - (getDisplayChildren() ? mExpandedHeight : HEADER_HEIGHT); setRect(rect); if(mContainerPanel) mContainerPanel->setVisible(getDisplayChildren()); if(mDisplayChildren) { adjustContainerPanel(); } else { if(mScrollbar) mScrollbar->setVisible(false); } }
BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask) { if(mCollapsible && mHeaderVisible && mCanOpenClose) { if(y >= (getRect().getHeight() - HEADER_HEIGHT) ) { mHeader->setFocus(true); changeOpenClose(getDisplayChildren()); //reset stored state mWasStateStored = false; return TRUE; } } return LLUICtrl::handleMouseDown(x,y,mask); }
BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent) { LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME); if( !header->hasFocus() ) return LLUICtrl::handleKey(key, mask, called_from_parent); if ( (key == KEY_RETURN )&& mask == MASK_NONE) { changeOpenClose(getDisplayChildren()); return TRUE; } if ( (key == KEY_ADD || key == KEY_RIGHT)&& mask == MASK_NONE) { if(getDisplayChildren() == false) { changeOpenClose(getDisplayChildren()); return TRUE; } } if ( (key == KEY_SUBTRACT || key == KEY_LEFT)&& mask == MASK_NONE) { if(getDisplayChildren() == true) { changeOpenClose(getDisplayChildren()); return TRUE; } } if ( key == KEY_DOWN && mask == MASK_NONE) { //if collapsed go to the next accordion if(getDisplayChildren() == false) //we processing notifyParent so let call parent directly getParent()->notifyParent(LLSD().with("action","select_next")); else { getAccordionView()->notify(LLSD().with("action","select_first")); } return TRUE; } if ( key == KEY_UP && mask == MASK_NONE) { //go to the previous accordion //we processing notifyParent so let call parent directly getParent()->notifyParent(LLSD().with("action","select_prev")); return TRUE; } return LLUICtrl::handleKey(key, mask, called_from_parent); }
bool LLAccordionCtrlTab::addChild(LLView* child, S32 tab_group) { if(DD_HEADER_NAME != child->getName()) { reshape(child->getRect().getWidth() , child->getRect().getHeight() + HEADER_HEIGHT ); mExpandedHeight = getRect().getHeight(); } bool res = LLUICtrl::addChild(child, tab_group); if(DD_HEADER_NAME != child->getName()) { if(!mCollapsible) setDisplayChildren(true); else setDisplayChildren(getDisplayChildren()); } if (!mContainerPanel) mContainerPanel = findContainerView(); return res; }
S32 LLAccordionCtrlTab::notifyParent(const LLSD& info) { if(info.has("action")) { std::string str_action = info["action"]; if(str_action == "size_changes") { // S32 height = info["height"]; height = llmax(height,10) + HEADER_HEIGHT + getPaddingTop() + getPaddingBottom(); mExpandedHeight = height; if(isExpanded()) { LLRect panel_rect = getRect(); panel_rect.setLeftTopAndSize( panel_rect.mLeft, panel_rect.mTop, panel_rect.getWidth(), height); reshape(getRect().getWidth(),height); setRect(panel_rect); } //LLAccordionCtrl should rearrange accordion tab if one of accordion change its size if (getParent()) // A parent may not be set if tabs are added dynamically. getParent()->notifyParent(info); return 1; } else if(str_action == "select_prev") { showAndFocusHeader(); return 1; } } else if (info.has("scrollToShowRect")) { LLAccordionCtrl* parent = dynamic_cast<LLAccordionCtrl*>(getParent()); if (parent && parent->getFitParent()) { // EXT-8285 ('No attachments worn' text appears at the bottom of blank 'Attachments' accordion) // The problem was in passing message "scrollToShowRect" IN LLAccordionCtrlTab::notifyParent // FROM child LLScrollContainer TO parent LLAccordionCtrl with "it_parent" set to true. // It is wrong notification for parent accordion which leads to recursive call of adjustContainerPanel // As the result of recursive call of adjustContainerPanel we got LLAccordionCtrlTab // that reshaped and re-sized with different rectangles. // LLAccordionCtrl has own scrollContainer and LLAccordionCtrlTab has own scrollContainer // both should handle own scroll container's event. // So, if parent accordion "fit_parent" accordion tab should handle its scroll container events itself. return 1; } if (!getDisplayChildren()) { // Don't pass scrolling event further if our contents are invisible (STORM-298). return 1; } } return LLUICtrl::notifyParent(info); }