コード例 #1
0
void LLToastScriptQuestion::snapToMessageHeight()
{
	LLTextBox* mMessage = getChild<LLTextBox>("top_info_message");
	LLTextBox* mFooter = getChild<LLTextBox>("bottom_info_message");
	if (!mMessage || !mFooter)
	{
		return;
	}

	if (mMessage->getVisible() && mFooter->getVisible())
	{
		S32 heightDelta = 0;
		S32 maxTextHeight = (mMessage->getDefaultFont()->getLineHeight() * MAX_LINES_COUNT)
						  + (mFooter->getDefaultFont()->getLineHeight() * MAX_LINES_COUNT);

		LLRect messageRect = mMessage->getRect();
		LLRect footerRect  = mFooter->getRect();

		S32 oldTextHeight = messageRect.getHeight() + footerRect.getHeight();

		S32 requiredTextHeight = mMessage->getTextBoundingRect().getHeight() + mFooter->getTextBoundingRect().getHeight();
		S32 newTextHeight = llmin(requiredTextHeight, maxTextHeight);

		heightDelta = newTextHeight - oldTextHeight - heightDelta;

		reshape( getRect().getWidth(), llmax(getRect().getHeight() + heightDelta, MIN_PANEL_HEIGHT));
	}
}
コード例 #2
0
	void showInfoCtrl()
	{
		if (mAvatarID.isNull() || mFrom.empty() || SYSTEM_FROM == mFrom) return;
				
		if (!sInfoCtrl)
		{
			// *TODO: Delete the button at exit.
			sInfoCtrl = LLUICtrlFactory::createFromFile<LLUICtrl>("inspector_info_ctrl.xml", NULL, LLPanel::child_registry_t::instance());
			if (sInfoCtrl)
			{
				sInfoCtrl->setCommitCallback(boost::bind(&LLChatHistoryHeader::onClickInfoCtrl, sInfoCtrl));
			}
		}

		if (!sInfoCtrl)
		{
			llassert(sInfoCtrl != NULL);
			return;
		}

		LLTextBox* name = getChild<LLTextBox>("user_name");
		LLRect sticky_rect = name->getRect();
		S32 icon_x = llmin(sticky_rect.mLeft + name->getTextBoundingRect().getWidth() + 7, sticky_rect.mRight - 3);
		sInfoCtrl->setOrigin(icon_x, sticky_rect.getCenterY() - sInfoCtrl->getRect().getHeight() / 2 ) ;
		addChild(sInfoCtrl);
	}