From f06e8a2fcf92ec55a88b3c08d935241fc4547c5a Mon Sep 17 00:00:00 2001 From: Jamie Booth Date: Tue, 10 Nov 2015 14:00:13 +1100 Subject: [PATCH 1/3] Added Justification to Button, ToggleButton and Label Added the ability to justify text (left, centre, right) for a button, togglebutton and label, which also Fixes #27. Examples have not been created as yet, and current examples impacted by this change have not been updated. I'll do this once the change is approved. --- include/SFGUI/Alignment.hpp | 2 +- include/SFGUI/Button.hpp | 3 +- include/SFGUI/Misc.hpp | 36 ++++++++++++++++++++--- include/SFGUI/ToggleButton.hpp | 1 + src/SFGUI/Alignment.cpp | 6 ++-- src/SFGUI/Button.cpp | 1 + src/SFGUI/Engines/BREW/Button.cpp | 38 ++++++++++++++++++------- src/SFGUI/Engines/BREW/Frame.cpp | 2 +- src/SFGUI/Engines/BREW/Image.cpp | 4 +-- src/SFGUI/Engines/BREW/Label.cpp | 23 ++++++++++++--- src/SFGUI/Engines/BREW/ToggleButton.cpp | 20 ++++++++++--- src/SFGUI/Image.cpp | 2 +- src/SFGUI/Label.cpp | 3 +- src/SFGUI/Misc.cpp | 31 ++++++++++++++------ src/SFGUI/ResourceManager.cpp | 2 +- src/SFGUI/ToggleButton.cpp | 1 + 16 files changed, 133 insertions(+), 42 deletions(-) diff --git a/include/SFGUI/Alignment.hpp b/include/SFGUI/Alignment.hpp index f4040ecf..051f8a96 100644 --- a/include/SFGUI/Alignment.hpp +++ b/include/SFGUI/Alignment.hpp @@ -40,7 +40,7 @@ class SFGUI_API Alignment : public Bin, public Misc { private: void HandleSizeChange() override; - void HandleAlignmentChange( const sf::Vector2f& old_alignment ) override; + void HandleAlignmentChange( const Misc::Alignment& old_alignment ) override; void UpdateChild(); diff --git a/include/SFGUI/Button.hpp b/include/SFGUI/Button.hpp index f2ed9c8a..7d6fdab0 100644 --- a/include/SFGUI/Button.hpp +++ b/include/SFGUI/Button.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -11,7 +12,7 @@ class Image; /** Pushbutton. */ -class SFGUI_API Button : public Bin { +class SFGUI_API Button : public Bin, public Misc { public: typedef std::shared_ptr