LLFlatListView::LLFlatListView(const LLFlatListView::Params& p) : LLScrollContainer(p) , mItemComparator(NULL) , mItemsPanel(NULL) , mItemPad(p.item_pad) , mAllowSelection(p.allow_select) , mMultipleSelection(p.multi_select) , mKeepOneItemSelected(p.keep_one_selected) , mCommitOnSelectionChange(false) , mPrevNotifyParentRect(LLRect()) , mNoItemsCommentTextbox(NULL) , mIsConsecutiveSelection(false) , mKeepSelectionVisibleOnReshape(p.keep_selection_visible_on_reshape) { mBorderThickness = getBorderWidth(); LLRect scroll_rect = getRect(); LLRect items_rect; setItemsNoScrollWidth(scroll_rect.getWidth()); items_rect.setLeftTopAndSize(mBorderThickness, scroll_rect.getHeight() - mBorderThickness, mItemsNoScrollWidth, 0); LLPanel::Params pp; pp.rect(items_rect); mItemsPanel = LLUICtrlFactory::create<LLPanel> (pp); addChild(mItemsPanel); //we don't need to stretch in vertical direction on reshaping by a parent //no bottom following! mItemsPanel->setFollows(FOLLOWS_LEFT | FOLLOWS_RIGHT | FOLLOWS_TOP); LLViewBorder::Params params; params.name("scroll border"); params.rect(getLastSelectedItemRect()); params.visible(false); params.bevel_style(LLViewBorder::BEVEL_IN); mSelectedItemsBorder = LLUICtrlFactory::create<LLViewBorder> (params); mItemsPanel->addChild( mSelectedItemsBorder ); { // create textbox for "No Items" comment text LLTextBox::Params text_p = p.no_items_text; if (!text_p.rect.isProvided()) { LLRect comment_rect = getRect(); comment_rect.setOriginAndSize(0, 0, comment_rect.getWidth(), comment_rect.getHeight()); comment_rect.stretch(-getBorderWidth()); text_p.rect(comment_rect); } text_p.border_visible(false); if (!text_p.follows.isProvided()) { text_p.follows.flags(FOLLOWS_ALL); } mNoItemsCommentTextbox = LLUICtrlFactory::create<LLTextBox>(text_p, this); } };
// Default constructor LLScrollContainer::LLScrollContainer(const LLScrollContainer::Params& p) : LLUICtrl(p), mAutoScrolling( FALSE ), mAutoScrollRate( 0.f ), mBackgroundColor(p.bg_color()), mIsOpaque(p.is_opaque), mHideScrollbar(p.hide_scrollbar), mReserveScrollCorner(p.reserve_scroll_corner), mMinAutoScrollRate(p.min_auto_scroll_rate), mMaxAutoScrollRate(p.max_auto_scroll_rate), mScrolledView(NULL) { static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); LLRect border_rect( 0, getRect().getHeight(), getRect().getWidth(), 0 ); LLViewBorder::Params params; params.name("scroll border"); params.rect(border_rect); params.visible(p.border_visible); params.bevel_style(LLViewBorder::BEVEL_IN); mBorder = LLUICtrlFactory::create<LLViewBorder> (params); LLView::addChild( mBorder ); mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 ); mInnerRect.stretch( -getBorderWidth() ); LLRect vertical_scroll_rect = mInnerRect; vertical_scroll_rect.mLeft = vertical_scroll_rect.mRight - scrollbar_size; LLScrollbar::Params sbparams; sbparams.name("scrollable vertical"); sbparams.rect(vertical_scroll_rect); sbparams.orientation(LLScrollbar::VERTICAL); sbparams.doc_size(mInnerRect.getHeight()); sbparams.doc_pos(0); sbparams.page_size(mInnerRect.getHeight()); sbparams.step_size(VERTICAL_MULTIPLE); sbparams.follows.flags(FOLLOWS_RIGHT | FOLLOWS_TOP | FOLLOWS_BOTTOM); sbparams.visible(false); sbparams.change_callback(p.scroll_callback); mScrollbar[VERTICAL] = LLUICtrlFactory::create<LLScrollbar> (sbparams); LLView::addChild( mScrollbar[VERTICAL] ); LLRect horizontal_scroll_rect = mInnerRect; horizontal_scroll_rect.mTop = horizontal_scroll_rect.mBottom + scrollbar_size; sbparams.name("scrollable horizontal"); sbparams.rect(horizontal_scroll_rect); sbparams.orientation(LLScrollbar::HORIZONTAL); sbparams.doc_size(mInnerRect.getWidth()); sbparams.doc_pos(0); sbparams.page_size(mInnerRect.getWidth()); sbparams.step_size(VERTICAL_MULTIPLE); sbparams.visible(false); sbparams.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT); sbparams.change_callback(p.scroll_callback); mScrollbar[HORIZONTAL] = LLUICtrlFactory::create<LLScrollbar> (sbparams); LLView::addChild( mScrollbar[HORIZONTAL] ); }
LLRadioGroup::LLRadioGroup(const LLRadioGroup::Params& p) : LLUICtrl(p), mFont(p.font.isProvided() ? p.font() : LLFontGL::getFontSansSerifSmall()), mSelectedIndex(-1), mHasBorder(p.has_border) { if (mHasBorder) { LLViewBorder::Params params; params.name("radio group border"); params.rect(LLRect(0, getRect().getHeight(), getRect().getWidth(), 0)); params.bevel_style(LLViewBorder::BEVEL_NONE); LLViewBorder * vb = LLUICtrlFactory::create<LLViewBorder> (params); addChild (vb); } }