Browse Source

More documentation

Marko Pintera 11 years ago
parent
commit
60ee2232d7

+ 70 - 8
BansheeEngine/Include/BsGUIScrollBarHandle.h

@@ -7,28 +7,78 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	A draggable handle used in a GUI scroll bar element.
+	 */
 	class BS_EXPORT GUIScrollBarHandle : public GUIElement
 	{
+		/**
+		 * @brief	Visual state of the handle
+		 */
 		enum class State
 		{
 			Normal, Hover, Active
 		};
 
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 
+		/**
+		 * @brief	Creates a new handle.
+		 *
+		 * @param	horizontal		Should the handle be movable vertically or horizontally.
+		 * @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 GUIScrollBarHandle* create(bool horizontal, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new handle.
+		 *
+		 * @param	horizontal		Should the handle be movable vertically or horizontally.
+		 * @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 GUIScrollBarHandle* create(bool horizontal, const GUIOptions& layoutOptions, 
 			const String& styleName = StringUtil::BLANK);
 
+		/**
+		 * @brief	Size of the handle in pixels, along the handle drag direction.
+		 */
 		void setHandleSize(UINT32 size);
+
+		/**
+		 * @brief	Moves the handle the the specified position in the handle area.
+		 *
+		 * @param	pct	Position to move the handle to, in percent ranging [0.0f, 1.0f]
+		 */
 		void setHandlePos(float pct);
 
-		UINT32 getScrollableSize() const;
+		/**
+		 * @brief	Gets the current position of the handle, in percent ranging [0.0f, 1.0f].
+		 */
 		float getHandlePos() const;
 
+		/**
+		 * @brief	Returns remaining length of the scrollable area not covered by the handle, in pixels.
+		 */
+		UINT32 getScrollableSize() const;
+
+		/**
+		 * @brief	Returns the total length of the area the handle can move in, in pixels.
+		 */
 		UINT32 getMaxSize() const;
 
+		/**
+		 * @copydoc	GUIElement::_getOptimalSize
+		 */
 		virtual Vector2I _getOptimalSize() const;
 
 		Event<void(float newPosition)> onHandleMoved;
@@ -66,9 +116,27 @@ namespace BansheeEngine
 		 */
 		virtual void updateClippedBounds();
 	private:
+		GUIScrollBarHandle(bool horizontal, const String& styleName, const GUILayoutOptions& layoutOptions);
+
+		/**
+		 * @copydoc	GUIElement::mouseEvent
+		 */
+		virtual bool mouseEvent(const GUIMouseEvent& ev);
+
+		/**
+		 * @brief	Checks are the specified over the scroll handle. Coordinates are relative
+		 *			to the parent widget.
+		 */
+		bool isOnHandle(const Vector2I& pos) const;
+
+		/**
+		 * @brief	Gets the currently active texture, depending on handle state.
+		 */
+		const HSpriteTexture& getActiveTexture() const;
+
 		ImageSprite* mImageSprite;
 		UINT32 mHandleSize;
-		
+
 		bool mHorizontal; // Otherwise its vertical
 		float mHandlePos;
 		INT32 mDragStartPos;
@@ -76,11 +144,5 @@ namespace BansheeEngine
 		bool mHandleDragged;
 		State mState;
 
-		GUIScrollBarHandle(bool horizontal, const String& styleName, const GUILayoutOptions& layoutOptions);
-
-		virtual bool mouseEvent(const GUIMouseEvent& ev);
-		bool isOnHandle(const Vector2I& pos) const;
-
-		const HSpriteTexture& getActiveTexture() const;
 	};
 }

+ 23 - 0
BansheeEngine/Include/BsGUIScrollBarHorz.h

@@ -6,12 +6,35 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Specialization of a horizontal scroll bar.
+	 */
 	class BS_EXPORT GUIScrollBarHorz : public GUIScrollBar
 	{
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 
+		/**
+		 * @brief	Creates a new horizontal scroll bar.
+		 *
+		 * @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 GUIScrollBarHorz* create(const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new horizontal scroll bar.
+		 *
+		 * @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 GUIScrollBarHorz* create(const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 	protected:
 		GUIScrollBarHorz(const String& styleName, const GUILayoutOptions& layoutOptions);

+ 23 - 0
BansheeEngine/Include/BsGUIScrollBarVert.h

@@ -6,12 +6,35 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Specialization of a vertical scroll bar.
+	 */
 	class BS_EXPORT GUIScrollBarVert : public GUIScrollBar
 	{
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 
+		/**
+		 * @brief	Creates a new vertical scroll bar.
+		 *
+		 * @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 GUIScrollBarVert* create(const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new vertical scroll bar.
+		 *
+		 * @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 GUIScrollBarVert* create(const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 	protected:
 		GUIScrollBarVert(const String& styleName, const GUILayoutOptions& layoutOptions);

+ 21 - 4
BansheeEngine/Include/BsGUISkin.h

@@ -5,19 +5,36 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Holds information about how are GUI element types positioned and
+	 *			displayed in the GUI. Each element type can be assigned a specific style.
+	 */
 	class BS_EXPORT GUISkin
 	{
 	public:
-		static GUIElementStyle DefaultStyle;
-		
 		GUISkin() {}
 
+		/**
+		 * @brief	Returns a style for the specified GUI element type.
+		 *
+		 * @see		GUIElement::getGUITypeName
+		 */
 		const GUIElementStyle* getStyle(const String& guiElemType) const;
+
+		/**
+		 * @brief	Sets a style for the specified GUI element type.
+		 *
+		 * @see		GUIElement::getGUITypeName
+		 */
 		void setStyle(const String& guiElemType, const GUIElementStyle& style);
 
+		/**
+		 * @brief	Default style that may be used when no other is available.
+		 */
+		static GUIElementStyle DefaultStyle;
 	private:
-		UnorderedMap<String, GUIElementStyle> mStyles;
-
 		GUISkin(const GUISkin& skin) {} // Disable copying
+
+		UnorderedMap<String, GUIElementStyle> mStyles;
 	};
 }

+ 38 - 0
BansheeEngine/Include/BsGUISpace.h

@@ -5,6 +5,10 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	GUI element that may be inserted into layouts in order to make
+	 *			a space of a fixed sized.
+	 */
 	class BS_EXPORT GUIFixedSpace : public GUIElementBase
 	{
 	public:
@@ -14,10 +18,24 @@ namespace BansheeEngine
 			_markAsClean();
 		}
 
+		/**
+		 * @brief	Returns the size of the space in pixels.
+		 */
 		UINT32 getSize() const { return mSize; }
+
+		/**
+		 * @copydoc	GUIElementBase::_getType
+		 */
 		Type _getType() const { return GUIElementBase::Type::FixedSpace; }
 
+		/**
+		 * @copydoc	GUIElementBase::_getOptimalSize
+		 */
 		virtual Vector2I _getOptimalSize() const { return Vector2I(getSize(), getSize()); }
+
+		/**
+		 * @copydoc	GUIElementBase::_getPadding
+		 */
 		virtual const RectOffset& _getPadding() const 
 		{
 			static RectOffset padding;
@@ -29,6 +47,16 @@ namespace BansheeEngine
 		UINT32 mSize;
 	};
 
+	/**
+	 * @brief	GUI element that may be inserted into layouts to make a space of
+	 *			a flexible size. The space will expand only if there is room and
+	 *			other elements are not squished because of it. If multiple flexible
+	 *			spaces are in a layout, their sizes will be shared equally.
+	 *
+	 * @note	e.g. If you had a horizontal layout with a button, and you wanted to
+	 *			align that button to the right of the layout, you would insert a flexible
+	 *			space before the button in the layout.
+	 */
 	class BS_EXPORT GUIFlexibleSpace : public GUIElementBase
 	{
 	public:
@@ -37,9 +65,19 @@ namespace BansheeEngine
 			_markAsClean();
 		}
 
+		/**
+		 * @copydoc	GUIElementBase::_getType
+		 */
 		Type _getType() const { return GUIElementBase::Type::FlexibleSpace; }
 
+		/**
+		 * @copydoc	GUIElementBase::_getOptimalSize
+		 */
 		virtual Vector2I _getOptimalSize() const { return Vector2I(0, 0); }
+
+		/**
+		 * @copydoc	GUIElementBase::_getPadding
+		 */
 		virtual const RectOffset& _getPadding() const 
 		{
 			static RectOffset padding;

+ 11 - 2
BansheeEngine/Include/BsGUITextInputEvent.h

@@ -6,17 +6,26 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	A text input event representing input of a single character.
+	 */
 	class BS_EXPORT GUITextInputEvent
 	{
 	public:
 		GUITextInputEvent();
 
+		/**
+		 * @brief	Character code that was input.
+		 */
 		const UINT32& getInputChar() const { return mInputChar; }
 	private:
 		friend class GUIManager;
 
-		UINT32 mInputChar;
-
+		/**
+		 * @brief	Initializes the event data with the character that was input.
+		 */
 		void setData(UINT32 inputChar);
+
+		UINT32 mInputChar;
 	};
 }

+ 114 - 18
BansheeEngine/Include/BsGUITexture.h

@@ -6,80 +6,176 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Type of scaling modes for GUI images
+	 */
 	enum class GUIImageScaleMode
 	{
-		StretchToFit,
-		ScaleToFit,
-		CropToFit,
-		RepeatToFit
+		StretchToFit, /**< Image will stretch non-uniformly in all dimensions in order to cover the assigned area fully. */
+		ScaleToFit, /**< Image will scale uniformly until one dimension is aligned with the assigned area. Remaining dimension might have empty space. */
+		CropToFit, /**< Image will scale uniformly until both dimensions are larger or aligned with the assigned area. Remaining dimension might be cropped. */
+		RepeatToFit /**< Image will keep its original size, but will repeat in order to fill the assigned area. */
 	};
 
+	/**
+	 * @brief	A GUI element that allows you to display a texture.
+	 */
 	class BS_EXPORT GUITexture : public GUIElement
 	{
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 
+		/**
+		 * @brief	Creates a new GUI texture element.
+		 *
+		 * @param	texture			Texture element to display.
+		 * @param	scale			Scale mode to use when sizing the texture.
+		 * @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 GUITexture* create(const HSpriteTexture& texture, GUIImageScaleMode scale, 
 			const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new GUI texture element.
+		 *
+		 * @param	texture			Texture element to display.
+		 * @param	scale			Scale mode to use when sizing the texture.
+		 * @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 GUITexture* create(const HSpriteTexture& texture, GUIImageScaleMode scale, 
 			const String& styleName = StringUtil::BLANK);
 
+
+		/**
+		 * @brief	Creates a new GUI texture element. Uses the default StretchToFit scale mode.
+		 *
+		 * @param	texture			Texture element 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 GUITexture* create(const HSpriteTexture& texture, 
 			const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
-		static GUITexture* create(const HSpriteTexture& texture, 
-			const String& styleName = StringUtil::BLANK);
 
+		/**
+		 * @brief	Creates a new GUI texture element. Uses the default StretchToFit scale mode.
+		 *
+		 * @param	texture			Texture element 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 GUITexture* create(const HSpriteTexture& texture, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new GUI texture element. Uses the "normal" texture from the active GUI element style.
+		 *
+		 * @param	scale			Scale mode to use when sizing the texture.
+		 * @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 GUITexture* create(GUIImageScaleMode scale, const GUIOptions& layoutOptions, 
 			const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new GUI texture element. Uses the "normal" texture from the active GUI element style.
+		 *
+		 * @param	scale			Scale mode to use when sizing the texture.
+		 * @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 GUITexture* create(GUIImageScaleMode scale, const String& styleName = StringUtil::BLANK);
 
+		/**
+		 * @brief	Creates a new GUI texture element. Uses the "normal" texture from the active GUI element style.
+		 *			Uses the default StretchToFit scale mode.
+		 *
+		 * @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 GUITexture* create(const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new GUI texture element. Uses the "normal" texture from the active GUI element style.
+		 *			Uses the default StretchToFit scale mode.
+		 *
+		 * @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 GUITexture* create(const String& styleName = StringUtil::BLANK);
 
+		/**
+		 * @brief	Changes the active texture.
+		 */
 		void setTexture(const HSpriteTexture& texture);
 		
+		/**
+		 * @copydoc	GUIElement::getElementType
+		 */
 		virtual ElementType getElementType() const { return ElementType::Texture; }
 
+		/**
+		 * @copydoc	GUIElement::_getOptimalSize
+		 */
 		virtual Vector2I _getOptimalSize() const;
 	protected:
-		ImageSprite* mImageSprite;
-		HSpriteTexture mActiveTexture;
-		IMAGE_SPRITE_DESC mDesc;
-		GUIImageScaleMode mScaleMode;
-		bool mUsingStyleTexture;
-
 		GUITexture(const String& styleName, const HSpriteTexture& texture, GUIImageScaleMode scale, const GUILayoutOptions& layoutOptions);
 		virtual ~GUITexture();
 
 		/**
-		 * @copydoc GUIElement::getNumRenderElements()
+		 * @copydoc GUIElement::getNumRenderElements
 		 */
 		virtual UINT32 getNumRenderElements() const;
 
 		/**
-		 * @copydoc GUIElement::getMaterial()
+		 * @copydoc GUIElement::getMaterial
 		 */
 		virtual const GUIMaterialInfo& getMaterial(UINT32 renderElementIdx) const;
 
 		/**
-		 * @copydoc GUIElement::getNumQuads()
+		 * @copydoc GUIElement::getNumQuads
 		 */
 		virtual UINT32 getNumQuads(UINT32 renderElementIdx) const;
 
 		/**
-		 * @copydoc GUIElement::fillBuffer()
+		 * @copydoc GUIElement::fillBuffer
 		 */
 		virtual void fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, 
 			UINT32 maxNumQuads, UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const;
 
 		/**
-		 * @copydoc GUIElement::updateRenderElementsInternal()
+		 * @copydoc GUIElement::updateRenderElementsInternal
 		 */
 		virtual void updateRenderElementsInternal();
 
 		/**
-		 * @copydoc GUIElement::updateBounds()
+		 * @copydoc GUIElement::updateBounds
 		 */
 		virtual void updateClippedBounds();
+
+		ImageSprite* mImageSprite;
+		HSpriteTexture mActiveTexture;
+		IMAGE_SPRITE_DESC mDesc;
+		GUIImageScaleMode mScaleMode;
+		bool mUsingStyleTexture;
 	};
 }

+ 87 - 0
BansheeEngine/Include/BsGUIToggle.h

@@ -10,40 +10,124 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	GUI element representing a toggle (on/off) button.
+	 */
 	class BS_EXPORT GUIToggle : public GUIButtonBase
 	{
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 
+		/**
+		 * @brief	Creates a new toggle button with the specified label.
+		 *
+		 * @param	text			Label to display in the button, if any.
+		 * @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 GUIToggle* create(const HString& text, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new toggle button with the specified label.
+		 *
+		 * @param	text			Label to display in the button, if any.
+		 * @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 GUIToggle* create(const HString& text, const GUIOptions& layoutOptions, 
 			const String& styleName = StringUtil::BLANK);
 	
+		/**
+		 * @brief	Creates a new toggle button with the specified label.
+		 *
+		 * @param	text			Label to display in the button, if any.
+		 * @param	toggleGroup		Toggle group this button belongs to.
+		 * @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 GUIToggle* create(const HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, 
 			const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @brief	Creates a new toggle button with the specified label.
+		 *
+		 * @param	text			Label to display in the button, if any.
+		 * @param	toggleGroup		Toggle group this button belongs to.
+		 * @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 GUIToggle* create(const HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, 
 			const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 
+		/**
+		 * @copydoc	GUIToggle::create(const HString& text, const String& styleName)
+		 */
 		static GUIToggle* create(const GUIContent& content, const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @copydoc	GUIToggle::create(const HString& text, const GUIOptions& layoutOptions, const String& styleName)
+		 */
 		static GUIToggle* create(const GUIContent& content, const GUIOptions& layoutOptions, 
 			const String& styleName = StringUtil::BLANK);
 
+		/**
+		 * @copydoc	GUIToggle::create(const HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const String& styleName)
+		 */
 		static GUIToggle* create(const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, 
 			const String& styleName = StringUtil::BLANK);
+
+		/**
+		 * @copydoc	GUIToggle::create(const HString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIOptions& layoutOptions, const String& styleName)
+		 */
 		static GUIToggle* create(const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, 
 			const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
 
+		/**
+		 * @brief	Creates a toggle group that you may provide to GUIToggle upon construction. Toggles sharing the
+		 *			same group will only have a single element active at a time.
+		 */
 		static std::shared_ptr<GUIToggleGroup> createToggleGroup();
 
+		/**
+		 * @brief	Checks the toggle, making it active.
+		 */
 		void toggleOn();
+
+		/**
+		 * @brief	Unchecks the toggle, making it inactive.
+		 */
 		void toggleOff();
 
+		/**
+		 * @brief	Checks is the toggle currently on.
+		 */
 		bool isToggled() const { return mIsToggled; }
 
+		/**
+		 * @copydoc	GUIButtonBase::getElementType
+		 */
 		virtual ElementType getElementType() const { return ElementType::Toggle; }
 
+		/**
+		 * @brief	Sets a toggle group of the toggle button. Toggling one button in a group will
+		 *			automatically untoggle others.
+		 */
 		void _setToggleGroup(std::shared_ptr<GUIToggleGroup> toggleGroup);
 
+		/**
+		 * @brief	Triggered whenever the button is toggled on or off.
+		 */
 		Event<void(bool)> onToggled;
 	protected:
 		virtual ~GUIToggle();
@@ -52,6 +136,9 @@ namespace BansheeEngine
 		GUIToggle(const String& styleName, const GUIContent& content, 
 			std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions);
 
+		/**
+		 * @copydoc	GUIButtonBase::mouseEvent
+		 */
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 
 	protected:

+ 20 - 2
BansheeEngine/Include/BsGUIToggleGroup.h

@@ -4,19 +4,37 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Object that allows you to group multiple GUI toggle buttons.
+	 *			Only one button among the grouped ones can be active.
+	 */
 	class BS_EXPORT GUIToggleGroup
 	{
 	public:
 		~GUIToggleGroup();
 
-		void add(GUIToggle* toggle);
-		void remove(GUIToggle* toggle);
+		/**
+		 * @brief	Registers a new toggle button with the group.
+		 *
+		 * @note	Internal method.
+		 */
+		void _add(GUIToggle* toggle);
+
+		/**
+		 * @brief	Unregisters a toggle button from the group.
+		 *
+		 * @note	Internal method.
+		 */
+		void _remove(GUIToggle* toggle);
 
 	private:
 		friend class GUIToggle;
 
 		GUIToggleGroup() {}
 
+		/**
+		 * @brief	Initializes the toggle group. To be called right after construction.
+		 */
 		void initialize(const std::shared_ptr<GUIToggleGroup>& sharedPtr);
 
 		Vector<GUIToggle*> mButtons;

+ 41 - 10
BansheeEngine/Include/BsGUIViewport.h

@@ -12,63 +12,94 @@ namespace BansheeEngine
 	class BS_EXPORT GUIViewport : public GUIElement
 	{
 	public:
+		/**
+		 * Returns type name of the GUI element used for finding GUI element styles. 
+		 */
 		static const String& getGUITypeName();
 
 		/**
+		 * @brief	Creates a new GUI viewport element.
+		 *
+		 * @param	camera			Camera whos view to display in the element. Element will update the camera
+		 *							as it resizes.
+		 * @param	aspectRatio		Initial aspect of the camera. Determines how is FOV adjusted as the element resizes.
+		 * @param	fieldOfView		Initial FOV of the camera. Determines how is FOV adjusted as the element resizes.
+		 * @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.
+		 *
 		 * @note Render target used by the GUIWidget and Camera must be the same. 
 		 */
 		static GUIViewport* create(const HCamera& camera, float aspectRatio, Degree fieldOfView, const String& styleName = StringUtil::BLANK);
 
 		/**
+		 * @brief	Creates a new GUI viewport element.
+		 *
+		 * @param	camera			Camera whos view to display in the element. Element will update the camera
+		 *							as it resizes.
+		 * @param	aspectRatio		Initial aspect of the camera. Determines how is FOV adjusted as the element resizes.
+		 * @param	fieldOfView		Initial FOV of the camera. Determines how is FOV adjusted as the element resizes.
+		 * @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.
+		 *
 		 * @note Render target used by the GUIWidget and Camera must be the same. 
 		 */
 		static GUIViewport* create(const GUIOptions& layoutOptions, const HCamera& camera, 
 			float aspectRatio, Degree fieldOfView, const String& styleName = StringUtil::BLANK);
 
+		/**
+		 * @copydoc	GUIElement::_getOptimalSize
+		 */
 		virtual Vector2I _getOptimalSize() const;
 
 	protected:
 		~GUIViewport();
 
 		/**
-		 * @copydoc GUIElement::getNumRenderElements()
+		 * @copydoc GUIElement::getNumRenderElements
 		 */
 		virtual UINT32 getNumRenderElements() const;
 
 		/**
-		 * @copydoc GUIElement::getMaterial()
+		 * @copydoc GUIElement::getMaterial
 		 */
 		virtual const GUIMaterialInfo& getMaterial(UINT32 renderElementIdx) const;
 
 		/**
-		 * @copydoc GUIElement::getNumQuads()
+		 * @copydoc GUIElement::getNumQuads
 		 */
 		virtual UINT32 getNumQuads(UINT32 renderElementIdx) const;
 
 		/**
-		 * @copydoc GUIElement::fillBuffer()
+		 * @copydoc GUIElement::fillBuffer
 		 */
 		virtual void fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, 
 			UINT32 maxNumQuads, UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const;
 
 		/**
-		 * @copydoc GUIElement::updateBounds()
+		 * @copydoc GUIElement::updateBounds
 		 */
 		virtual void updateClippedBounds();
 
 		/**
-		 * @copydoc GUIElement::updateRenderElementsInternal()
+		 * @copydoc GUIElement::updateRenderElementsInternal
 		 */
 		virtual void updateRenderElementsInternal();
 
 	private:
+		GUIViewport(const String& styleName, const HCamera& camera, float aspectRatio, Degree fieldOfView, const GUILayoutOptions& layoutOptions);
+
+		/**
+		 * @copydoc	GUIElement::_changeParentWidget
+		 */
+		void _changeParentWidget(GUIWidget* widget);
+
 		HCamera mCamera;
 		float mAspectRatio;
 		Degree mFieldOfView;
 		Radian mVerticalFOV;
-
-		GUIViewport(const String& styleName, const HCamera& camera, float aspectRatio, Degree fieldOfView, const GUILayoutOptions& layoutOptions);
-
-		void _changeParentWidget(GUIWidget* widget);
 	};
 }

+ 11 - 2
BansheeEngine/Include/BsGUIVirtualButtonEvent.h

@@ -5,18 +5,27 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Holds data about a GUI event that happens when a virtual button is pressed.
+	 */
 	class BS_EXPORT GUIVirtualButtonEvent
 	{
 	public:
 		GUIVirtualButtonEvent()
 		{ }
 
+		/**
+		 * @brief	Returns the virtual button the event is referring to.
+		 */
 		const VirtualButton& getButton() const { return mButton; }
 	private:
 		friend class GUIManager;
+		
+		/**
+		 * @brief	Initializes the data for the event.
+		 */
+		void setButton(const VirtualButton& button) { mButton = button; }
 
 		VirtualButton mButton;
-
-		void setButton(const VirtualButton& button) { mButton = button; }
 	};
 }

+ 77 - 0
BansheeEngine/Include/BsGUIWidget.h

@@ -9,18 +9,50 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	A top level container for all types of GUI elements. Every GUI element, layout or area
+	 *			must be assigned to a widget in order to be rendered.
+	 *
+	 *			Widgets are the only GUI objects that may be arbitrarily transformed, allowing you to create
+	 *			3D interfaces.
+	 */
 	class BS_EXPORT GUIWidget : public Component
 	{
 	public:
 		virtual ~GUIWidget();
 
+		/**
+		 * @brief	Sets the skin used for all GUI elements in the widget. This will update
+		 *			the look of all current elements.
+		 */
 		void setSkin(const GUISkin& skin);
+
+		/**
+		 * @brief	Returns the currently active GUI skin.
+		 */
 		const GUISkin& getSkin() const;
 
+		/**
+		 * @brief	Returns the depth to render the widget at. If two widgets overlap the
+		 *			widget with the lower depth will be rendered in front.
+		 */
 		UINT8 getDepth() const { return mDepth; }
+
+		/**
+		 * @brief	Changes the depth to render the widget at. If two widgets overlap the
+		 *			widget with the lower depth will be rendered in front.
+		 */
 		void setDepth(UINT8 depth) { mDepth = depth; mWidgetIsDirty = true; }
 
+		/**
+		 * @brief	Checks are the specified coordinates within widget bounds. Coordinates should
+		 *			be relative to the parent window.
+		 */
 		bool inBounds(const Vector2I& position) const;
+
+		/**
+		 * @brief	Returns bounds of the widget, relative to the parent window.
+		 */
 		const RectI& getBounds() const { return mBounds; }
 
 		/**
@@ -32,9 +64,19 @@ namespace BansheeEngine
 		 */
 		bool isDirty(bool cleanIfDirty);
 
+		/**
+		 * @brief	Returns the viewport that this widget will be rendered on.
+		 */
 		Viewport* getTarget() const { return mTarget; }
+
+		/**
+		 * @brief	Returns a list of all elements parented to this widget.
+		 */
 		const Vector<GUIElement*>& getElements() const { return mElements; }
 
+		/**
+		 * @brief	Updates the layout of all child elements, repositioning and resizing them as needed.
+		 */
 		void _updateLayout();
 
 		/**
@@ -61,6 +103,9 @@ namespace BansheeEngine
 		 */
 		virtual bool _virtualButtonEvent(GUIElement* element, const GUIVirtualButtonEvent& ev);
 
+		/**
+		 * @brief	Default skin that is used when no other is assigned.
+		 */
 		static GUISkin DefaultSkin;
 	protected:
 		friend class SceneObject;
@@ -68,21 +113,53 @@ namespace BansheeEngine
 		friend class GUIArea;
 		friend class GUIManager;
 
+		/**
+		 * @brief	Constructs a new GUI widget attached to the specified parent scene object.
+		 *			Widget elements will be rendered on the provided viewport.
+		 */
 		GUIWidget(const HSceneObject& parent, Viewport* target);
 
+		/**
+		 * @brief	Registers a new element as a child of the widget.
+		 */
 		void registerElement(GUIElement* elem);
+		
+		/**
+		 * @brief	Unregisters an element from the widget. Usually called when the element
+		 *			is destroyed, or reparented to another widget.
+		 */
 		void unregisterElement(GUIElement* elem);
 
+		/**
+		 * @brief	Registers a new areaas a child of the widget.
+		 */
 		void registerArea(GUIArea* area);
+
+		/**
+		 * @brief	Unregisters an area from the widget. Usually called when the area is destroyed.
+		 */
 		void unregisterArea(GUIArea* area);
 
+		/**
+		 * @brief	Called when the viewport size changes and widget elements need to be updated.
+		 */
 		virtual void ownerTargetResized();
+
+		/**
+		 * @brief	Called when the parent window gained or lost focus.
+		 */
 		virtual void ownerWindowFocusChanged();
 
+		/**
+		 * @copydoc	Component::update
+		 */
 		virtual void update();
 	private:
 		GUIWidget(const GUIWidget& other) { }
 
+		/**
+		 * @brief	Calculates widget bounds using the bounds of all child elements.
+		 */
 		void updateBounds() const;
 
 		Viewport* mTarget;

+ 58 - 8
BansheeEngine/Include/BsProfilerOverlay.h

@@ -8,15 +8,24 @@
 
 namespace BansheeEngine
 {
+	/**
+	 * @brief	Types of profiler overlay.
+	 */
 	enum class ProfilerOverlayType
 	{
 		CPUSamples,
 		GPUSamples
 	};
 
+	/**
+	 * @brief	Handles rendering of Profiler information as an overlay in a viewport.
+	 */
 	class BS_EXPORT ProfilerOverlay : public Component
 	{
 	public:
+		/**
+		 * @brief	Holds data about GUI elements in a single row of a "CPU basic" sample.
+		 */
 		struct BasicRow
 		{
 			GUILayout* labelLayout;
@@ -35,6 +44,9 @@ namespace BansheeEngine
 			HString totalTimeSelf;
 		};
 
+		/**
+		 * @brief	Holds data about GUI elements in a single row of a "CPU precise" sample.
+		 */
 		struct PreciseRow
 		{
 			GUILayout* labelLayout;
@@ -52,7 +64,10 @@ namespace BansheeEngine
 			HString avgCyclesSelf;
 			HString totalCyclesSelf;
 		};
-
+		
+		/**
+		 * @brief	Holds data about GUI elements in a single row of a GPU sample.
+		 */
 		struct GPUSampleRow
 		{
 			GUILayout* layout;
@@ -64,12 +79,25 @@ namespace BansheeEngine
 		};
 
 	public:
+		/**
+		 * @brief	Constructs a new overlay attached to the specified parent and displayed on the provided viewport.
+		 */
 		ProfilerOverlay(const HSceneObject& parent, const ViewportPtr& target);
 		~ProfilerOverlay();
 
+		/**
+		 * @brief	Changes the viewport to display the overlay on.
+		 */
 		void setTarget(const ViewportPtr& target);
 
+		/**
+		 * @brief	Shows the overlay of the specified type.
+		 */
 		void show(ProfilerOverlayType type);
+
+		/**
+		 * @brief	Hides the overlay.
+		 */
 		void hide();
 
 		/**
@@ -77,6 +105,35 @@ namespace BansheeEngine
 		 */
 		void update();
 	private:
+		/**
+		 * @brief	Called whenever the viewport resizes in order to rearrange the GUI elements.
+		 */
+		void targetResized();
+
+		/**
+		 * @brief	Updates sizes of GUI areas used for displaying CPU sample data. To be called
+		 *			after viewport change or resize.
+		 */
+		void updateCPUSampleAreaSizes();
+
+		/**
+		 * @brief	Updates sizes of GUI areas used for displaying GPU sample data. To be called
+		 *			after viewport change or resize.
+		 */
+		void updateGPUSampleAreaSizes();
+
+		/**
+		 * @brief	Updates CPU GUI elements from the data in the provided profiler reports. To be called
+		 *			whenever a new report is received.
+		 */
+		void updateCPUSampleContents(const ProfilerReport& simReport, const ProfilerReport& coreReport);
+
+		/**
+		 * @brief	Updates GPU GUI elemnts from the data in the provided profiler report. To be called whenever
+		 *			a new report is received.
+		 */
+		void updateGPUSampleContents(const GPUProfilerReport& gpuReport);
+
 		static const UINT32 MAX_DEPTH;
 
 		ProfilerOverlayType mType;
@@ -150,12 +207,5 @@ namespace BansheeEngine
 
 		HEvent mTargetResizedConn;
 		bool mIsShown;
-
-		void targetResized();
-		void updateCPUSampleAreaSizes();
-		void updateGPUSampleAreaSizes();
-
-		void updateCPUSampleContents(const ProfilerReport& simReport, const ProfilerReport& coreReport);
-		void updateGPUSampleContents(const GPUProfilerReport& gpuReport);
 	};
 }

+ 2 - 2
BansheeEngine/Source/BsGUIToggle.cpp

@@ -22,14 +22,14 @@ namespace BansheeEngine
 		:GUIButtonBase(styleName, content, layoutOptions), mIsToggled(false), mToggleGroup(nullptr)
 	{
 		if(toggleGroup != nullptr)
-			toggleGroup->add(this);
+			toggleGroup->_add(this);
 	}
 
 	GUIToggle::~GUIToggle()
 	{
 		if(mToggleGroup != nullptr)
 		{
-			mToggleGroup->remove(this);
+			mToggleGroup->_remove(this);
 		}
 	}
 

+ 2 - 2
BansheeEngine/Source/BsGUIToggleGroup.cpp

@@ -16,7 +16,7 @@ namespace BansheeEngine
 		mThis = sharedPtr;
 	}
 
-	void GUIToggleGroup::add(GUIToggle* toggle)
+	void GUIToggleGroup::_add(GUIToggle* toggle)
 	{
 		auto iterFind = std::find(begin(mButtons), end(mButtons), toggle);
 		if(iterFind != end(mButtons))
@@ -26,7 +26,7 @@ namespace BansheeEngine
 		toggle->_setToggleGroup(mThis.lock());
 	}
 
-	void GUIToggleGroup::remove(GUIToggle* toggle)
+	void GUIToggleGroup::_remove(GUIToggle* toggle)
 	{
 		auto sharedPtr = mThis.lock(); // Make sure we keep a reference because calling _setToggleGroup(nullptr) 
 		                               // may otherwise clear the last reference and cause us to destruct