diff options
author | Monroe Linden <monroe@lindenlab.com> | 2010-07-15 16:32:50 -0700 |
---|---|---|
committer | Monroe Linden <monroe@lindenlab.com> | 2010-07-15 16:32:50 -0700 |
commit | 551f74125bacfe8353a4b13692d2fdb0cc29958b (patch) | |
tree | dd88ed62b786f891ad48d4302b4fdb3fea4fdf19 | |
parent | 39f241aad283d2f051ae7f093bbd650f16486df0 (diff) |
Changes to allow disabling an LLTextBox (or LLTextBox subclass) to gray out the text.
Due to some legacy issues, text boxes will not gray out on disable unless they have their text_readonly_color property in xui set to "LabelDisabledColor" (or some other color distinct from their text color).
Reviewed by Richard.
-rw-r--r-- | indra/llui/lltextbase.cpp | 3 | ||||
-rw-r--r-- | indra/llui/lltextbox.cpp | 11 | ||||
-rw-r--r-- | indra/llui/lltextbox.h | 2 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/text.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/text_editor.xml | 1 |
6 files changed, 18 insertions, 4 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index ed03645944..5175583dc9 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -269,9 +269,6 @@ void LLTextBase::initFromParams(const LLTextBase::Params& p) { mReadOnly = p.read_only; } - - // HACK: text editors always need to be enabled so that we can scroll - LLView::setEnabled(true); } bool LLTextBase::truncate() diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index a1f5b5726b..686179b94e 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -119,6 +119,17 @@ BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask) 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(); + } +} + void LLTextBox::setText(const LLStringExplicit& text , const LLStyle::Params& input_params ) { // does string argument insertion diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index 3a045534d3..b2ccde94c6 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -58,6 +58,8 @@ public: /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); + /*virtual*/ void setEnabled(BOOL enabled); + /*virtual*/ void setText( const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params() ); void setRightAlign() { mHAlign = LLFontGL::RIGHT; } diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 130cda3784..6781c23416 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -289,6 +289,9 @@ void LLTextEditor::initFromParams( const LLTextEditor::Params& p) { LLTextBase::initFromParams(p); + // HACK: text editors always need to be enabled so that we can scroll + LLView::setEnabled(true); + if (p.commit_on_focus_lost.isProvided()) { mCommitOnFocusLost = p.commit_on_focus_lost; diff --git a/indra/newview/skins/default/xui/en/widgets/text.xml b/indra/newview/skins/default/xui/en/widgets/text.xml index 3006df22b8..3fa3f3eb90 100644 --- a/indra/newview/skins/default/xui/en/widgets/text.xml +++ b/indra/newview/skins/default/xui/en/widgets/text.xml @@ -8,7 +8,7 @@ halign="left" h_pad="0" allow_scroll="false" - text_readonly_color="LabelDisabledColor" + text_readonly_color="LabelTextColor" bg_writeable_color="FloaterDefaultBackgroundColor" use_ellipses="false" bg_visible="false" diff --git a/indra/newview/skins/default/xui/en/widgets/text_editor.xml b/indra/newview/skins/default/xui/en/widgets/text_editor.xml index 2ced8b1b4b..af2e17fc3f 100644 --- a/indra/newview/skins/default/xui/en/widgets/text_editor.xml +++ b/indra/newview/skins/default/xui/en/widgets/text_editor.xml @@ -2,4 +2,5 @@ <!-- Core parameters are in simple_text_editor.xml --> <text_editor allow_html="false" + text_readonly_color="LabelDisabledColor" show_context_menu="true"/> |