summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbox.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-05-15 16:15:46 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-05-15 16:15:46 -0400
commit1b5f0590ce45ce6e540d266a8902af5839885cfb (patch)
treef923407fc28fb2f046ac451976a02490ab15787e /indra/llui/lltextbox.cpp
parentf822193974af363fa4bb0208dc02848be6c983a2 (diff)
parente7eced3c87310b15ac20cc3cd470d67686104a14 (diff)
Merge commit 'e7eced3' into nat/releaseos for whitespace fix.
Diffstat (limited to 'indra/llui/lltextbox.cpp')
-rw-r--r--indra/llui/lltextbox.cpp162
1 files changed, 81 insertions, 81 deletions
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 521dabf9d4..ba756a2906 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -1,25 +1,25 @@
-/**
+/**
* @file lltextbox.cpp
* @brief A text display widget
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,14 +39,14 @@ static LLDefaultChildRegistry::Register<LLTextBox> r("text");
// Compiler optimization, generate extern template
template class LLTextBox* LLView::getChild<class LLTextBox>(
- const std::string& name, BOOL recurse) const;
+ const std::string& name, BOOL recurse) const;
LLTextBox::LLTextBox(const LLTextBox::Params& p)
-: LLTextBase(p),
- mClickedCallback(NULL),
- mShowCursorHand(true)
+: LLTextBase(p),
+ mClickedCallback(NULL),
+ mShowCursorHand(true)
{
- mSkipTripleClick = true;
+ mSkipTripleClick = true;
}
LLTextBox::~LLTextBox()
@@ -54,130 +54,130 @@ LLTextBox::~LLTextBox()
BOOL LLTextBox::handleMouseDown(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLTextBase::handleMouseDown(x, y, mask);
+ BOOL handled = LLTextBase::handleMouseDown(x, y, mask);
- if (getSoundFlags() & MOUSE_DOWN)
- {
- make_ui_sound("UISndClick");
- }
+ if (getSoundFlags() & MOUSE_DOWN)
+ {
+ make_ui_sound("UISndClick");
+ }
- if (!handled && mClickedCallback)
- {
- handled = TRUE;
- }
+ if (!handled && mClickedCallback)
+ {
+ handled = TRUE;
+ }
- if (handled)
- {
- // Route future Mouse messages here preemptively. (Release on mouse up.)
- gFocusMgr.setMouseCapture( this );
- }
+ if (handled)
+ {
+ // Route future Mouse messages here preemptively. (Release on mouse up.)
+ gFocusMgr.setMouseCapture( this );
+ }
- return handled;
+ return handled;
}
BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLTextBase::handleMouseUp(x, y, mask);
-
- if (getSoundFlags() & MOUSE_UP)
- {
- 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 );
-
- // 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;
- }
- }
-
- return handled;
+ BOOL handled = LLTextBase::handleMouseUp(x, y, mask);
+
+ if (getSoundFlags() & MOUSE_UP)
+ {
+ 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 );
+
+ // 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;
+ }
+ }
+
+ return handled;
}
BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask)
{
- BOOL handled = LLTextBase::handleHover(x, y, mask);
- if (!handled && mClickedCallback && mShowCursorHand)
- {
- // Clickable text boxes change the cursor to a hand
- LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
- return TRUE;
- }
- return handled;
+ BOOL handled = LLTextBase::handleHover(x, y, mask);
+ if (!handled && mClickedCallback && mShowCursorHand)
+ {
+ // Clickable text boxes change the cursor to a hand
+ LLUI::getInstance()->getWindow()->setCursor(UI_CURSOR_HAND);
+ return TRUE;
+ }
+ return handled;
}
void LLTextBox::setEnabled(BOOL enabled)
{
- // just treat enabled as read-only flag
- bool read_only = !enabled;
- if (read_only != mReadOnly)
- {
- LLTextBase::setReadOnly(read_only);
- updateSegments();
- }
- LLTextBase::setEnabled(enabled);
+ // just treat enabled as read-only flag
+ bool read_only = !enabled;
+ if (read_only != mReadOnly)
+ {
+ LLTextBase::setReadOnly(read_only);
+ updateSegments();
+ }
+ LLTextBase::setEnabled(enabled);
}
void LLTextBox::setText(const LLStringExplicit& text , const LLStyle::Params& input_params )
{
- // does string argument insertion
- mText.assign(text);
-
- LLTextBase::setText(mText.getString(), input_params );
+ // does string argument insertion
+ mText.assign(text);
+
+ LLTextBase::setText(mText.getString(), input_params );
}
void LLTextBox::setClickedCallback( boost::function<void (void*)> cb, void* userdata /*= NULL */ )
{
- mClickedCallback = boost::bind(cb, userdata);
+ mClickedCallback = boost::bind(cb, userdata);
}
S32 LLTextBox::getTextPixelWidth()
{
- return getTextBoundingRect().getWidth();
+ return getTextBoundingRect().getWidth();
}
S32 LLTextBox::getTextPixelHeight()
{
- return getTextBoundingRect().getHeight();
+ return getTextBoundingRect().getHeight();
}
LLSD LLTextBox::getValue() const
{
- return getViewModel()->getValue();
+ return getViewModel()->getValue();
}
BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text )
{
- mText.setArg(key, text);
- LLTextBase::setText(mText.getString());
+ mText.setArg(key, text);
+ LLTextBase::setText(mText.getString());
- return TRUE;
+ return TRUE;
}
void LLTextBox::reshapeToFitText(BOOL called_from_parent)
{
- reflow();
+ reflow();
- S32 width = getTextPixelWidth();
- S32 height = getTextPixelHeight();
+ S32 width = getTextPixelWidth();
+ S32 height = getTextPixelHeight();
//consider investigating reflow() to find missing width pixel (see SL-17045 changes)
- reshape( width + 2 * mHPad + 1, height + 2 * mVPad, called_from_parent );
+ reshape( width + 2 * mHPad + 1, height + 2 * mVPad, called_from_parent );
}
void LLTextBox::onUrlLabelUpdated(const std::string &url, const std::string &label)
{
- needsReflow();
+ needsReflow();
}