Browse Source

Horizontal scroll is operational

Marko Pintera 12 years ago
parent
commit
c817f10045

+ 2 - 2
BansheeEngine/Include/BsGUIElementBase.h

@@ -29,10 +29,10 @@ namespace BansheeEngine
 		/**
 		/**
 		 * @brief	Re-arranges the elements to fit the layout. (Internal use only)
 		 * @brief	Re-arranges the elements to fit the layout. (Internal use only)
 		 */
 		 */
-		virtual void _updateLayout(CM::UINT32 x, CM::UINT32 y, CM::UINT32 width, CM::UINT32 height, 
+		virtual void _updateLayout(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height, 
 			CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 			CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 		virtual void _updateOptimalLayoutSizes();
 		virtual void _updateOptimalLayoutSizes();
-		virtual void _updateLayoutInternal(CM::UINT32 x, CM::UINT32 y, CM::UINT32 width, CM::UINT32 height,
+		virtual void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
 			CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 			CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 
 
 		virtual CM::UINT32 _getOptimalWidth() const = 0;
 		virtual CM::UINT32 _getOptimalWidth() const = 0;

+ 1 - 1
BansheeEngine/Include/BsGUILayoutX.h

@@ -13,6 +13,6 @@ namespace BansheeEngine
 
 
 		void _updateOptimalLayoutSizes();
 		void _updateOptimalLayoutSizes();
 	protected:
 	protected:
-		void _updateLayoutInternal(CM::UINT32 x, CM::UINT32 y, CM::UINT32 width, CM::UINT32 height, CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
+		void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height, CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 	};
 	};
 }
 }

+ 1 - 1
BansheeEngine/Include/BsGUILayoutY.h

@@ -13,6 +13,6 @@ namespace BansheeEngine
 
 
 		void _updateOptimalLayoutSizes();
 		void _updateOptimalLayoutSizes();
 	protected:
 	protected:
-		void _updateLayoutInternal(CM::UINT32 x, CM::UINT32 y, CM::UINT32 width, CM::UINT32 height, CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
+		void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height, CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 	};
 	};
 }
 }

+ 1 - 1
BansheeEngine/Include/BsGUIScrollArea.h

@@ -63,7 +63,7 @@ namespace BansheeEngine
 
 
 		void vertScrollUpdate(float pct);
 		void vertScrollUpdate(float pct);
 		void horzScrollUpdate(float pct);
 		void horzScrollUpdate(float pct);
-		void _updateLayoutInternal(CM::UINT32 x, CM::UINT32 y, CM::UINT32 width, CM::UINT32 height,
+		void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
 			CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 			CM::Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
 	};
 	};
 }
 }

+ 0 - 6
BansheeEngine/Include/BsGUIScrollBar.h

@@ -15,12 +15,6 @@ namespace BansheeEngine
 		void setHandleSize(CM::UINT32 size);
 		void setHandleSize(CM::UINT32 size);
 		void setScrollPos(float pct);
 		void setScrollPos(float pct);
 
 
-		/**
-		 * @brief	Sets a page size that is used for determining how far to jump
-		 * 			when clicking on the scrollbar empty space.
-		 */
-		void setPageSize(CM::UINT32 size);
-
 		CM::UINT32 getMaxHandleSize() const;
 		CM::UINT32 getMaxHandleSize() const;
 		CM::UINT32 getScrollableSize() const;
 		CM::UINT32 getScrollableSize() const;
 	protected:
 	protected:

+ 0 - 4
BansheeEngine/Include/BsGUIScrollBarHandle.h

@@ -18,7 +18,6 @@ namespace BansheeEngine
 
 
 		void setHandleSize(CM::UINT32 size);
 		void setHandleSize(CM::UINT32 size);
 		void setHandlePos(float pct);
 		void setHandlePos(float pct);
-		void setPageSize(CM::UINT32 size);
 
 
 		CM::UINT32 getScrollableSize() const;
 		CM::UINT32 getScrollableSize() const;
 		float getHandlePos() const;
 		float getHandlePos() const;
@@ -66,9 +65,6 @@ namespace BansheeEngine
 		CM::INT32 mDragStartPos;
 		CM::INT32 mDragStartPos;
 		bool mMouseOverHandle;
 		bool mMouseOverHandle;
 		bool mHandleDragged;
 		bool mHandleDragged;
-		CM::UINT32 mPageSize;
-
-		static const CM::UINT32 DefaultPageScrollAmount;
 
 
 		GUIScrollBarHandle(GUIWidget& parent, bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
 		GUIScrollBarHandle(GUIWidget& parent, bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions);
 
 

+ 1 - 1
BansheeEngine/Source/BsEngineGUI.cpp

@@ -134,7 +134,7 @@ namespace BansheeEngine
 		buttonStyle.contentOffset.right = 2;
 		buttonStyle.contentOffset.right = 2;
 		buttonStyle.fixedHeight = true;
 		buttonStyle.fixedHeight = true;
 		buttonStyle.height = 21;
 		buttonStyle.height = 21;
-		buttonStyle.minWidth = 10;
+		buttonStyle.minWidth = 50;
 		buttonStyle.font = font;
 		buttonStyle.font = font;
 		buttonStyle.fontSize = DefaultFontSize;
 		buttonStyle.fontSize = DefaultFontSize;
 		buttonStyle.textHorzAlign = THA_Center;
 		buttonStyle.textHorzAlign = THA_Center;

+ 2 - 2
BansheeEngine/Source/BsGUIElementBase.cpp

@@ -59,7 +59,7 @@ namespace BansheeEngine
 		mIsDirty |= 0x02;
 		mIsDirty |= 0x02;
 	}
 	}
 
 
-	void GUIElementBase::_updateLayout(UINT32 x, UINT32 y, UINT32 width, UINT32 height, Rect clipRect, UINT8 widgetDepth, UINT16 areaDepth)
+	void GUIElementBase::_updateLayout(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect clipRect, UINT8 widgetDepth, UINT16 areaDepth)
 	{
 	{
 		_updateOptimalLayoutSizes(); // We calculate optimal sizes of all layouts as a pre-processing step, as they are requested often during update
 		_updateOptimalLayoutSizes(); // We calculate optimal sizes of all layouts as a pre-processing step, as they are requested often during update
 		_updateLayoutInternal(x, y, width, height, clipRect, widgetDepth, areaDepth);
 		_updateLayoutInternal(x, y, width, height, clipRect, widgetDepth, areaDepth);
@@ -73,7 +73,7 @@ namespace BansheeEngine
 		}
 		}
 	}
 	}
 
 
-	void GUIElementBase::_updateLayoutInternal(CM::UINT32 x, CM::UINT32 y, CM::UINT32 width, CM::UINT32 height, Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth)
+	void GUIElementBase::_updateLayoutInternal(INT32 x, INT32 y, CM::UINT32 width, CM::UINT32 height, Rect clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth)
 	{
 	{
 		for(auto& child : mChildren)
 		for(auto& child : mChildren)
 		{
 		{

+ 2 - 1
BansheeEngine/Source/BsGUILayoutX.cpp

@@ -78,7 +78,7 @@ namespace BansheeEngine
 		}
 		}
 	}
 	}
 
 
-	void GUILayoutX::_updateLayoutInternal(UINT32 x, UINT32 y, UINT32 width, UINT32 height, Rect clipRect, UINT8 widgetDepth, UINT16 areaDepth)
+	void GUILayoutX::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect clipRect, UINT8 widgetDepth, UINT16 areaDepth)
 	{
 	{
 		UINT32 totalOptimalSize = _getOptimalWidth();
 		UINT32 totalOptimalSize = _getOptimalWidth();
 		UINT32 totalNonClampedSize = 0;
 		UINT32 totalNonClampedSize = 0;
@@ -374,6 +374,7 @@ namespace BansheeEngine
 				GUILayout* layout = static_cast<GUILayout*>(child);
 				GUILayout* layout = static_cast<GUILayout*>(child);
 
 
 				Rect newClipRect(x + xOffset, y, elemWidth, height);
 				Rect newClipRect(x + xOffset, y, elemWidth, height);
+				newClipRect.clip(clipRect);
 				layout->_updateLayoutInternal(x + xOffset, y, elemWidth, height, newClipRect, widgetDepth, areaDepth);
 				layout->_updateLayoutInternal(x + xOffset, y, elemWidth, height, newClipRect, widgetDepth, areaDepth);
 
 
 				UINT32 childHeight = layout->_getActualHeight();
 				UINT32 childHeight = layout->_getActualHeight();

+ 2 - 1
BansheeEngine/Source/BsGUILayoutY.cpp

@@ -79,7 +79,7 @@ namespace BansheeEngine
 		}
 		}
 	}
 	}
 
 
-	void GUILayoutY::_updateLayoutInternal(UINT32 x, UINT32 y, UINT32 width, UINT32 height, Rect clipRect, UINT8 widgetDepth, UINT16 areaDepth)
+	void GUILayoutY::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height, Rect clipRect, UINT8 widgetDepth, UINT16 areaDepth)
 	{
 	{
 		UINT32 totalOptimalSize = _getOptimalHeight();
 		UINT32 totalOptimalSize = _getOptimalHeight();
 		UINT32 totalNonClampedSize = 0;
 		UINT32 totalNonClampedSize = 0;
@@ -374,6 +374,7 @@ namespace BansheeEngine
 				GUILayout* layout = static_cast<GUILayout*>(child);
 				GUILayout* layout = static_cast<GUILayout*>(child);
 
 
 				Rect newClipRect(x, y + yOffset, width, elemHeight);
 				Rect newClipRect(x, y + yOffset, width, elemHeight);
+				newClipRect.clip(clipRect);
 				layout->_updateLayoutInternal(x, y + yOffset, width, elemHeight, newClipRect, widgetDepth, areaDepth);
 				layout->_updateLayoutInternal(x, y + yOffset, width, elemHeight, newClipRect, widgetDepth, areaDepth);
 
 
 				UINT32 childWidth = layout->_getActualWidth();
 				UINT32 childWidth = layout->_getActualWidth();

+ 53 - 4
BansheeEngine/Source/BsGUIScrollArea.cpp

@@ -60,20 +60,21 @@ namespace BansheeEngine
 		UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const
 		UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const
 	{ }
 	{ }
 
 
-	void GUIScrollArea::_updateLayoutInternal(UINT32 x, UINT32 y, UINT32 width, UINT32 height,
+	void GUIScrollArea::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
 		Rect clipRect, UINT8 widgetDepth, UINT16 areaDepth)
 		Rect clipRect, UINT8 widgetDepth, UINT16 areaDepth)
 	{
 	{
 		mContentLayout->_updateLayoutInternal(x, y, width, height, clipRect, widgetDepth, areaDepth);
 		mContentLayout->_updateLayoutInternal(x, y, width, height, clipRect, widgetDepth, areaDepth);
 		UINT32 contentWidth = mContentLayout->_getActualWidth();
 		UINT32 contentWidth = mContentLayout->_getActualWidth();
 		UINT32 contentHeight = mContentLayout->_getActualHeight();
 		UINT32 contentHeight = mContentLayout->_getActualHeight();
 
 
+		// Add/remove/update vertical scrollbar as needed
 		if(contentHeight > mHeight)
 		if(contentHeight > mHeight)
 		{
 		{
 			// Make room for scrollbar
 			// Make room for scrollbar
 			UINT32 contentWidth = (UINT32)std::max(0, (INT32)width - (INT32)ScrollBarWidth);
 			UINT32 contentWidth = (UINT32)std::max(0, (INT32)width - (INT32)ScrollBarWidth);
 
 
 			Rect layoutClipRect(clipRect.x, clipRect.y, contentWidth, clipRect.height);
 			Rect layoutClipRect(clipRect.x, clipRect.y, contentWidth, clipRect.height);
-			mContentLayout->_updateLayoutInternal(x, y - mVertOffset, contentWidth, height, layoutClipRect, widgetDepth, areaDepth);
+			mContentLayout->_updateLayoutInternal(x, y - mVertOffset, contentWidth, height + mVertOffset, layoutClipRect, widgetDepth, areaDepth);
 			contentWidth = mContentLayout->_getActualWidth();
 			contentWidth = mContentLayout->_getActualWidth();
 			contentHeight = mContentLayout->_getActualHeight();
 			contentHeight = mContentLayout->_getActualHeight();
 
 
@@ -107,7 +108,6 @@ namespace BansheeEngine
 
 
 			mVertScroll->setHandleSize(newHandleSize);
 			mVertScroll->setHandleSize(newHandleSize);
 			mVertScroll->setScrollPos(newScrollPct);
 			mVertScroll->setScrollPos(newScrollPct);
-			mVertScroll->setPageSize(mHeight);
 		}
 		}
 		else
 		else
 		{
 		{
@@ -118,7 +118,56 @@ namespace BansheeEngine
 			}
 			}
 		}
 		}
 
 
-		// TODO - Add horizontal scroll bar
+		// Add/remove/update horizontal scrollbar as needed
+		if(contentWidth > mWidth)
+		{
+			// Make room for scrollbar
+			UINT32 contentHeight = (UINT32)std::max(0, (INT32)height - (INT32)ScrollBarWidth);
+
+			Rect layoutClipRect(clipRect.x, clipRect.y, clipRect.width, contentHeight);
+			mContentLayout->_updateLayoutInternal(x - mHorzOffset, y, width + mHorzOffset, contentHeight, layoutClipRect, widgetDepth, areaDepth);
+			contentWidth = mContentLayout->_getActualWidth();
+			contentHeight = mContentLayout->_getActualHeight();
+
+			if(mHorzScroll == nullptr)
+			{
+				mHorzScroll = GUIScrollBarHorz::create(_getParentWidget());
+				mHorzScroll->onScrollPositionChanged.connect(boost::bind(&GUIScrollArea::horzScrollUpdate, this, _1));
+			}
+
+			Int2 offset(x, y + contentHeight);
+			mHorzScroll->_setOffset(offset);
+			mHorzScroll->_setWidth(width);
+			mHorzScroll->_setHeight(ScrollBarWidth);
+			mHorzScroll->_setAreaDepth(areaDepth);
+			mHorzScroll->_setWidgetDepth(widgetDepth);
+
+			UINT32 clippedScrollbarHeight = std::min(height, ScrollBarWidth);
+			Rect elemClipRect(0, 0, clipRect.width, clippedScrollbarHeight);
+			mHorzScroll->_setClipRect(elemClipRect);
+
+			// This element is not a child of any layout so we treat it as a root element
+			Rect scrollBarLayoutClipRect(clipRect.x, clipRect.y + contentHeight, clipRect.width, clippedScrollbarHeight);
+			mHorzScroll->_updateLayout(offset.x, offset.y, width, ScrollBarWidth, scrollBarLayoutClipRect, widgetDepth, areaDepth);
+
+			// Set new handle size and update position to match the new size
+			UINT32 newHandleSize = (UINT32)Math::FloorToInt(mHorzScroll->getMaxHandleSize() * (mWidth / (float)contentWidth));
+			newHandleSize = std::max(newHandleSize, MinHandleSize);
+
+			UINT32 scrollableWidth = (UINT32)std::max(0, INT32(contentWidth) - INT32(mWidth));
+			float newScrollPct = mHorzOffset / (float)scrollableWidth;
+
+			mHorzScroll->setHandleSize(newHandleSize);
+			mHorzScroll->setScrollPos(newScrollPct);
+		}
+		else
+		{
+			if(mHorzScroll != nullptr)
+			{
+				GUIElement::destroy(mHorzScroll);
+				mHorzScroll = nullptr;
+			}
+		}
 		
 		
 		mContentWidth = contentWidth;
 		mContentWidth = contentWidth;
 		mContentHeight = contentHeight;
 		mContentHeight = contentHeight;

+ 1 - 6
BansheeEngine/Source/BsGUIScrollBar.cpp

@@ -28,7 +28,7 @@ namespace BansheeEngine
 			mUpBtn = GUIButton::create(parent, L"", parent.getSkin()->getStyle("ScrollLeftBtn"));
 			mUpBtn = GUIButton::create(parent, L"", parent.getSkin()->getStyle("ScrollLeftBtn"));
 			mDownBtn = GUIButton::create(parent, L"", parent.getSkin()->getStyle("ScrollRightBtn"));
 			mDownBtn = GUIButton::create(parent, L"", parent.getSkin()->getStyle("ScrollRightBtn"));
 
 
-			mHandleBtn = GUIScrollBarHandle::create(parent, mHorizontal, GUILayoutOptions::expandableY(6), parent.getSkin()->getStyle("ScrollBarHorzBtn"));
+			mHandleBtn = GUIScrollBarHandle::create(parent, mHorizontal, GUILayoutOptions::expandableX(6), parent.getSkin()->getStyle("ScrollBarHorzBtn"));
 		}
 		}
 		else
 		else
 		{
 		{
@@ -156,9 +156,4 @@ namespace BansheeEngine
 	{
 	{
 		return mHandleBtn->getScrollableSize();
 		return mHandleBtn->getScrollableSize();
 	}
 	}
-
-	void GUIScrollBar::setPageSize(UINT32 size)
-	{
-		mHandleBtn->setPageSize(size);
-	}
 }
 }

+ 5 - 12
BansheeEngine/Source/BsGUIScrollBarHandle.cpp

@@ -12,8 +12,6 @@ using namespace CamelotFramework;
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	const UINT32 GUIScrollBarHandle::DefaultPageScrollAmount = 100;
-
 	const String& GUIScrollBarHandle::getGUITypeName()
 	const String& GUIScrollBarHandle::getGUITypeName()
 	{
 	{
 		static String name = "ScrollBarHandle";
 		static String name = "ScrollBarHandle";
@@ -22,7 +20,7 @@ namespace BansheeEngine
 
 
 	GUIScrollBarHandle::GUIScrollBarHandle(GUIWidget& parent, bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
 	GUIScrollBarHandle::GUIScrollBarHandle(GUIWidget& parent, bool horizontal, const GUIElementStyle* style, const GUILayoutOptions& layoutOptions)
 		:GUIElement(parent, style, layoutOptions), mHorizontal(horizontal), mHandleSize(2), mMouseOverHandle(false), mHandlePos(0), mDragStartPos(0),
 		:GUIElement(parent, style, layoutOptions), mHorizontal(horizontal), mHandleSize(2), mMouseOverHandle(false), mHandlePos(0), mDragStartPos(0),
-		mHandleDragged(false), mPageSize(DefaultPageScrollAmount)
+		mHandleDragged(false)
 	{
 	{
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 		mCurTexture = style->normal.texture;
 		mCurTexture = style->normal.texture;
@@ -69,11 +67,6 @@ namespace BansheeEngine
 		markContentAsDirty();
 		markContentAsDirty();
 	}
 	}
 
 
-	void GUIScrollBarHandle::setPageSize(UINT32 size)
-	{
-		mPageSize = size;
-	}
-
 	float GUIScrollBarHandle::getHandlePos() const
 	float GUIScrollBarHandle::getHandlePos() const
 	{
 	{
 		UINT32 maxScrollAmount = getMaxSize() - mHandleSize;
 		UINT32 maxScrollAmount = getMaxSize() - mHandleSize;
@@ -259,9 +252,9 @@ namespace BansheeEngine
 				INT32 handleRight = handleLeft + mHandleSize;
 				INT32 handleRight = handleLeft + mHandleSize;
 
 
 				if(ev.getPosition().x < handleLeft)
 				if(ev.getPosition().x < handleLeft)
-					handleOffset -= mPageSize;
+					handleOffset -= mHandleSize;
 				else if(ev.getPosition().x > handleRight)
 				else if(ev.getPosition().x > handleRight)
-					handleOffset += mPageSize;
+					handleOffset += mHandleSize;
 			}
 			}
 			else
 			else
 			{
 			{
@@ -269,9 +262,9 @@ namespace BansheeEngine
 				INT32 handleBottom = handleTop + mHandleSize;
 				INT32 handleBottom = handleTop + mHandleSize;
 
 
 				if(ev.getPosition().y < handleTop)
 				if(ev.getPosition().y < handleTop)
-					handleOffset -= mPageSize;
+					handleOffset -= mHandleSize;
 				else if(ev.getPosition().y > handleBottom)
 				else if(ev.getPosition().y > handleBottom)
-					handleOffset += mPageSize;
+					handleOffset += mHandleSize;
 			}
 			}
 
 
 			mHandlePos += handleOffset;
 			mHandlePos += handleOffset;

+ 16 - 14
CamelotClient/CmEditorWindow.cpp

@@ -72,24 +72,26 @@ namespace BansheeEditor
 		//mDbgLabel = GUILabel::create(*mGUI, "Testing test");
 		//mDbgLabel = GUILabel::create(*mGUI, "Testing test");
 		//layout.addElement(mDbgLabel);
 		//layout.addElement(mDbgLabel);
 
 
-		layout.addElement(GUIInputBox::create(*mGUI));
-		layout.addElement(GUIInputBox::create(*mGUI, GUILayoutOptions::fixed(100, 100), true));
+		//layout.addElement(GUIInputBox::create(*mGUI));
+		//layout.addElement(GUIInputBox::create(*mGUI, GUILayoutOptions::fixed(100, 100), true));
 
 
 		GUIScrollArea* scrollArea = GUIScrollArea::create(*mGUI);
 		GUIScrollArea* scrollArea = GUIScrollArea::create(*mGUI);
 		layout.addElement(scrollArea);
 		layout.addElement(scrollArea);
 
 
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test A"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test B"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test C"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test D"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test E"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test F"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test G"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test H"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test I"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test J"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test K"));
-		scrollArea->getLayout().addElement(GUIButton::create(*mGUI, L"Test L"));
+		GUILayout& scrollLayout = scrollArea->getLayout().addLayoutX();
+
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test A"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test B"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test C"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test D"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test E"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test F"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test G"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test H"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test I"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test J"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test K"));
+		scrollLayout.addElement(GUIButton::create(*mGUI, L"Test L"));
 
 
 
 
 		//GUIFlexibleSpace& space4 = otherLayout.addFlexibleSpace();
 		//GUIFlexibleSpace& space4 = otherLayout.addFlexibleSpace();

+ 1 - 1
CamelotUtility/Source/CmRect.cpp

@@ -69,7 +69,7 @@ namespace CamelotFramework
 		int newTop = std::max(y, clipRect.y);
 		int newTop = std::max(y, clipRect.y);
 
 
 		int newRight = std::min(x + width, clipRect.x + clipRect.width);
 		int newRight = std::min(x + width, clipRect.x + clipRect.width);
-		int newBottom = std::min(y + height, clipRect.x + clipRect.height);
+		int newBottom = std::min(y + height, clipRect.y + clipRect.height);
 
 
 		x = newLeft;
 		x = newLeft;
 		y = newTop;
 		y = newTop;

+ 0 - 2
TODO.txt

@@ -32,8 +32,6 @@ IMMEDIATE:
 
 
 - Seems the mouse-over bounds aren't right on the Tab button (I can't select it if I mouse over the bottom part)
 - Seems the mouse-over bounds aren't right on the Tab button (I can't select it if I mouse over the bottom part)
 - When clipping scrolled GUIButton the text doesn't seem to get clipped properly
 - When clipping scrolled GUIButton the text doesn't seem to get clipped properly
-- Clicking on the scroll buttons does nothing
-- Clicking on the empty scroll area doesn't do anything
 - Hover colors of the scroll bar are wrong
 - Hover colors of the scroll bar are wrong
 
 
 TextBox needed elements:
 TextBox needed elements: