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;

	// Workaround for EXT-8259: trim text before rendering it.
	{
		std::string trimmed_text(text);
		LLStringUtil::trim(trimmed_text);
		LLTextEditor::setText(trimmed_text, input_params);
	}

	// text contents have changed, segments are cleared out
	// so hide the expander and determine if we need it
	//mExpanderVisible = false;
	if (getTextPixelHeight() > getRect().getHeight())
	{
		showExpandText();
	}
	else
	{
		hideExpandText();
	}
}
S32 LLExpandableTextBox::LLTextBoxEx::getVerticalTextDelta()
{
	S32 text_height = getTextPixelHeight();
	S32 textbox_height = getRect().getHeight();

	return text_height - textbox_height;
}
Beispiel #3
0
void LLTextBox::reshapeToFitText()
{
	reflow();

	S32 width = getTextPixelWidth();
	S32 height = getTextPixelHeight();
	reshape( width + 2 * mHPad, height + 2 * mVPad, FALSE );
}
void LLExpandableTextBox::LLTextBoxEx::reshape(S32 width, S32 height, BOOL called_from_parent)
{
	hideExpandText();
	LLTextEditor::reshape(width, height, called_from_parent);

	if (getTextPixelHeight() > getRect().getHeight())
	{
		showExpandText();
	}
}
void LLExpandableTextBox::LLTextBoxEx::hideOrShowExpandTextAsNeeded()
{
	// Restore the text box contents to calculate the text height properly,
	// otherwise if a part of the text is hidden under "More" link
	// getTextPixelHeight() returns only the height of currently visible text
	// including the "More" link. See STORM-250.
	hideExpandText();

	// Show the expander a.k.a. "More" link if we need it, depending on text
	// contents height. If not, keep it hidden.
	if (getTextPixelHeight() > getRect().getHeight())
	{
		showExpandText();
	}
}