소스 검색

More documentation

Marko Pintera 11 년 전
부모
커밋
6b6ae45fae

+ 58 - 4
BansheeEngine/Include/BsGUIListBox.h

@@ -8,36 +8,90 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	List box GUI element which when active opens a drop down
+	 *			selection with provided elements.
+	 */
 	class BS_EXPORT GUIListBox : public GUIButtonBase
 	class BS_EXPORT GUIListBox : public GUIButtonBase
 	{
 	{
 	public:
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 		static const String& getGUITypeName();
 
 
+		/**
+		 * @brief	Creates a new listbox with the provided elements.
+		 *
+		 * @param	elements		Elements to display in the list box.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIListBox* create(const Vector<HString>& elements, const String& styleName = StringUtil::BLANK);
 		static GUIListBox* create(const Vector<HString>& elements, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new listbox with the provided elements.
+		 *
+		 * @param	elements		Elements to display in the list box.
+		 * @param	layoutOptions	Options that allows you to control how is the element positioned in
+		 *							GUI layout. This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIListBox* create(const Vector<HString>& elements, const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 		static GUIListBox* create(const Vector<HString>& elements, const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 
 
+		/**
+		 * @brief	Changes the list box elements.
+		 */
 		void setElements(const Vector<HString>& elements);
 		void setElements(const Vector<HString>& elements);
 
 
+		/**
+		 * @copydoc	GUIButtonBase::getElementType
+		 */
 		virtual ElementType getElementType() const { return ElementType::ListBox; }
 		virtual ElementType getElementType() const { return ElementType::ListBox; }
 
 
+		/**
+		 * @brief	Triggered whenever user selects a new element in the list box. Returned index
+		 *			maps to the element in the elements array that the list box was initialized with.
+		 */
 		Event<void(UINT32)> onSelectionChanged;
 		Event<void(UINT32)> onSelectionChanged;
 	protected:
 	protected:
 		~GUIListBox();
 		~GUIListBox();
 
 
 	private:
 	private:
-		UINT32 mSelectedIdx;
-		Vector<HString> mElements;
-		bool mIsListBoxOpen;
-
 		GUIListBox(const String& styleName, const Vector<HString>& elements, const GUILayoutOptions& layoutOptions);
 		GUIListBox(const String& styleName, const Vector<HString>& elements, const GUILayoutOptions& layoutOptions);
 
 
+		/**
+		 * @copydoc	GUIButtonBase::mouseEvent
+		 */
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 
 
+		/**
+		 * @brief	Triggered when user clicks on an element.
+		 */
 		void elementSelected(UINT32 idx);
 		void elementSelected(UINT32 idx);
 
 
+		/**
+		 * @brief	Opens the list box drop down menu.
+		 */
 		void openListBox();
 		void openListBox();
+
+		/**
+		 * @brief	Closes the list box drop down menu.
+		 */
 		void closeListBox();
 		void closeListBox();
 
 
+		/**
+		 * @brief	Called when the list box drop down menu is closed
+		 *			by external influence.
+		 */
 		void onListBoxClosed();
 		void onListBoxClosed();
+
+	private:
+		UINT32 mSelectedIdx;
+		Vector<HString> mElements;
+		bool mIsListBoxOpen;
 	};
 	};
 }
 }

+ 218 - 32
BansheeEngine/Include/BsGUIManager.h

@@ -25,9 +25,14 @@ namespace BansheeEngine
 	 *			e.g. setFocus usually gets called from within GUIElements, however we don't want elements in focus be modified immediately 
 	 *			e.g. setFocus usually gets called from within GUIElements, however we don't want elements in focus be modified immediately 
 	 *			since that setFocus call could have originated in sendCommandEvent and elements in focus array would be modified while
 	 *			since that setFocus call could have originated in sendCommandEvent and elements in focus array would be modified while
 	 *			still being iterated upon.
 	 *			still being iterated upon.
+	 *
+	 *			Internal class. Unless modifying internal engine systems you should have no need to access this class.
 	 */
 	 */
 	class BS_EXPORT GUIManager : public Module<GUIManager>
 	class BS_EXPORT GUIManager : public Module<GUIManager>
 	{
 	{
+		/**
+		 * @brief	Valid states of a drag and drop operation
+		 */
 		enum class DragState
 		enum class DragState
 		{
 		{
 			NoDrag,
 			NoDrag,
@@ -35,6 +40,9 @@ namespace BansheeEngine
 			Dragging
 			Dragging
 		};
 		};
 
 
+		/**
+		 * @brief	GUI render data for a single viewport.
+		 */
 		struct GUIRenderData
 		struct GUIRenderData
 		{
 		{
 			GUIRenderData()
 			GUIRenderData()
@@ -48,6 +56,9 @@ namespace BansheeEngine
 			bool isDirty;
 			bool isDirty;
 		};
 		};
 
 
+		/**
+		 * @brief	Container for a GUI widget.
+		 */
 		struct WidgetInfo
 		struct WidgetInfo
 		{
 		{
 			WidgetInfo(GUIWidget* _widget)
 			WidgetInfo(GUIWidget* _widget)
@@ -57,6 +68,9 @@ namespace BansheeEngine
 			GUIWidget* widget;
 			GUIWidget* widget;
 		};
 		};
 
 
+		/**
+		 * @brief	Container for data about a single GUI element and its widget.
+		 */
 		struct ElementInfo
 		struct ElementInfo
 		{
 		{
 			ElementInfo(GUIElement* element, GUIWidget* widget)
 			ElementInfo(GUIElement* element, GUIWidget* widget)
@@ -67,6 +81,9 @@ namespace BansheeEngine
 			GUIWidget* widget;
 			GUIWidget* widget;
 		};
 		};
 
 
+		/**
+		 * @brief	Container for GUI element in focus.
+		 */
 		struct ElementFocusInfo
 		struct ElementFocusInfo
 		{
 		{
 			GUIElement* element;
 			GUIElement* element;
@@ -77,23 +94,75 @@ namespace BansheeEngine
 		GUIManager();
 		GUIManager();
 		~GUIManager();
 		~GUIManager();
 
 
+		/**
+		 * @brief	Registers a newly created widget with the GUI manager.
+		 *			This should be called by every GUI widget on creation.
+		 */
 		void registerWidget(GUIWidget* widget);
 		void registerWidget(GUIWidget* widget);
+
+		/**
+		 * @brief	Unregisters a GUI widget from the GUI manager.
+		 *			This should be called by every GUI widget before getting deleted.
+		 */
 		void unregisterWidget(GUIWidget* widget);
 		void unregisterWidget(GUIWidget* widget);
 
 
+		/**
+		 * @brief	Called once per frame.
+		 */
 		void update();
 		void update();
+
+		/**
+		 * @brief	Called by the renderer for each existing viewport. Allows the GUI manager
+		 *			to queue GUI render operations.
+		 */
 		void render(ViewportPtr& target, DrawList& drawList) const;
 		void render(ViewportPtr& target, DrawList& drawList) const;
 
 
+		/**
+		 * @brief	Queues the GUI element for destruction. Element will be destroyed during the next
+		 *			call to update().
+		 */
 		void queueForDestroy(GUIElement* element);
 		void queueForDestroy(GUIElement* element);
 
 
+		/**
+		 * @brief	Change the GUI element focus state.
+		 */
 		void setFocus(GUIElement* element, bool focus);
 		void setFocus(GUIElement* element, bool focus);
 
 
+		/**
+		 * @brief	Changes the color of the input caret used in input boxes and similar controls.
+		 */
 		void setCaretColor(const Color& color) { mCaretColor = color; updateCaretTexture(); }
 		void setCaretColor(const Color& color) { mCaretColor = color; updateCaretTexture(); }
+
+		/**
+		 * @brief	Changes the text selection highlight color used in input boxes and similar controls.
+		 */
 		void setTextSelectionColor(const Color& color) { mTextSelectionColor = color; updateTextSelectionTexture(); }
 		void setTextSelectionColor(const Color& color) { mTextSelectionColor = color; updateTextSelectionTexture(); }
+
+		/**
+		 * @brief	Returns the default caret texture used for rendering the input caret sprite.
+		 */
 		const HSpriteTexture& getCaretTexture() const { return mCaretTexture; }
 		const HSpriteTexture& getCaretTexture() const { return mCaretTexture; }
+
+		/**
+		 * @brief	Returns the default selection highlight texture used for rendering the selection highlight sprites.
+		 */
 		const HSpriteTexture& getTextSelectionTexture() const { return mTextSelectionTexture; }
 		const HSpriteTexture& getTextSelectionTexture() const { return mTextSelectionTexture; }
+
+		/**
+		 * @brief	Checks is the input caret visible this frame.
+		 */
 		bool getCaretBlinkState() const { return mIsCaretOn; }
 		bool getCaretBlinkState() const { return mIsCaretOn; }
 
 
+		/**
+		 * @brief	Returns input caret helper tool that allows you to easily position and show
+		 *			an input caret in your GUI controls.
+		 */
 		GUIInputCaret* getInputCaretTool() const { return mInputCaret; }
 		GUIInputCaret* getInputCaretTool() const { return mInputCaret; }
+
+		/**
+		 * @brief	Returns input selection helper tool that allows you to easily position and show
+		 *			an input selection highlight in your GUI controls.
+		 */
 		GUIInputSelection* getInputSelectionTool() const { return mInputSelection; }
 		GUIInputSelection* getInputSelectionTool() const { return mInputSelection; }
 
 
 		/**
 		/**
@@ -115,6 +184,152 @@ namespace BansheeEngine
 		void setInputBridge(const RenderTexture* renderTex, const GUIElement* element);
 		void setInputBridge(const RenderTexture* renderTex, const GUIElement* element);
 
 
 	private:
 	private:
+		/**
+		 * @brief	Recreates all dirty GUI meshes and makes them ready for rendering.
+		 */
+		void updateMeshes();
+
+		/**
+		 * @brief	Recreates the input caret texture.
+		 */
+		void updateCaretTexture();
+
+		/**
+		 * @brief	Recreates the input text selection highlight texture.
+		 */
+		void updateTextSelectionTexture();
+
+		/**
+		 * @brief	Destroys any elements or widgets queued for destruction.
+		 */
+		void processDestroyQueue();
+
+		/**
+		 * @brief	Finds a GUI element under the pointer at the specified screen position. This method will also
+		 *			trigger pointer move/hover/leave events.
+		 *
+		 * @param	screenMousePos	Position of the pointer in screen coordinates.
+		 * @param	buttonStates	States of the three mouse buttons (left, right, middle).
+		 * @param	shift			Is shift key held.
+		 * @param	control			Is control key held.
+		 * @param	alt				Is alt key held.
+		 */
+		bool findElementUnderPointer(const Vector2I& screenMousePos, bool buttonStates[3], bool shift, bool control, bool alt);
+
+		/**
+		 * @brief	Called whenever a pointer (e.g. mouse cursor) is moved.
+		 */
+		void onPointerMoved(const PointerEvent& event);
+
+		/**
+		 * @brief	Called whenever a pointer button (e.g. mouse button) is released.
+		 */
+		void onPointerReleased(const PointerEvent& event);
+
+		/**
+		 * @brief	Called whenever a pointer button (e.g. mouse button) is pressed.
+		 */
+		void onPointerPressed(const PointerEvent& event);
+
+		/**
+		 * @brief	Called whenever a pointer button (e.g. mouse button) is double clicked.
+		 */
+		void onPointerDoubleClick(const PointerEvent& event);
+
+		/**
+		 * @brief	Called whenever a text is input.
+		 */
+		void onTextInput(const TextInputEvent& event);
+
+		/**
+		 * @brief	Called whenever an input command is input.
+		 */
+		void onInputCommandEntered(InputCommandType commandType);
+
+		/**
+		 * @brief	Called whenever a virtual button is pressed.
+		 */
+		void onVirtualButtonDown(const VirtualButton& button, UINT32 deviceIdx);
+
+		/**
+		 * @brief	Called by the drag and drop managed to notify us the drag ended.
+		 */
+		void onMouseDragEnded(const PointerEvent& event, DragCallbackInfo& dragInfo);
+
+		/**
+		 * @brief	Called when the specified window gains focus.
+		 */
+		void onWindowFocusGained(RenderWindow& win);
+
+		/**
+		 * @brief	Called when the specified window loses focus.
+		 */
+		void onWindowFocusLost(RenderWindow& win);
+
+		/**
+		 * @brief	Called when the mouse leaves the specified window.
+		 */
+		void onMouseLeftWindow(RenderWindow* win);
+
+		/**
+		 * @brief	Converts pointer buttons to mouse buttons.
+		 */
+		GUIMouseButton buttonToGUIButton(PointerEventButton pointerButton) const;
+
+		/**
+		 * @brief	Converts screen coordinates to coordinates relative to the specified widget.
+		 */
+		Vector2I getWidgetRelativePos(const GUIWidget& widget, const Vector2I& screenPos) const;
+
+		/**
+		 * @brief	Converts window coordinates to coordinates relative to the specified bridged widget.
+		 *			Returned coordinates will be relative to the bridge element.
+		 *
+		 * @param	If provided widget has no bridge, coordinates are returned as is.
+		 */
+		Vector2I windowToBridgedCoords(const GUIWidget& widget, const Vector2I& windowPos) const;
+
+		/**
+		 * @brief	Returns the parent render window of the specified widget.
+		 */
+		const RenderWindow* getWidgetWindow(const GUIWidget& widget) const;
+
+		/**
+		 * @brief	Sends a mouse event to the specified GUI element.
+		 *
+		 * @param	widget	Parent widget of the element to send the event to.
+		 * @param	element	Element to send the event to.
+		 * @param	event	Event data.
+		 */
+		bool sendMouseEvent(GUIWidget* widget, GUIElement* element, const GUIMouseEvent& event);
+
+		/**
+		 * @brief	Sends a text input event to the specified GUI element.
+		 *
+		 * @param	widget	Parent widget of the element to send the event to.
+		 * @param	element	Element to send the event to.
+		 * @param	event	Event data.
+		 */
+		bool sendTextInputEvent(GUIWidget* widget, GUIElement* element, const GUITextInputEvent& event);
+
+		/**
+		 * @brief	Sends a command event to the specified GUI element.
+		 *
+		 * @param	widget	Parent widget of the element to send the event to.
+		 * @param	element	Element to send the event to.
+		 * @param	event	Event data.
+		 */
+		bool sendCommandEvent(GUIWidget* widget, GUIElement* element, const GUICommandEvent& event);
+
+		/**
+		 * @brief	Sends a virtual button event to the specified GUI element.
+		 *
+		 * @param	widget	Parent widget of the element to send the event to.
+		 * @param	element	Element to send the event to.
+		 * @param	event	Event data.
+		 */
+		bool sendVirtualButtonEvent(GUIWidget* widget, GUIElement* element, const GUIVirtualButtonEvent& event);
+
 		static const UINT32 DRAG_DISTANCE;
 		static const UINT32 DRAG_DISTANCE;
 
 
 		static const UINT32 MESH_HEAP_INITIAL_NUM_VERTS;
 		static const UINT32 MESH_HEAP_INITIAL_NUM_VERTS;
@@ -183,39 +398,10 @@ namespace BansheeEngine
 		HEvent mWindowLostFocusConn;
 		HEvent mWindowLostFocusConn;
 
 
 		HEvent mMouseLeftWindowConn;
 		HEvent mMouseLeftWindowConn;
-
-		void updateMeshes();
-		void updateCaretTexture();
-		void updateTextSelectionTexture();
-		void processDestroyQueue();
-
-		bool findElementUnderPointer(const Vector2I& screenMousePos, bool buttonStates[3], bool shift, bool control, bool alt);
-
-		void onPointerMoved(const PointerEvent& event);
-		void onPointerReleased(const PointerEvent& event);
-		void onPointerPressed(const PointerEvent& event);
-		void onPointerDoubleClick(const PointerEvent& event);
-		void onTextInput(const TextInputEvent& event);
-		void onInputCommandEntered(InputCommandType commandType);
-		void onVirtualButtonDown(const VirtualButton& button, UINT32 deviceIdx);
-
-		void onMouseDragEnded(const PointerEvent& event, DragCallbackInfo& dragInfo);
-
-		void onWindowFocusGained(RenderWindow& win);
-		void onWindowFocusLost(RenderWindow& win);
-
-		void onMouseLeftWindow(RenderWindow* win);
-
-		GUIMouseButton buttonToGUIButton(PointerEventButton pointerButton) const;
-		Vector2I getWidgetRelativePos(const GUIWidget& widget, const Vector2I& screenPos) const;
-		Vector2I windowToBridgedCoords(const GUIWidget& widget, const Vector2I& windowPos) const;
-		const RenderWindow* getWidgetWindow(const GUIWidget& widget) const;
-
-		bool sendMouseEvent(GUIWidget* widget, GUIElement* element, const GUIMouseEvent& event);
-		bool sendTextInputEvent(GUIWidget* widget, GUIElement* element, const GUITextInputEvent& event);
-		bool sendCommandEvent(GUIWidget* widget, GUIElement* element, const GUICommandEvent& event);
-		bool sendVirtualButtonEvent(GUIWidget* widget, GUIElement* element, const GUIVirtualButtonEvent& event);
 	};
 	};
 
 
+	/**
+	 * @copydoc	GUIManager
+	 */
 	BS_EXPORT GUIManager& gGUIManager();
 	BS_EXPORT GUIManager& gGUIManager();
 }
 }

+ 3 - 0
BansheeEngine/Include/BsGUIMaterialInfo.h

@@ -5,6 +5,9 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	Container for data about a GUI element material.
+	 */
 	struct GUIMaterialInfo
 	struct GUIMaterialInfo
 	{
 	{
 		HMaterial material;
 		HMaterial material;

+ 15 - 0
BansheeEngine/Include/BsGUIMaterialManager.h

@@ -39,11 +39,26 @@ namespace BansheeEngine
 		 */
 		 */
 		void releaseMaterial(const GUIMaterialInfo& material) const;
 		void releaseMaterial(const GUIMaterialInfo& material) const;
 
 
+		/**
+		 * @brief	Attempts to find an existing text material with the specified color and tint. Returns null
+		 *			if one cannot be found.
+		 */
 		const GUIMaterialInfo* findExistingTextMaterial(const HTexture& texture, const Color& tint) const;
 		const GUIMaterialInfo* findExistingTextMaterial(const HTexture& texture, const Color& tint) const;
+
+		/**
+		 * @brief	Attempts to find an existing image material with the specified color and tint. Returns null
+		 *			if one cannot be found.
+		 */
 		const GUIMaterialInfo* findExistingImageMaterial(const HTexture& texture, const Color& tint) const;
 		const GUIMaterialInfo* findExistingImageMaterial(const HTexture& texture, const Color& tint) const;
 
 
+		/**
+		 * @brief	Releases all internal materials, whether they are used or not.
+		 */
 		void forceReleaseAllMaterials();
 		void forceReleaseAllMaterials();
 	private:
 	private:
+		/**
+		 * @brief	Contains data about a GUI material and its usage count.
+		 */
 		struct GUIMaterial
 		struct GUIMaterial
 		{
 		{
 			GUIMaterial()
 			GUIMaterial()

+ 104 - 7
BansheeEngine/Include/BsGUIMenu.h

@@ -5,48 +5,133 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * Holds information about a single element in a GUI menu.
+	 */
 	class BS_EXPORT GUIMenuItem
 	class BS_EXPORT GUIMenuItem
 	{
 	{
 	public:
 	public:
+		/**
+		 * @brief	Constructs a new non-separator menu item.
+		 *
+		 * @param	parent		Parent item, if any.
+		 * @param	name		Name of the item to be displayed.
+		 * @param	callback	Callback to be triggered when menu items is selected.
+		 */
 		GUIMenuItem(GUIMenuItem* parent, const WString& name, std::function<void()> callback);
 		GUIMenuItem(GUIMenuItem* parent, const WString& name, std::function<void()> callback);
+
+		/**
+		 * @brief	Constructs a new separator menu item.
+		 *
+		 * @param	parent		Parent item, if any.
+		 */
 		GUIMenuItem(GUIMenuItem* parent);
 		GUIMenuItem(GUIMenuItem* parent);
 		~GUIMenuItem();
 		~GUIMenuItem();
 
 
+		/**
+		 * @brief	Registers a new child with the item.
+		 */
 		void addChild(GUIMenuItem* child) { mChildren.push_back(child); }
 		void addChild(GUIMenuItem* child) { mChildren.push_back(child); }
 
 
+		/**
+		 * @brief	Returns number of child menu items.
+		 */
 		UINT32 getNumChildren() const { return (UINT32)mChildren.size(); }
 		UINT32 getNumChildren() const { return (UINT32)mChildren.size(); }
+
+		/**
+		 * @brief	Returns the parent menu item, or null if none.
+		 */
 		const GUIMenuItem* getParent() const { return mParent; }
 		const GUIMenuItem* getParent() const { return mParent; }
+
+		/**
+		 * @brief	Returns name of the menu item. Empty if separator.
+		 */
 		const WString& getName() const { return mName; }
 		const WString& getName() const { return mName; }
+
+		/**
+		 * @brief	Returns callback that will trigger when menu item is selected. Null for separators.
+		 */
 		std::function<void()> getCallback() const { return mCallback; }
 		std::function<void()> getCallback() const { return mCallback; }
+
+		/**
+		 * @brief	Checks is the menu item a separator or a normal named menu item.
+		 */
 		bool isSeparator() const { return mIsSeparator; }
 		bool isSeparator() const { return mIsSeparator; }
+
+		/**
+		 * @brief	Attempts to find a child menu item with the specified name.
+		 *			Only direct descendants are searched.
+		 */
 		const GUIMenuItem* findChild(const WString& name) const;
 		const GUIMenuItem* findChild(const WString& name) const;
 
 
+		/**
+		 * @brief	Removes the first child with the specified name.
+		 */
 		void removeChild(const WString& name);
 		void removeChild(const WString& name);
 
 
 	private:
 	private:
 		friend class GUIMenu;
 		friend class GUIMenu;
 
 
+		/**
+		 * @copydoc	GUIMenuitem::findChild(const WString& name) const
+		 */
+		GUIMenuItem* findChild(const WString& name);
+
 		GUIMenuItem* mParent;
 		GUIMenuItem* mParent;
 		bool mIsSeparator;
 		bool mIsSeparator;
 		WString mName;
 		WString mName;
 		std::function<void()> mCallback;
 		std::function<void()> mCallback;
 		Vector<GUIMenuItem*> mChildren;
 		Vector<GUIMenuItem*> mChildren;
-
-		GUIMenuItem* findChild(const WString& name);
 	};
 	};
 
 
+	/**
+	 * Class that allows creation of menus with drop down functionality.
+	 * Menu consists out of a number of top level elements, each of which opens
+	 * a drop down menu which may internally hold a deeper hierarchy of menus.
+	 *
+	 * @note	When specifying menu items you must provide a path. Path must be formated in a certain way.
+	 *			All path elements must be separated by /, e.g. "View/Toolbars/Find". "View" would be the top
+	 *			level path element, "Toolbars" a child in its menu that opens up its own submenu, and "Find"
+	 *			a child in the "Toolbars" sub-menu with an optional callback.
+	 *
+	 *			This is an abstract class and you should provide specialized implementations for specific menu types.
+	 */
 	class BS_EXPORT GUIMenu
 	class BS_EXPORT GUIMenu
 	{
 	{
 	public:
 	public:
 		GUIMenu();
 		GUIMenu();
 		virtual ~GUIMenu();
 		virtual ~GUIMenu();
 
 
+		/**
+		 * @brief	Adds a new menu item with the specified callback. Element items are added in order.
+		 *			
+		 * @param	path		Path that determines where to add the element. See class information on how to specify paths.
+		 *						All sub-elements of a path will be added automatically.
+		 * @param	callback	Callback that triggers when the path element is selected.
+		 *
+		 * @returns	A menu item object that you may use for removing the menu item later. Its lifetime is managed internally.
+		 */
 		const GUIMenuItem* addMenuItem(const WString& path, std::function<void()> callback);
 		const GUIMenuItem* addMenuItem(const WString& path, std::function<void()> callback);
+
+		/**
+		 * @brief	Adds a new separator menu item with the specified callback. Element items are added in order.
+		 *			
+		 * @param	path		Path that determines where to add the element. See class information on how to specify paths.
+		 *						All sub-elements of a path will be added automatically.
+		 *
+		 * @returns	A menu item object that you may use for removing the menu item later. Its lifetime is managed internally.
+		 */
 		const GUIMenuItem* addSeparator(const WString& path);
 		const GUIMenuItem* addSeparator(const WString& path);
+
+		/**
+		 * @brief	Returns a menu item at the specified path, or null if one is not found.
+		 */
 		const GUIMenuItem* getMenuItem(const WString& path) const;
 		const GUIMenuItem* getMenuItem(const WString& path) const;
-		void removeMenuItem(const GUIMenuItem* item);
 
 
-		GUIDropDownData getDropDownData() const;
+		/**
+		 * @brief	Removes the specified menu item from the path. If the menu item has any sub-menus they will also be removed.
+		 */
+		void removeMenuItem(const GUIMenuItem* item);
 
 
 		/**
 		/**
 		 * @brief	Normally menu items use values from their paths as their names. However path labels don't provide a way of
 		 * @brief	Normally menu items use values from their paths as their names. However path labels don't provide a way of
@@ -59,10 +144,22 @@ namespace BansheeEngine
 		 */
 		 */
 		void setLocalizedName(const WString& menuItemLabel, const HString& localizedName);
 		void setLocalizedName(const WString& menuItemLabel, const HString& localizedName);
 	protected:
 	protected:
-		GUIMenuItem mRootElement;
-		UnorderedMap<WString, HString> mLocalizedEntryNames;
-
+		/**
+		 * @brief	Adds a menu item at the specified path, as a normal button or as a separator.
+		 */
 		const GUIMenuItem* addMenuItemInternal(const WString& path, std::function<void()> callback, bool isSeparator);
 		const GUIMenuItem* addMenuItemInternal(const WString& path, std::function<void()> callback, bool isSeparator);
+
+		/**
+		 * @brief	Return drop down data for the specified menu.
+		 */
 		GUIDropDownData getDropDownDataInternal(const GUIMenuItem& menu) const;
 		GUIDropDownData getDropDownDataInternal(const GUIMenuItem& menu) const;
+
+		/**
+		 * @brief	Returns data used for initializing a drop down list, for all elements.
+		 */
+		GUIDropDownData getDropDownData() const;
+
+		GUIMenuItem mRootElement;
+		UnorderedMap<WString, HString> mLocalizedEntryNames;
 	};
 	};
 }
 }

+ 112 - 13
BansheeEngine/Include/BsGUIMouseEvent.h

@@ -5,6 +5,9 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	Types of GUI mouse events.
+	 */
 	enum class GUIMouseEventType
 	enum class GUIMouseEventType
 	{
 	{
 		MouseOver,
 		MouseOver,
@@ -21,58 +24,154 @@ namespace BansheeEngine
 		MouseDragAndDropDropped,
 		MouseDragAndDropDropped,
 	};
 	};
 
 
+	/**
+	 * @brief	Types of GUI mouse buttons.
+	 */
 	enum class GUIMouseButton
 	enum class GUIMouseButton
 	{
 	{
 		Left, Right, Middle, Count
 		Left, Right, Middle, Count
 	};
 	};
 
 
+	/**
+	 * @brief	Contains data about a GUI mouse input event.
+	 *			This class may store data for many types of events, and some data
+	 *			might not be initialized for some event types. Caller must check
+	 *			event type before relying on the data inside.
+	 */
 	class BS_EXPORT GUIMouseEvent
 	class BS_EXPORT GUIMouseEvent
 	{
 	{
 	public:
 	public:
 		GUIMouseEvent();
 		GUIMouseEvent();
 		GUIMouseEvent(bool buttonStates[(int)GUIMouseButton::Count], bool shift, bool ctrl, bool alt);
 		GUIMouseEvent(bool buttonStates[(int)GUIMouseButton::Count], bool shift, bool ctrl, bool alt);
 
 
+		/**
+		 * @brief	The position of the mouse when the event happened. This is relative to the
+		 *			parent widget of the element this event is being sent to.
+		 */
 		const Vector2I& getPosition() const { return mPosition; }
 		const Vector2I& getPosition() const { return mPosition; }
+
+		/**
+		 * @brief	Returns the internal type of the event.
+		 */
 		GUIMouseEventType getType() const { return mType; }
 		GUIMouseEventType getType() const { return mType; }
+
+		/**
+		 * @brief	Returns the mouse button involved in the event, if any.
+		 */
 		GUIMouseButton getButton() const { return mButton; }
 		GUIMouseButton getButton() const { return mButton; }
+
+		/**
+		 * @brief	Returns drag amount in pixels, if event is drag related.
+		 */
 		Vector2I getDragAmount() const { return mDragAmount; }
 		Vector2I getDragAmount() const { return mDragAmount; }
+
+		/**
+		 * @brief	Returns amount of mouse wheel scroll, if event is scroll wheel related.
+		 */
 		float getWheelScrollAmount() const { return mWheelScrollAmount; }
 		float getWheelScrollAmount() const { return mWheelScrollAmount; }
+
+		/**
+		 * @brief	Checks is the specified mouse button pressed.
+		 */
 		bool isButtonDown(GUIMouseButton button) const { return mButtonStates[(int)button]; }
 		bool isButtonDown(GUIMouseButton button) const { return mButtonStates[(int)button]; }
+
+		/**
+		 * @brief	Gets the current drag and drop operation type id. Only valid if event is drag and drop related.
+		 */
 		UINT32 getDragAndDropTypeId() const { return mDragTypeId; }
 		UINT32 getDragAndDropTypeId() const { return mDragTypeId; }
+
+		/**
+		 * @brief	Returns internal data being dragged by a drag and drop event. . Only valid if event is drag and drop related.
+		 */
 		void* getDragAndDropData() const { return mDragData; }
 		void* getDragAndDropData() const { return mDragData; }
 
 
+		/**
+		 * @brief	Checks is the shift button being held.
+		 */
 		bool isShiftDown() const { return mShift; }
 		bool isShiftDown() const { return mShift; }
+
+		/**
+		 * @brief	Checks is the control button being held.
+		 */
 		bool isCtrlDown() const { return mCtrl; }
 		bool isCtrlDown() const { return mCtrl; }
+
+		/**
+		 * @brief	Checks is the alt button being held.
+		 */
 		bool isAltDown() const { return mAlt; }
 		bool isAltDown() const { return mAlt; }
 	private:
 	private:
 		friend class GUIManager;
 		friend class GUIManager;
 
 
-		bool mButtonStates[(int)GUIMouseButton::Count];
-		Vector2I mPosition;
-		Vector2I mDragAmount;
-		float mWheelScrollAmount;
-		GUIMouseEventType mType;
-		GUIMouseButton mButton;
-		UINT32 mDragTypeId;
-		void* mDragData;
-
-		bool mShift;
-		bool mCtrl;
-		bool mAlt;
-
+		/**
+		 * @brief	Initializes the event with MouseOver event data.
+		 */
 		void setMouseOverData(const Vector2I& position);
 		void setMouseOverData(const Vector2I& position);
+
+		/**
+		 * @brief	Initializes the event with MouseOut event data.
+		 */
 		void setMouseOutData(const Vector2I& position);
 		void setMouseOutData(const Vector2I& position);
+
+		/**
+		 * @brief	Initializes the event with MouseMove event data.
+		 */
 		void setMouseMoveData(const Vector2I& position);
 		void setMouseMoveData(const Vector2I& position);
+
+		/**
+		 * @brief	Initializes the event with MouseWheelScroll event data.
+		 */
 		void setMouseWheelScrollData(float scrollAmount);
 		void setMouseWheelScrollData(float scrollAmount);
+
+		/**
+		 * @brief	Initializes the event with MouseUp event data.
+		 */
 		void setMouseUpData(const Vector2I& position, GUIMouseButton button);
 		void setMouseUpData(const Vector2I& position, GUIMouseButton button);
+
+		/**
+		 * @brief	Initializes the event with MouseDown event data.
+		 */
 		void setMouseDownData(const Vector2I& position, GUIMouseButton button);
 		void setMouseDownData(const Vector2I& position, GUIMouseButton button);
+
+		/**
+		 * @brief	Initializes the event with MouseDoubleClick event data.
+		 */
 		void setMouseDoubleClickData(const Vector2I& position, GUIMouseButton button);
 		void setMouseDoubleClickData(const Vector2I& position, GUIMouseButton button);
 
 
+		/**
+		 * @brief	Initializes the event with MouseDrag event data.
+		 */
 		void setMouseDragData(const Vector2I& position, const Vector2I& dragAmount);
 		void setMouseDragData(const Vector2I& position, const Vector2I& dragAmount);
+
+		/**
+		 * @brief	Initializes the event with MouseDragStart event data.
+		 */
 		void setMouseDragStartData(const Vector2I& position);
 		void setMouseDragStartData(const Vector2I& position);
+		/**
+		 * @brief	Initializes the event with MouseDragEnd event data.
+		 */
 		void setMouseDragEndData(const Vector2I& position);
 		void setMouseDragEndData(const Vector2I& position);
 
 
+		/**
+		 * @brief	Initializes the event with DragAndDropDropped event data.
+		 */
 		void setDragAndDropDroppedData(const Vector2I& position, UINT32 dragTypeId, void* dragData);
 		void setDragAndDropDroppedData(const Vector2I& position, UINT32 dragTypeId, void* dragData);
+
+		/**
+		 * @brief	Initializes the event with DragAndDropDragged event data.
+		 */
 		void setDragAndDropDraggedData(const Vector2I& position, UINT32 dragTypeId, void* dragData);
 		void setDragAndDropDraggedData(const Vector2I& position, UINT32 dragTypeId, void* dragData);
+
+		bool mButtonStates[(int)GUIMouseButton::Count];
+		Vector2I mPosition;
+		Vector2I mDragAmount;
+		float mWheelScrollAmount;
+		GUIMouseEventType mType;
+		GUIMouseButton mButton;
+		UINT32 mDragTypeId;
+		void* mDragData;
+
+		bool mShift;
+		bool mCtrl;
+		bool mAlt;
 	};
 	};
 }
 }

+ 33 - 0
BansheeEngine/Include/BsGUIOptions.h

@@ -4,8 +4,15 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	Controls GUI element properties, possibly by overriding
+	 *			the default properties specified in GUI element style.
+	 */
 	class BS_EXPORT GUIOption
 	class BS_EXPORT GUIOption
 	{
 	{
+		/**
+		 * @brief	Type of GUI element options.
+		 */
 		enum class Type
 		enum class Type
 		{
 		{
 			FixedWidth,
 			FixedWidth,
@@ -17,10 +24,30 @@ namespace BansheeEngine
 	public:
 	public:
 		GUIOption();
 		GUIOption();
 
 
+		/**
+		 * @brief	Constructs a GUI option notifying the GUI layout that this element has a fixed width.
+		 *			This will override width property set in element style.
+		 */
 		static GUIOption fixedWidth(UINT32 value);
 		static GUIOption fixedWidth(UINT32 value);
+
+		/**
+		 * @brief	Constructs a GUI option notifying the GUI layout that this element has a flexible width with
+		 *			optional min/max constraints (value of 0 means no constraint). This will override width property 
+		 *			set in element style.
+		 */
 		static GUIOption flexibleWidth(UINT32 min = 0, UINT32 max = 0);
 		static GUIOption flexibleWidth(UINT32 min = 0, UINT32 max = 0);
 
 
+		/**
+		 * @brief	Constructs a GUI option notifying the GUI layout that this element has a fixed height.
+		 *			This will override height property set in element style.
+		 */
 		static GUIOption fixedHeight(UINT32 value);
 		static GUIOption fixedHeight(UINT32 value);
+
+		/**
+		 * @brief	Constructs a GUI option notifying the GUI layout that this element has a flexible height with
+		 *			optional min/max constraints (value of 0 means no constraint). This will override height property 
+		 *			set in element style.
+		 */
 		static GUIOption flexibleHeight(UINT32 min = 0, UINT32 max = 0);
 		static GUIOption flexibleHeight(UINT32 min = 0, UINT32 max = 0);
 
 
 	private:
 	private:
@@ -30,6 +57,9 @@ namespace BansheeEngine
 		Type type;
 		Type type;
 	};
 	};
 
 
+	/**
+	 * @brief	Container for a list of options used for controlling GUI element properties.
+	 */
 	class BS_EXPORT GUIOptions
 	class BS_EXPORT GUIOptions
 	{
 	{
 	public:
 	public:
@@ -72,6 +102,9 @@ namespace BansheeEngine
 			mOptions.push_back(e4);
 			mOptions.push_back(e4);
 		}
 		}
 
 
+		/**
+		 * @brief	Adds a new option to the options list. 
+		 */
 		void addOption(const GUIOption& option)
 		void addOption(const GUIOption& option)
 		{
 		{
 			mOptions.push_back(option);
 			mOptions.push_back(option);

+ 25 - 3
BansheeEngine/Include/BsGUIRenderTexture.h

@@ -14,20 +14,42 @@ namespace BansheeEngine
 	class BS_EXPORT GUIRenderTexture : public GUITexture
 	class BS_EXPORT GUIRenderTexture : public GUITexture
 	{
 	{
 	public:
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 		static const String& getGUITypeName();
 
 
+		/**
+		 * @brief	Creates a new element with the provided render texture.
+		 *
+		 * @param	texture			Render texture to display.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIRenderTexture* create(const RenderTexturePtr& texture, const String& styleName = StringUtil::BLANK);
 		static GUIRenderTexture* create(const RenderTexturePtr& texture, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new element with the provided render texture.
+		 *
+		 * @param	texture			Render texture to display.
+		 * @param	layoutOptions	Options that allows you to control how is the element positioned in
+		 *							GUI layout. This will override any similar options set by style.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 */
 		static GUIRenderTexture* create(const RenderTexturePtr& texture, const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 		static GUIRenderTexture* create(const RenderTexturePtr& texture, const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 
 
 	protected:
 	protected:
-		const RenderTexture* mSourceTexture;
-
 		GUIRenderTexture(const String& styleName, const RenderTexturePtr& texture, const GUILayoutOptions& layoutOptions);
 		GUIRenderTexture(const String& styleName, const RenderTexturePtr& texture, const GUILayoutOptions& layoutOptions);
 		virtual ~GUIRenderTexture();
 		virtual ~GUIRenderTexture();
 
 
 		/**
 		/**
-		 * @copydoc GUIElement::updateRenderElementsInternal()
+		 * @copydoc GUIElement::updateRenderElementsInternal
 		 */
 		 */
 		virtual void updateRenderElementsInternal();
 		virtual void updateRenderElementsInternal();
+
+		const RenderTexture* mSourceTexture;
 	};
 	};
 }
 }

+ 117 - 13
BansheeEngine/Include/BsGUIScrollArea.h

@@ -5,6 +5,9 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	Scroll bar options for a GUI scroll area.
+	 */
 	enum class ScrollBarType
 	enum class ScrollBarType
 	{
 	{
 		ShowIfDoesntFit,
 		ShowIfDoesntFit,
@@ -12,50 +15,161 @@ namespace BansheeEngine
 		NeverShow
 		NeverShow
 	};
 	};
 
 
+	/**
+	 * @brief	A GUI element container with support for vertical & horizontal scrolling.
+	 */
 	class BS_EXPORT GUIScrollArea : public GUIElementContainer
 	class BS_EXPORT GUIScrollArea : public GUIElementContainer
 	{
 	{
 	public:
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 		static const String& getGUITypeName();
 
 
+		/**
+		 * @brief	Creates a new empty scroll area.
+		 *
+		 * @param	vertBarType		Vertical scrollbar options.
+		 * @param	horzBarType		Horizontal scrollbar options.
+		 * @param	scrollBarStyle	(Optional) Style used by the scroll bars.
+		 * @param	scrollAreaStyle	(Optional) Style used by the scroll content area.
+		 */
 		static GUIScrollArea* create(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 		static GUIScrollArea* create(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 			const String& scrollBarStyle = StringUtil::BLANK, const String& scrollAreaStyle = StringUtil::BLANK);
 			const String& scrollBarStyle = StringUtil::BLANK, const String& scrollAreaStyle = StringUtil::BLANK);
 
 
+		/**
+		 * @brief	Creates a new empty scroll area.
+		 *
+		 * @param	vertBarType		Vertical scrollbar options.
+		 * @param	horzBarType		Horizontal scrollbar options.
+		 * @param	layoutOptions	Options that allows you to control how is the element positioned in
+		 *							GUI layout. This will override any similar options set by style.
+		 * @param	scrollBarStyle	(Optional) Style used by the scroll bars.
+		 * @param	scrollAreaStyle	(Optional) Style used by the scroll content area.
+		 */
 		static GUIScrollArea* create(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 		static GUIScrollArea* create(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 			const GUIOptions& layoutOptions, const String& scrollBarStyle = StringUtil::BLANK, 
 			const GUIOptions& layoutOptions, const String& scrollBarStyle = StringUtil::BLANK, 
 			const String& scrollAreaStyle = StringUtil::BLANK);
 			const String& scrollAreaStyle = StringUtil::BLANK);
 
 
+		/**
+		 * @brief	Creates a new empty scroll area. Scroll bars will be show if needed and hidden otherwise.
+		 *
+		 * @param	scrollBarStyle	(Optional) Style used by the scroll bars.
+		 * @param	scrollAreaStyle	(Optional) Style used by the scroll content area.
+		 */
 		static GUIScrollArea* create(const String& scrollBarStyle = StringUtil::BLANK, 
 		static GUIScrollArea* create(const String& scrollBarStyle = StringUtil::BLANK, 
 			const String& scrollAreaStyle = StringUtil::BLANK);
 			const String& scrollAreaStyle = StringUtil::BLANK);
 
 
+		/**
+		 * @brief	Creates a new empty scroll area. Scroll bars will be show if needed and hidden otherwise.
+		 *
+		 * @param	layoutOptions	Options that allows you to control how is the element positioned in
+		 *							GUI layout. This will override any similar options set by style.
+		 * @param	scrollBarStyle	(Optional) Style used by the scroll bars.
+		 * @param	scrollAreaStyle	(Optional) Style used by the scroll content area.
+		 */
 		static GUIScrollArea* create(const GUIOptions& layoutOptions, const String& scrollBarStyle = StringUtil::BLANK, 
 		static GUIScrollArea* create(const GUIOptions& layoutOptions, const String& scrollBarStyle = StringUtil::BLANK, 
 			const String& scrollAreaStyle = StringUtil::BLANK);
 			const String& scrollAreaStyle = StringUtil::BLANK);
 
 
+		/**
+		 * @copydoc	GUIElementContainer::getElementType
+		 */
 		virtual ElementType getElementType() const { return ElementType::ScrollArea; }
 		virtual ElementType getElementType() const { return ElementType::ScrollArea; }
 
 
+		/**
+		 * @brief	Returns the scroll area layout that you may use to add elements inside the scroll area.
+		 */
+		GUILayout& getLayout() const { return *mContentLayout; }
+
+		/**
+		 * @brief	Scrolls the area up by specified amount of pixels, if possible.
+		 */
 		void scrollUpPx(UINT32 pixels);
 		void scrollUpPx(UINT32 pixels);
+
+		/**
+		 * @brief	Scrolls the area down by specified amount of pixels, if possible.
+		 */
 		void scrollDownPx(UINT32 pixels);
 		void scrollDownPx(UINT32 pixels);
 
 
+		/**
+		 * @brief	Scrolls the area left by specified amount of pixels, if possible.
+		 */
 		void scrollLeftPx(UINT32 pixels);
 		void scrollLeftPx(UINT32 pixels);
+
+		/**
+		 * @brief	Scrolls the area right by specified amount of pixels, if possible.
+		 */
 		void scrollRightPx(UINT32 pixels);
 		void scrollRightPx(UINT32 pixels);
 
 
+		/**
+		 * @brief	Scrolls the area up by specified percentage (ranging [0, 1]), if possible.
+		 */
 		void scrollUpPct(float percent);
 		void scrollUpPct(float percent);
+
+		/**
+		 * @brief	Scrolls the area down by specified percentage (ranging [0, 1]), if possible.
+		 */
 		void scrollDownPct(float percent);
 		void scrollDownPct(float percent);
 
 
+		/**
+		 * @brief	Scrolls the area left by specified percentage (ranging [0, 1]), if possible.
+		 */
 		void scrollLeftPct(float percent);
 		void scrollLeftPct(float percent);
-		void scrollRightPct(float percent);
 
 
-		GUILayout& getLayout() const { return *mContentLayout; }
+		/**
+		 * @brief	Scrolls the area right by specified percentage (ranging [0, 1]), if possible.
+		 */
+		void scrollRightPct(float percent);
 	protected:
 	protected:
 		~GUIScrollArea();
 		~GUIScrollArea();
 
 
 		/**
 		/**
-		 * @copydoc GUIElement::updateBounds()
+		 * @copydoc GUIElementContainer::updateBounds
 		 */
 		 */
 		virtual void updateClippedBounds();
 		virtual void updateClippedBounds();
 	private:
 	private:
 		GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 		GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, 
 			const String& scrollBarStyle, const String& scrollAreaStyle, const GUILayoutOptions& layoutOptions);
 			const String& scrollBarStyle, const String& scrollAreaStyle, const GUILayoutOptions& layoutOptions);
 
 
+		/**
+		 * @copydoc	GUIElementContainer::mouseEvent
+		 */
+		virtual bool mouseEvent(const GUIMouseEvent& ev);
+
+		/**
+		 * @brief	Scrolls the contents to the specified position.
+		 *			(0 meaning top-most part of the content is visible,
+		 *			and 1 meaning bottom-most part is visible)
+		 */
+		void scrollToVertical(float pct);
+
+		/**
+		 * @brief	Scrolls the contents to the specified position.
+		 *			(0 meaning left-most part of the content is visible,
+		 *			and 1 meaning right-most part is visible)
+		 */
+		void scrollToHorizontal(float pct);
+
+		/**
+		 * @brief	Called when the vertical scrollbar moves. 
+		 *
+		 * @param	pct	Scrollbar position ranging [0, 1].
+		 */
+		void vertScrollUpdate(float pct);
+
+		/**
+		 * @brief	Called when the horizontal scrollbar moves. 
+		 *
+		 * @param	pct	Scrollbar position ranging [0, 1].
+		 */
+		void horzScrollUpdate(float pct);
+
+		/**
+		 * @copydoc	GUIElementContainer::_updateLayoutInternal
+		 */
+		void _updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
+			RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth);
+
 		ScrollBarType mVertBarType;
 		ScrollBarType mVertBarType;
 		ScrollBarType mHorzBarType;
 		ScrollBarType mHorzBarType;
 		String mScrollBarStyle;
 		String mScrollBarStyle;
@@ -74,15 +188,5 @@ namespace BansheeEngine
 		static const UINT32 MinHandleSize;
 		static const UINT32 MinHandleSize;
 		static const UINT32 WheelScrollAmount;
 		static const UINT32 WheelScrollAmount;
 
 
-		virtual bool mouseEvent(const GUIMouseEvent& ev);
-
-		void scrollToVertical(float pct);
-		void scrollToHorizontal(float pct);
-
-		void vertScrollUpdate(float pct);
-		void horzScrollUpdate(float pct);
-		void _updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
-			RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth);
-
 	};
 	};
 }
 }

+ 65 - 11
BansheeEngine/Include/BsGUIScrollBar.h

@@ -6,63 +6,121 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
+	/**
+	 * @brief	GUI element representing an element with a draggable handle
+	 *			of a variable size.
+	 */
 	class BS_EXPORT GUIScrollBar : public GUIElement
 	class BS_EXPORT GUIScrollBar : public GUIElement
 	{
 	{
 	public:
 	public:
+		/**
+		 * @brief	Triggered whenever the scrollbar handle is moved. Value provided
+		 *			is the handle position in percent (ranging [0, 1]).
+		 */
 		Event<void(float newPosition)> onScrollPositionChanged;
 		Event<void(float newPosition)> onScrollPositionChanged;
 
 
+		/**
+		 * @brief	Sets the size of the handle in pixels.
+		 */
 		void setHandleSize(UINT32 size);
 		void setHandleSize(UINT32 size);
+
+		/**
+		 * @brief	Sets the position of the scroll handle in percent (ranging [0, 1]).
+		 */
 		void setScrollPos(float pct);
 		void setScrollPos(float pct);
 
 
+		/**
+		 * @brief	Returns the position of the scroll handle in percent (ranging [0, 1]).
+		 */
 		float getScrollPos() const;
 		float getScrollPos() const;
 
 
 		/**
 		/**
-		 * @brief	Scrolls the contents by some amount. Amount is specified in the percentage
+		 * @brief	Moves the handle by some amount. Amount is specified in the percentage
 		 * 			of the entire scrollable area. Values out of range will be clamped.
 		 * 			of the entire scrollable area. Values out of range will be clamped.
 		 */
 		 */
 		void scroll(float amount);
 		void scroll(float amount);
 
 
+		/**
+		 * @brief	Returns the maximum size of the scroll handle, in pixels.
+		 */
 		UINT32 getMaxHandleSize() const;
 		UINT32 getMaxHandleSize() const;
+
+		/**
+		 * @brief	Returns the maximum scrollable size the handle can move within (e.g. scroll bar length).
+		 */
 		UINT32 getScrollableSize() const;
 		UINT32 getScrollableSize() const;
 
 
+		/**
+		 * @copydoc	GUIElement::_getOptimalSize
+		 */
 		virtual Vector2I _getOptimalSize() const;
 		virtual Vector2I _getOptimalSize() const;
 	protected:
 	protected:
+		/**
+		 * @brief	Constructs a new scrollbar.
+		 *
+		 * @param	horizontal	If true the scroll bar will have a horizontal moving handle, otherwise
+		 *						it will be a vertical one.
+		 * @param	styleName		Optional style to use for the element. Style will be retrieved
+		 *							from GUISkin of the GUIWidget the element is used on. If not specified
+		 *							default style is used.
+		 * @param	layoutOptions	Options that allows you to control how is the element positioned in
+		 *							GUI layout. This will override any similar options set by style.
+		 */
 		GUIScrollBar(bool horizontal, const String& styleName, const GUILayoutOptions& layoutOptions);
 		GUIScrollBar(bool horizontal, const String& styleName, const GUILayoutOptions& layoutOptions);
 		virtual ~GUIScrollBar();
 		virtual ~GUIScrollBar();
 
 
 		/**
 		/**
-		 * @copydoc GUIElement::getNumRenderElements()
+		 * @copydoc GUIElement::getNumRenderElements
 		 */
 		 */
 		virtual UINT32 getNumRenderElements() const;
 		virtual UINT32 getNumRenderElements() const;
 
 
 		/**
 		/**
-		 * @copydoc GUIElement::getMaterial()
+		 * @copydoc GUIElement::getMaterial
 		 */
 		 */
 		virtual const GUIMaterialInfo& getMaterial(UINT32 renderElementIdx) const;
 		virtual const GUIMaterialInfo& getMaterial(UINT32 renderElementIdx) const;
 
 
 		/**
 		/**
-		 * @copydoc GUIElement::getNumQuads()
+		 * @copydoc GUIElement::getNumQuads
 		 */
 		 */
 		virtual UINT32 getNumQuads(UINT32 renderElementIdx) const;
 		virtual UINT32 getNumQuads(UINT32 renderElementIdx) const;
 
 
 		/**
 		/**
-		 * @copydoc GUIElement::fillBuffer()
+		 * @copydoc GUIElement::fillBuffer
 		 */
 		 */
 		virtual void fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, 
 		virtual void fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, 
 			UINT32 maxNumQuads, UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const;
 			UINT32 maxNumQuads, UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const;
 
 
 		/**
 		/**
-		 * @copydoc GUIElement::updateRenderElementsInternal()
+		 * @copydoc GUIElement::updateRenderElementsInternal
 		 */
 		 */
 		virtual void updateRenderElementsInternal();
 		virtual void updateRenderElementsInternal();
 
 
 		/**
 		/**
-		 * @copydoc GUIElement::updateBounds()
+		 * @copydoc GUIElement::updateBounds
 		 */
 		 */
 		virtual void updateClippedBounds();
 		virtual void updateClippedBounds();
 
 
+		/**
+		 * @copydoc GUIElement::_getRenderElementDepth
+		 */
 		virtual UINT32 _getRenderElementDepth(UINT32 renderElementIdx) const;
 		virtual UINT32 _getRenderElementDepth(UINT32 renderElementIdx) const;
 	private:
 	private:
+		/**
+		 * @brief	Triggered whenever the scroll handle moves. Provided value represents the new 
+		 *			position of the handle in percent (ranging [0, 1]).
+		 */
+		void handleMoved(float handlePct);
+
+		/**
+		 * @brief	Triggered when scroll up button is clicked.
+		 */
+		void upButtonClicked();
+
+		/**
+		 * @brief	Triggered when scroll down button is clicked.
+		 */
+		void downButtonClicked();
+
 		GUILayout* mLayout;
 		GUILayout* mLayout;
 		ImageSprite* mImageSprite;
 		ImageSprite* mImageSprite;
 
 
@@ -72,9 +130,5 @@ namespace BansheeEngine
 		bool mHorizontal;
 		bool mHorizontal;
 
 
 		static const UINT32 ButtonScrollAmount;
 		static const UINT32 ButtonScrollAmount;
-
-		void handleMoved(float handlePct);
-		void upButtonClicked();
-		void downButtonClicked();
 	};
 	};
 }
 }