void LLPanelFriends::updateColumns(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; if (panelp) { LLButton* expand_button = panelp->getChild<LLButton>("expand_collapse_btn"); LLScrollListCtrl* list = panelp->getChild<LLScrollListCtrl>("friend_list"); //llinfos << "Refreshing UI" << llendl; S32 width = 22; std::string button = ">"; if (gSavedSettings.getBOOL("ContactListCollapsed")) { width = 0; button = "<"; } expand_button->setLabel(button); LLScrollListColumn* column = list->getColumn(5); list->updateStaticColumnWidth(column, width); column->setWidth(width); column = list->getColumn(6); list->updateStaticColumnWidth(column, width); column->setWidth(width); column = list->getColumn(7); list->updateStaticColumnWidth(column, width); column->setWidth(width); list->updateLayout(); if (!gSavedSettings.getBOOL("ContactListCollapsed")) { panelp->updateFriends(LLFriendObserver::ADD); } } }
void LLScrollColumnHeader::handleReshape(const LLRect& new_rect, bool by_user) { S32 new_width = new_rect.getWidth(); S32 delta_width = new_width - (getRect().getWidth() /*+ mColumn->mParentCtrl->getColumnPadding()*/); if (delta_width != 0) { S32 remaining_width = -delta_width; S32 col; for (col = mColumn->mIndex + 1; col < mColumn->mParentCtrl->getNumColumns(); col++) { LLScrollListColumn* columnp = mColumn->mParentCtrl->getColumn(col); if (!columnp) continue; if (columnp->mHeader && columnp->mHeader->canResize()) { // how many pixels in width can this column afford to give up? S32 resize_buffer_amt = llmax(0, columnp->getWidth() - MIN_COLUMN_WIDTH); // user shrinking column, need to add width to other columns if (delta_width < 0) { if (columnp->getWidth() > 0) { // statically sized column, give all remaining width to this column columnp->setWidth(columnp->getWidth() + remaining_width); if (columnp->mRelWidth > 0.f) { columnp->mRelWidth = (F32)columnp->getWidth() / (F32)mColumn->mParentCtrl->getItemListRect().getWidth(); } // all padding went to this widget, we're done break; } } else { // user growing column, need to take width from other columns remaining_width += resize_buffer_amt; if (columnp->getWidth() > 0) { columnp->setWidth(columnp->getWidth() - llmin(columnp->getWidth() - MIN_COLUMN_WIDTH, delta_width)); if (columnp->mRelWidth > 0.f) { columnp->mRelWidth = (F32)columnp->getWidth() / (F32)mColumn->mParentCtrl->getItemListRect().getWidth(); } } if (remaining_width >= 0) { // width sucked up from neighboring columns, done break; } } } } // clamp resize amount to maximum that can be absorbed by other columns if (delta_width > 0) { delta_width += llmin(remaining_width, 0); } // propagate constrained delta_width to new width for this column new_width = getRect().getWidth() + delta_width - mColumn->mParentCtrl->getColumnPadding(); // use requested width mColumn->setWidth(new_width); // update proportional spacing if (mColumn->mRelWidth > 0.f) { mColumn->mRelWidth = (F32)new_width / (F32)mColumn->mParentCtrl->getItemListRect().getWidth(); } // tell scroll list to layout columns again // do immediate update to get proper feedback to resize handle // which needs to know how far the resize actually went mColumn->mParentCtrl->updateColumns(); } }