diff options
author | Richard Nelson <richard@lindenlab.com> | 2009-10-05 20:53:51 +0000 |
---|---|---|
committer | Richard Nelson <richard@lindenlab.com> | 2009-10-05 20:53:51 +0000 |
commit | 606311b508c5b13cd995a98d16660e61a58fa3f7 (patch) | |
tree | 76060699e943ce9c305f1c717815f8ad01f4c7ed /indra/llui/lltextbox.cpp | |
parent | 9818f158366a0df980a2e4b9251177d9a9209cfb (diff) |
text boxes are now *not* mouse_opaque by default
fixed some textbox and text editor layout problems (getWidth called with wrong index)
EXT-1302 - rewrite LLExpandableTextBox to use new LLTextBase functionality (using custom LLExpanderSegment)
reviewed by James
Diffstat (limited to 'indra/llui/lltextbox.cpp')
-rw-r--r-- | indra/llui/lltextbox.cpp | 75 |
1 files changed, 19 insertions, 56 deletions
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 3feca136be..20bceb4675 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -47,26 +47,19 @@ LLTextBox::LLTextBox(const LLTextBox::Params& p) BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; + BOOL handled = LLTextBase::handleMouseDown(x, y, mask); - // HACK: Only do this if there actually is something to click, so that - // overly large text boxes in the older UI won't start eating clicks. - if (isClickable()) + if (getSoundFlags() & MOUSE_DOWN) { - handled = TRUE; + make_ui_sound("UISndClick"); + } + if (!handled && mClickedCallback) + { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); - - if (getSoundFlags() & MOUSE_DOWN) - { - make_ui_sound("UISndClick"); - } - } - if (!handled) - { - handled = LLTextBase::handleMouseDown(x, y, mask); + handled = TRUE; } return handled; @@ -76,33 +69,30 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; - // We only handle the click if the click both started and ended within us - - // HACK: Only do this if there actually is something to click, so that - // overly large text boxes in the older UI won't start eating clicks. - if (isClickable() && hasMouseCapture()) + if (getSoundFlags() & MOUSE_UP) { - handled = TRUE; + make_ui_sound("UISndClickRelease"); + } + // We only handle the click if the click both started and ended within us + if (hasMouseCapture()) + { // Release the mouse gFocusMgr.setMouseCapture( NULL ); - if (getSoundFlags() & MOUSE_UP) - { - make_ui_sound("UISndClickRelease"); - } - - // handle clicks on Urls in the textbox first - handled = LLTextBase::handleMouseUp(x, y, mask); - - // DO THIS AT THE VERY END to allow the button to be destroyed + // DO THIS AT THE VERY END to allow the button to be destroyed // as a result of being clicked. If mouseup in the widget, // it's been clicked if (mClickedCallback && !handled) { mClickedCallback(); + handled = TRUE; } } + else + { + handled = LLTextBase::handleMouseUp(x, y, mask); + } return handled; } @@ -149,30 +139,3 @@ void LLTextBox::onUrlLabelUpdated(const std::string &url, const std::string &lab needsReflow(); } -bool LLTextBox::isClickable() const -{ - // return true if we have been given a click callback - if (mClickedCallback) - { - return true; - } - - // also return true if we have a clickable Url in the text - segment_set_t::const_iterator it; - for (it = mSegments.begin(); it != mSegments.end(); ++it) - { - LLTextSegmentPtr segmentp = *it; - if (segmentp) - { - const LLStyleSP style = segmentp->getStyle(); - if (style && style->isLink()) - { - return true; - } - } - } - - // otherwise there is nothing clickable here - return false; -} - |