static LLPanel *childGetVisiblePanelWithHelp(LLView *parent) { LLView *child; // look through immediate children first for an active panel with help for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) { // do we have a panel with a help topic? LLPanel *panel = dynamic_cast<LLPanel *>(child); if (panel && panel->getVisible() && !panel->getHelpTopic().empty()) { return panel; } } // then try a bit harder and recurse through all children for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) { if (child->getVisible()) { LLPanel* panel = ::childGetVisiblePanelWithHelp(child); if (panel) { return panel; } } } // couldn't find any active panels with a help topic string return NULL; }
void LLSideTrayListener::getTabs(const LLSD& event) const { LLSD reply; LLSideTray* tray = mGetter(); LLSD::Integer ord(0); for (LLSideTray::child_list_const_iter_t chi(tray->beginChild()), chend(tray->endChild()); chi != chend; ++chi, ++ord) { LLView* child = *chi; // How much info is important? Toss in as much as seems reasonable for // each tab. But to me, at least for the moment, the most important // item is the tab name. LLSD info; // I like the idea of returning a map keyed by tab name. But as // compared to an array of maps, that loses sequence information. // Address that by indicating the original order in each map entry. info["ord"] = ord; info["visible"] = bool(child->getVisible()); info["enabled"] = bool(child->getEnabled()); info["available"] = child->isAvailable(); reply[child->getName()] = info; } sendReply(reply, event); }
bool LLPanel::childIsVisible(const std::string& id) const { LLView* child = findChild<LLView>(id); if (child) { return (bool)child->getVisible(); } return false; }
BOOL LLViewerTextEditor::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { LLView *viewp = *child_iter; S32 local_x = x - viewp->getRect().mLeft; S32 local_y = y - viewp->getRect().mBottom; if( viewp->pointInView(local_x, local_y) && viewp->getVisible() && viewp->getEnabled() && viewp->handleToolTip(local_x, local_y, msg, sticky_rect_screen ) ) { return TRUE; } } if( mSegments.empty() ) { return TRUE; } const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y ); if( cur_segment ) { BOOL has_tool_tip = FALSE; if( cur_segment->getStyle()->getIsEmbeddedItem() ) { LLWString wtip; has_tool_tip = getEmbeddedItemToolTipAtPos(cur_segment->getStart(), wtip); msg = wstring_to_utf8str(wtip); } else { has_tool_tip = cur_segment->getToolTip( msg ); } if( has_tool_tip ) { // Just use a slop area around the cursor // Convert rect local to screen coordinates S32 SLOP = 8; localPointToScreen( x - SLOP, y - SLOP, &(sticky_rect_screen->mLeft), &(sticky_rect_screen->mBottom) ); sticky_rect_screen->mRight = sticky_rect_screen->mLeft + 2 * SLOP; sticky_rect_screen->mTop = sticky_rect_screen->mBottom + 2 * SLOP; } } return TRUE; }
LLView* LLAccordionCtrlTab::findContainerView() { for(child_list_const_iter_t it = getChildList()->begin(); getChildList()->end() != it; ++it) { LLView* child = *it; if(DD_HEADER_NAME == child->getName()) continue; if(!child->getVisible()) continue; return child; } return NULL; }
static LLPanel *childGetVisibleTabWithHelp(LLView *parent) { LLView *child; // look through immediate children first for an active tab with help for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) { LLPanel *curTabPanel = NULL; // do we have a tab container? LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child); if (tab && tab->getVisible()) { curTabPanel = tab->getCurrentPanel(); } // do we have an accordion tab? LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child); if (accordion && accordion->getDisplayChildren()) { curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView()); } // if we found a valid tab, does it have a help topic? if (curTabPanel && !curTabPanel->getHelpTopic().empty()) { return curTabPanel; } } // then try a bit harder and recurse through all children for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) { if (child->getVisible()) { LLPanel* tab = ::childGetVisibleTabWithHelp(child); if (tab) { return tab; } } } // couldn't find any active tabs with a help topic string return NULL; }
void LLSideTray::updateSidetrayVisibility() { // set visibility of parent container based on collapsed state LLView* parent = getParent(); if (parent) { bool old_visibility = parent->getVisible(); bool new_visibility = !mCollapsed && !gAgentCamera.cameraMouselook(); if (old_visibility != new_visibility) { parent->setVisible(new_visibility); // Signal change of visible width. llinfos << "Visible: " << new_visibility << llendl; mVisibleWidthChangeSignal(this, new_visibility); } } }
void LLPopupView::draw() { S32 screen_x, screen_y; // remove dead popups for (popup_list_t::iterator popup_it = mPopups.begin(); popup_it != mPopups.end();) { if (!popup_it->get()) { mPopups.erase(popup_it++); } else { popup_it++; } } // draw in reverse order (most recent is on top) for (popup_list_t::reverse_iterator popup_it = mPopups.rbegin(); popup_it != mPopups.rend();) { LLView* popup = popup_it->get(); if (popup->getVisible()) { popup->localPointToScreen(0, 0, &screen_x, &screen_y); LLUI::pushMatrix(); { LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f); popup->draw(); } LLUI::popMatrix(); } ++popup_it; } LLPanel::draw(); }
void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent) { // Determine the sizes and locations of all contained views S32 total_height = 0; S32 top, left, right, bottom; //LLView *childp; // These will be used for the children left = 4; top = getRect().getHeight() - 4; right = width - 2; bottom = top; // Leave some space for the top label/grab handle if (mShowLabel) { total_height += 20; } if (mDisplayChildren) { // Determine total height U32 child_height = 0; for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { LLView *childp = *child_iter; if (!childp->getVisible()) { LL_WARNS() << "Incorrect visibility!" << LL_ENDL; } LLRect child_rect = childp->getRequiredRect(); child_height += child_rect.getHeight(); child_height += 2; } total_height += child_height; } if (total_height < height) total_height = height; if (followsTop()) { // HACK: casting away const. Should use setRect or some helper function instead. const_cast<LLRect&>(getRect()).mBottom = getRect().mTop - total_height; } else { // HACK: casting away const. Should use setRect or some helper function instead. const_cast<LLRect&>(getRect()).mTop = getRect().mBottom + total_height; } // HACK: casting away const. Should use setRect or some helper function instead. const_cast<LLRect&>(getRect()).mRight = getRect().mLeft + width; top = total_height; if (mShowLabel) { top -= 20; } bottom = top; if (mDisplayChildren) { // Iterate through all children, and put in container from top down. for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { LLView *childp = *child_iter; LLRect child_rect = childp->getRequiredRect(); bottom -= child_rect.getHeight(); LLRect r(left, bottom + child_rect.getHeight(), right, bottom); childp->setRect(r); childp->reshape(right - left, top - bottom); top = bottom - 2; bottom = top; } } if (!called_from_parent) { if (getParent()) { getParent()->reshape(getParent()->getRect().getWidth(), getParent()->getRect().getHeight(), FALSE); } } }
void LLScrollContainer::draw() { static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); if (mAutoScrolling) { // add acceleration to autoscroll mAutoScrollRate = llmin(mAutoScrollRate + (LLFrameTimer::getFrameDeltaTimeF32() * AUTO_SCROLL_RATE_ACCEL), mMaxAutoScrollRate); } else { // reset to minimum for next time mAutoScrollRate = mMinAutoScrollRate; } // clear this flag to be set on next call to autoScroll mAutoScrolling = FALSE; // auto-focus when scrollbar active // this allows us to capture user intent (i.e. stop automatically scrolling the view/etc) if (!hasFocus() && (mScrollbar[VERTICAL]->hasMouseCapture() || mScrollbar[HORIZONTAL]->hasMouseCapture())) { focusFirstItem(); } // Draw background if( mIsOpaque ) { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4fv( mBackgroundColor.get().mV ); gl_rect_2d( mInnerRect ); } // Draw mScrolledViews and update scroll bars. // get a scissor region ready, and draw the scrolling view. The // scissor region ensures that we don't draw outside of the bounds // of the rectangle. if( mScrolledView ) { updateScroll(); // Draw the scrolled area. { S32 visible_width = 0; S32 visible_height = 0; BOOL show_v_scrollbar = FALSE; BOOL show_h_scrollbar = FALSE; calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar ); LLLocalClipRect clip(LLRect(mInnerRect.mLeft, mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0) + visible_height, mInnerRect.mRight - (show_v_scrollbar ? scrollbar_size: 0), mInnerRect.mBottom + (show_h_scrollbar ? scrollbar_size : 0) )); drawChild(mScrolledView); } } // Highlight border if a child of this container has keyboard focus if( mBorder->getVisible() ) { mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus(this) ); } // Draw all children except mScrolledView // Note: scrollbars have been adjusted by above drawing code for (child_list_const_reverse_iter_t child_iter = getChildList()->rbegin(); child_iter != getChildList()->rend(); ++child_iter) { LLView *viewp = *child_iter; if( sDebugRects ) { sDepth++; } if( (viewp != mScrolledView) && viewp->getVisible() ) { drawChild(viewp); } if( sDebugRects ) { sDepth--; } } } // end draw
void LLAvatarListItem::updateChildren() { LL_DEBUGS("AvatarItemReshape") << LL_ENDL; LL_DEBUGS("AvatarItemReshape") << "Updating for: " << getAvatarName() << LL_ENDL; S32 name_new_width = getRect().getWidth(); S32 ctrl_new_left = name_new_width; S32 name_new_left = sLeftPadding; // iterate through all children and set them into correct position depend on each child visibility // assume that child indexes are in back order: the first in Enum is the last (right) in the item // iterate & set child views starting from right to left for (S32 i = 0; i < ALIC_COUNT; ++i) { // skip "name" textbox, it will be processed out of loop later if (ALIC_NAME == i) continue; LLView* control = getItemChildView((EAvatarListItemChildIndex)i); LL_DEBUGS("AvatarItemReshape") << "Processing control: " << control->getName() << LL_ENDL; // skip invisible views if (!control->getVisible()) continue; S32 ctrl_width = sChildrenWidths[i]; // including space between current & left controls // This one changes, so we can't cache it. if(ALIC_EXTRA_INFORMATION == i) { ctrl_width += mExtraInformation->getRect().getWidth(); } // decrease available for name_new_width -= ctrl_width; LL_DEBUGS("AvatarItemReshape") << "width: " << ctrl_width << ", name_new_width: " << name_new_width << LL_ENDL; LLRect control_rect = control->getRect(); LL_DEBUGS("AvatarItemReshape") << "rect before: " << control_rect << LL_ENDL; if (ALIC_ICON == i) { // assume that this is the last iteration, // so it is not necessary to save "ctrl_new_left" value calculated on previous iterations ctrl_new_left = sLeftPadding; name_new_left = ctrl_new_left + ctrl_width; } else { ctrl_new_left -= ctrl_width; } LL_DEBUGS("AvatarItemReshape") << "ctrl_new_left: " << ctrl_new_left << LL_ENDL; control_rect.setLeftTopAndSize( ctrl_new_left, control_rect.mTop, control_rect.getWidth(), control_rect.getHeight()); LL_DEBUGS("AvatarItemReshape") << "rect after: " << control_rect << LL_ENDL; control->setShape(control_rect); } // set size and position of the "name" child LLView* name_view = getItemChildView(ALIC_NAME); LLRect name_view_rect = name_view->getRect(); LL_DEBUGS("AvatarItemReshape") << "name rect before: " << name_view_rect << LL_ENDL; // apply paddings name_new_width -= sLeftPadding; name_new_width -= sNameRightPadding; name_view_rect.setLeftTopAndSize( name_new_left, name_view_rect.mTop, name_new_width, name_view_rect.getHeight()); name_view->setShape(name_view_rect); LL_DEBUGS("AvatarItemReshape") << "name rect after: " << name_view_rect << LL_ENDL; }
void LLOverlayBar::draw() { // retrieve rounded rect image LLUUID image_id; image_id.set(gViewerArt.getString("rounded_square.tga")); LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); if (imagep) { LLGLSTexture texture_enabled; LLViewerImage::bindTexture(imagep); const S32 PAD = gSavedSettings.getS32("StatusBarPad"); // draw rounded rect tabs behind all children LLRect r; // focus highlights LLColor4 color = gColors.getColor("FloaterFocusBorderColor"); glColor4fv(color.mV); if(gFocusMgr.childHasKeyboardFocus(gBottomPanel)) { for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { LLView *view = *child_iter; if(view->getEnabled() && view->getVisible()) { r = view->getRect(); gl_segmented_rect_2d_tex(r.mLeft - PAD/3 - 1, r.mTop + 3, r.mRight + PAD/3 + 1, r.mBottom, imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP); } } } // main tabs for (child_list_const_iter_t child_iter = getChildList()->begin(); child_iter != getChildList()->end(); ++child_iter) { LLView *view = *child_iter; if(view->getEnabled() && view->getVisible()) { r = view->getRect(); // draw a nice little pseudo-3D outline color = gColors.getColor("DefaultShadowDark"); glColor4fv(color.mV); gl_segmented_rect_2d_tex(r.mLeft - PAD/3 + 1, r.mTop + 2, r.mRight + PAD/3, r.mBottom, imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP); color = gColors.getColor("DefaultHighlightLight"); glColor4fv(color.mV); gl_segmented_rect_2d_tex(r.mLeft - PAD/3, r.mTop + 2, r.mRight + PAD/3 - 3, r.mBottom, imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP); // here's the main background. Note that it overhangs on the bottom so as to hide the // focus highlight on the bottom panel, thus producing the illusion that the focus highlight // continues around the tabs color = gColors.getColor("FocusBackgroundColor"); glColor4fv(color.mV); gl_segmented_rect_2d_tex(r.mLeft - PAD/3 + 1, r.mTop + 1, r.mRight + PAD/3 - 1, r.mBottom - 1, imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP); } } } // draw children on top LLPanel::draw(); }