BOOL LLButton::postBuild()
{
	autoResize();

	// <FS:Zi> Add checkbox control toggle
	if(!mCheckboxControl.empty())
	{
		mCheckboxControlPanel=LLUICtrlFactory::createFromFile<LLPanel>("panel_button_checkbox.xml",this,LLDefaultChildRegistry::instance());
		if(mCheckboxControlPanel)
		{
			mCheckboxControlPanel->reshape(getRect().getWidth(),getRect().getHeight());

			LLCheckBoxCtrl* check=mCheckboxControlPanel->findChild<LLCheckBoxCtrl>("check_control");
			if(check)
			{
				check->setControlName(mCheckboxControl,NULL);
			}
			else
			{
				LL_WARNS() << "Could not find checkbox control for button " << getName() << LL_ENDL;
			}
		}
		else
		{
			LL_WARNS() << "Could not create checkbox panel for button " << getName() << LL_ENDL;
		}
	}
	// <FS:Zi>

	addBadgeToParentHolder();

	return LLUICtrl::postBuild();
}
Exemple #2
0
BOOL LLButton::postBuild()
{
	autoResize();

	addBadgeToParentHolder();

	return LLUICtrl::postBuild();
}
Exemple #3
0
void KURLLabel::setTextAlignment(TextAlignment align)
{
	m_textAlign = align;

	if (autoResize())
		adjustSize();
	else
		repaint(true);
}
Exemple #4
0
void LLButton::setToggleState(BOOL b)
{
	if( b != getToggleState() )
	{
		setControlValue(b); // will fire LLControlVariable callbacks (if any)
		setValue(b);        // may or may not be redundant
		// Unselected label assignments
		autoResize();
	}
}
void LLButton::setToggleState(BOOL b)
{
	if( b != getToggleState() )
	{
		setControlValue(b); // will fire LLControlVariable callbacks (if any)
		setValue(b);        // may or may not be redundant
		setFlashing(false);	// stop flash state whenever the selected/unselected state if reset
		// Unselected label assignments
		autoResize();
	}
}
Exemple #6
0
BOOL LLButton::postBuild()
{
	autoResize();
	return TRUE;
}
Exemple #7
0
QRect KURLLabel::m_pixmapRect() const
{
	int x_min = 0, y_min = 0;
	int text_width = 0, text_height = 0;

	/* get the text info if necessary */
	if (!m_text.isEmpty())
	{
		QFontMetrics metrics(font());
		text_height = metrics.height();
		text_width = metrics.width(m_text);
	}

	/* return now if there is no pixmap */
	if (m_pixmap.isNull())
		return QRect(0, 0, 0, 0);

	/**
	 * calculate the boundry rect for the pixmap based on its
	 * size and the current alignment
	 */
	if (alignment() & AlignHCenter)
	{
		switch (m_textAlign)
		{
			case Bottom:
			case Top:
				if (autoResize())
					x_min = m_pixmap.width() > text_width ? 
					            0 : (text_width - m_pixmap.width()) / 2;
				else
					x_min = (width() - m_pixmap.width()) / 2;
				break;
			case Left:
				if (autoResize())
					x_min = text_width;
				else
					x_min = (width() - m_pixmap.width() + text_width) / 2;
				break;
			case Right:
				if (autoResize())
					x_min = 0;
				else
					x_min = (width() - m_pixmap.width() - text_width) / 2;
				break;
		}
	}

	if (alignment() & AlignVCenter)
	{
		switch (m_textAlign)
		{
			case Bottom:
				if (autoResize())
					y_min = 0;
				else
					y_min = (height() - m_pixmap.height() - text_height) / 2;
				break;
			case Top:
				if (autoResize())
					y_min = text_height;
				else
					y_min = (height() - m_pixmap.height() + text_height) / 2;
				break;
			case Left:
			case Right:
				if (autoResize())
					y_min = 0;
				else
					y_min = (height() - m_pixmap.height()) / 2;
				break;
		}
	}

	if (alignment() & AlignLeft)
	{
		switch (m_textAlign)
		{
			case Left:
				x_min = text_width;
				break;
			case Right:
			case Top:
			case Bottom:
				x_min = 0;
		}
	}

	if (alignment() & AlignTop)
	{
		switch (m_textAlign)
		{
			case Top:
				y_min = text_height;
				break;
			case Left:
			case Right:
			case Bottom:
				y_min = 0;
				break;
		}
	}

	if (alignment() & AlignRight)
	{
		switch (m_textAlign)
		{
			case Bottom:
			case Top:
			case Left:
				x_min = width() - m_pixmap.width();
				break;
			case Right:
				x_min = width() - m_pixmap.width() - text_width;
				break;
		}
	}

	if (alignment() & AlignBottom)
	{
		switch (m_textAlign)
		{
			case Top:
			case Left:
			case Right:
				y_min = height() - m_pixmap.height();
				break;
			case Bottom:
				y_min = height() - m_pixmap.height() - text_height;
				break;
		}
	}

	/* construct the bounding rectangle */
	return QRect(x_min, y_min, m_pixmap.width(), m_pixmap.height());
}
Exemple #8
0
QRect KURLLabel::m_textRect() const
{
	int x_min = 0, y_min = 0;
	int pixmap_width = 0, pixmap_height = 0;

	/* get the pixmap info if it exists */
	if (!m_pixmap.isNull())
	{
		pixmap_height = m_pixmap.height();
		pixmap_width = m_pixmap.width();
	}

	/* return 0 if there is no text */
	if (m_text.isEmpty())
		return QRect(0, 0, 0, 0);

	/**
	 * calculate the boundry rect for the text based on the
	 * text metrics and the current alignment
	 */
	QFontMetrics fm(font());
	if (alignment() & AlignHCenter)
	{
		switch (m_textAlign)
		{
			case Bottom:
			case Top:
				if (autoResize())
					x_min = (pixmap_width > fm.width(m_text)) ? 
						         (pixmap_width - fm.width(m_text)) / 2 : 0;
				else
					x_min = (width() - fm.width(m_text)) / 2;
				break;
			case Left:
				if (autoResize())
					x_min = 0;
				else
					x_min = (width() - fm.width(m_text) - pixmap_width) / 2;
				break;
			case Right:
				if (autoResize())
					x_min = pixmap_width;
				else
					x_min = (width() - fm.width(m_text) + pixmap_width) / 2;
				break;
		}
	}

	if (alignment() & AlignVCenter)
	{
		switch (m_textAlign)
		{
			case Bottom:
				if (autoResize())
					y_min = pixmap_height;
				else
					y_min = (height() + pixmap_height - fm.height()) / 2;
				break;
			case Top:
				if (autoResize())
					y_min = 0;
				else
					y_min = ((height() - pixmap_height - fm.height()) / 2) + 3;
				break;
			case Left:
			case Right:
				y_min = (height() - fm.height()) / 2;
				break;
		}
	}

	if (alignment() & AlignLeft)
	{
		switch (m_textAlign)
		{
			case Top:
			case Bottom:
			case Left:
				x_min = 0;
				break;
			case Right:
				x_min = pixmap_width;
				break;
		}
	}	

	if (alignment() & AlignTop)
	{
		switch (m_textAlign)
		{
			case Top:
			case Left:
			case Right:
				y_min = 0;
				break;
			case Bottom:
				y_min = pixmap_height;
				break;
		}
	}

	if (alignment() & AlignRight)
	{
		switch (m_textAlign)
		{
			case Top:
			case Bottom:
			case Right:
				x_min = width() - fm.width(m_text);
				break;
			case Left:
				x_min = width() - pixmap_width - fm.width(m_text);
				break;
		}
	}

	if (alignment() & AlignBottom)
	{
		switch (m_textAlign)
		{
			case Top:
				y_min = height() - pixmap_height - fm.height();
				break;
			case Bottom:
			case Right:
			case Left:
				y_min = height() - fm.height();
				break;
		}
	}

	/* construct the bounding rectangle */
	return QRect(x_min, y_min, fm.width(m_text), fm.height());
}
Exemple #9
0
ImagePNG* ImageProcess::autoResize(const ImagePNG* img, int dim){
	return autoResize(img,dim,dim);
}