diff options
Diffstat (limited to 'indra/llui/lltooltip.cpp')
-rw-r--r-- | indra/llui/lltooltip.cpp | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 4bc9a9c042..bb85177811 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -57,6 +57,8 @@ LLToolTipView *gToolTipView = NULL; // Member functions // +static LLDefaultChildRegistry::Register<LLToolTipView> register_tooltip_view("tooltip_view"); + LLToolTipView::Params::Params() { mouse_opaque = false; @@ -137,12 +139,16 @@ void LLToolTipView::drawStickyRect() { gl_rect_2d(LLToolTipMgr::instance().getMouseNearRect(), LLColor4::white, false); } + +// defaults for floater param block pulled from widgets/floater.xml +static LLWidgetNameRegistry::StaticRegistrar sRegisterInspectorParams(&typeid(LLInspector::Params), "inspector"); + // // LLToolTip // -static LLDefaultChildRegistry::Register<LLToolTip> r("tool_tip"); +static LLDefaultChildRegistry::Register<LLToolTip> register_tooltip("tool_tip"); LLToolTip::Params::Params() @@ -166,7 +172,6 @@ LLToolTip::Params::Params() LLToolTip::LLToolTip(const LLToolTip::Params& p) : LLPanel(p), - mMaxWidth(p.max_width), mHasClickCallback(p.click_callback.isProvided()), mPadding(p.padding), mTextBox(NULL), @@ -175,11 +180,9 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) mHomePageButton(NULL) { LLTextBox::Params params; - params.initial_value = "tip_text"; params.name = params.initial_value().asString(); // bake textbox padding into initial rect params.rect = LLRect (mPadding, mPadding + 1, mPadding + 1, mPadding); - params.follows.flags = FOLLOWS_ALL; params.h_pad = 0; params.v_pad = 0; params.mouse_opaque = false; @@ -204,7 +207,6 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16); icon_rect.setOriginAndSize(mPadding, mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE); icon_params.rect = icon_rect; - //icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM; icon_params.image_unselected(imagep); icon_params.image_selected(imagep); @@ -275,15 +277,30 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) } } -void LLToolTip::setValue(const LLSD& value) +void LLToolTip::initFromParams(const LLToolTip::Params& p) { + LLPanel::initFromParams(p); + + // do this *after* we've had our size set in LLPanel::initFromParams(); const S32 REALLY_LARGE_HEIGHT = 10000; - reshape(mMaxWidth, REALLY_LARGE_HEIGHT); + mTextBox->reshape(p.max_width, REALLY_LARGE_HEIGHT); - mTextBox->setValue(value); + if (p.styled_message.isProvided()) + { + for (LLInitParam::ParamIterator<LLToolTip::StyledText>::const_iterator text_it = p.styled_message().begin(); + text_it != p.styled_message().end(); + ++text_it) + { + mTextBox->appendText(text_it->text(), false, text_it->style); + } + } + else + { + mTextBox->setText(p.message()); + } LLRect text_contents_rect = mTextBox->getContentsRect(); - S32 text_width = llmin(mMaxWidth, text_contents_rect.getWidth()); + S32 text_width = llmin(p.max_width(), text_contents_rect.getWidth()); S32 text_height = text_contents_rect.getHeight(); mTextBox->reshape(text_width, text_height); @@ -294,7 +311,7 @@ void LLToolTip::setValue(const LLSD& value) tooltip_rect.mBottom = 0; tooltip_rect.mLeft = 0; - setRect(tooltip_rect); + setShape(tooltip_rect); } void LLToolTip::setVisible(BOOL visible) @@ -405,9 +422,8 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) } tooltip_params.rect = LLRect (0, 1, 1, 0); - mToolTip = LLUICtrlFactory::create<LLToolTip> (tooltip_params); - mToolTip->setValue(params.message()); + gToolTipView->addChild(mToolTip); if (params.pos.isProvided()) |