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.
master
Monroe Linden 2010-07-15 16:32:50 -07:00
parent 39f241aad2
commit 551f74125b
6 changed files with 18 additions and 4 deletions

View File

@ -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()

View File

@ -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

View File

@ -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; }

View File

@ -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;

View File

@ -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"

View File

@ -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"/>