add optional style params in setText function

meow-7.2.2
angela 2009-11-12 21:17:31 +08:00
parent d1f8328b1e
commit b1a81afef6
10 changed files with 15 additions and 15 deletions

View File

@ -1445,7 +1445,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url)
}
}
void LLTextBase::setText(const LLStringExplicit &utf8str)
void LLTextBase::setText(const LLStringExplicit &utf8str ,const LLStyle::Params& input_params)
{
// clear out the existing text and segments
getViewModel()->setDisplay(LLWStringUtil::null);
@ -1460,7 +1460,7 @@ void LLTextBase::setText(const LLStringExplicit &utf8str)
std::string text(utf8str);
LLStringUtil::removeCRLF(text);
appendText(text, false);
appendText(text, false, input_params);
onValueChange(0, getLength());
}

View File

@ -135,7 +135,7 @@ public:
// Text accessors
// TODO: add optional style parameter
virtual void setText(const LLStringExplicit &utf8str); // uses default style
virtual void setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style
virtual std::string getText() const;
// wide-char versions

View File

@ -112,12 +112,12 @@ BOOL LLTextBox::handleHover(S32 x, S32 y, MASK mask)
return handled;
}
void LLTextBox::setText(const LLStringExplicit& text)
void LLTextBox::setText(const LLStringExplicit& text , const LLStyle::Params& input_params )
{
// does string argument insertion
mText.assign(text);
LLTextBase::setText(mText.getString());
LLTextBase::setText(mText.getString(), input_params );
}
void LLTextBox::setClickedCallback( boost::function<void (void*)> cb, void* userdata /*= NULL */ )

View File

@ -58,7 +58,7 @@ public:
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
/*virtual*/ void setText( const LLStringExplicit& text );
/*virtual*/ void setText( const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params() );
void setRightAlign() { mHAlign = LLFontGL::RIGHT; }
void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }

View File

@ -311,12 +311,12 @@ LLTextEditor::~LLTextEditor()
// LLTextEditor
// Public methods
void LLTextEditor::setText(const LLStringExplicit &utf8str)
void LLTextEditor::setText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params)
{
blockUndo();
deselect();
LLTextBase::setText(utf8str);
LLTextBase::setText(utf8str, input_params);
resetDirty();
}

View File

@ -168,7 +168,7 @@ public:
void appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
// Non-undoable
void setText(const LLStringExplicit &utf8str);
void setText(const LLStringExplicit &utf8str, const LLStyle::Params& input_params = LLStyle::Params());
// Removes text from the end of document

View File

@ -84,7 +84,7 @@ LLChatMsgBox::LLChatMsgBox(const Params& p) :
mBlockSpacing(p.block_spacing)
{}
void LLChatMsgBox::addText( const LLStringExplicit& text )
void LLChatMsgBox::addText( const LLStringExplicit& text , const LLStyle::Params& input_params )
{
S32 length = getLength();
// if there is existing text, add a separator
@ -94,5 +94,5 @@ void LLChatMsgBox::addText( const LLStringExplicit& text )
insertSegment(new ChatSeparator(length - 1, length - 1));
}
// prepend newline only if there is some existing text
appendText(text, length > 0);
appendText(text, length > 0, input_params);
}

View File

@ -61,7 +61,7 @@ protected:
friend class LLUICtrlFactory;
public:
void addText(const LLStringExplicit &text);
void addText(const LLStringExplicit &text, const LLStyle::Params& input_params = LLStyle::Params());
private:
S32 mBlockSpacing;

View File

@ -129,12 +129,12 @@ void LLExpandableTextBox::LLTextBoxEx::reshape(S32 width, S32 height, BOOL calle
}
}
void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text)
void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text,const LLStyle::Params& input_params)
{
// LLTextBox::setText will obliterate the expander segment, so make sure
// we generate it again by clearing mExpanderVisible
mExpanderVisible = false;
LLTextBox::setText(text);
LLTextBox::setText(text, input_params);
// text contents have changed, segments are cleared out
// so hide the expander and determine if we need it

View File

@ -60,7 +60,7 @@ protected:
// adds or removes "More" link as needed
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
/*virtual*/ void setText(const LLStringExplicit& text);
/*virtual*/ void setText(const LLStringExplicit& text, const LLStyle::Params& input_params = LLStyle::Params());
/**
* Returns difference between text box height and text height.