void GUIButtonBase::_setState(GUIElementState state)
	{
		Vector2I origSize = mDimensions.calculateSizeRange(_getOptimalSize()).optimal;
		mActiveState = state;
		refreshContentSprite();
		Vector2I newSize = mDimensions.calculateSizeRange(_getOptimalSize()).optimal;

		if (origSize != newSize)
			_markLayoutAsDirty();
		else
			_markContentAsDirty();
	}
	void GUIButtonBase::setContent(const GUIContent& content)
	{
		Vector2I origSize = mDimensions.calculateSizeRange(_getOptimalSize()).optimal;
		mContent = content;

		refreshContentSprite();

		Vector2I newSize = mDimensions.calculateSizeRange(_getOptimalSize()).optimal;

		if (origSize != newSize)
			_markLayoutAsDirty();
		else
			_markContentAsDirty();
	}
	void GUIWindowFrame::setFocused(bool focused)
	{
		Vector2I origSize = mDimensions.calculateSizeRange(_getOptimalSize()).optimal;

		if(focused)
			mActiveTexture = _getStyle()->focused.texture;
		else
			mActiveTexture = _getStyle()->normal.texture;

		Vector2I newSize = mDimensions.calculateSizeRange(_getOptimalSize()).optimal;

		if (origSize != newSize)
			_markLayoutAsDirty();
		else
			_markContentAsDirty();
	}
Example #4
0
	LayoutSizeRange GUIScrollArea::_calculateLayoutSizeRange() const
	{
		// I'm ignoring scroll bars here since if the content layout fits
		// then they're not needed and the range is valid. And if it doesn't
		// fit the area will get clipped anyway and including the scroll bars
		// won't change the size much, but it would complicate this method significantly.
		if (mContentLayout->_isActive())
			return mDimensions.calculateSizeRange(_getOptimalSize());

		return mDimensions.calculateSizeRange(Vector2I());
	}
Example #5
0
	void GUIScrollArea::_updateOptimalLayoutSizes()
	{
		// Update all children first, otherwise we can't determine our own optimal size
		GUIElementBase::_updateOptimalLayoutSizes();

		if (mChildren.size() != mChildSizeRanges.size())
			mChildSizeRanges.resize(mChildren.size());

		UINT32 childIdx = 0;
		for (auto& child : mChildren)
		{
			if (child->_isActive())
				mChildSizeRanges[childIdx] = child->_getLayoutSizeRange();
			else
				mChildSizeRanges[childIdx] = LayoutSizeRange();

			childIdx++;
		}

		mSizeRange = mDimensions.calculateSizeRange(_getOptimalSize());
	}
Example #6
0
LayoutSizeRange GUIElementBase::_calculateLayoutSizeRange() const
{
    const GUIDimensions& dimensions = _getDimensions();
    return dimensions.calculateSizeRange(_getOptimalSize());
}