Simple SFML GUI  0.2a
Button.hpp
1 /*
2  * Button.hpp
3  *
4  * Created on: 17.03.2017
5  * Author: jakub
6  */
7 
23 #ifndef MENUBUTTON_HPP_
24 #define MENUBUTTON_HPP_
25 
26 #include <functional>
27 #include <SFML/Graphics.hpp>
28 #include "Pressable.hpp"
29 #include "Panel.hpp"
30 #include "PanelModelLine.hpp"
31 #include "TextLabel.hpp"
32 #include "HaveEnabled.hpp"
33 #include "HaveBackground.hpp"
34 #include "HaveOutline.hpp"
35 #include "HaveText.hpp"
36 #include "HaveFont.hpp"
37 #include "ColorAccess.hpp"
38 
39 #include "UTest.hpp"
40 
41 class Button :
42  public Pressable<Button&>,
43  public HaveEnabled,
44  public HaveBackground,
45  public HaveOutline,
46  public SetColorAccess,
47  public GetColorAccess {
48 public:
49  UT_FRIEND
50  Button();
51  Button(const Button& button);
52  Button(std::function<void(Button&)>&& action);
53  Button(std::function<void()>&& action);
54  Button(const sf::String& name);
55  Button(const sf::String& name, std::function<void(Button&)>&& action);
56  Button(const sf::String& name, std::function<void()>&& action);
57  Button(const sf::String& name, const sf::String& text);
58  Button(const sf::String& name, const sf::String& text, std::function<void(Button&)>&& action);
59  Button(const sf::String& name, const sf::String& text, std::function<void()>&& action);
60 
61  virtual void draw(sf::RenderTarget& target, sf::RenderStates states);
62  virtual bool update(sf::Vector2f mp, bool pressLeft, bool pressRight, bool aboveHover);
63  virtual void updateArea();
64 
65  TextLabel& getLabel();
66  const TextLabel& getLabel()const;
67 
68 private:
69  TextLabel label;
70 
71 };
72 
73 typedef std::shared_ptr<Button> ButtonPtr;
74 
75 #endif /* MENUBUTTON_HPP_ */
Definition: TextLabel.hpp:26
Definition: HaveBackground.hpp:28
Pressable button with some configuration options.
Definition: Button.hpp:41
Definition: ColorAccess.hpp:17
Definition: HaveEnabled.hpp:15
Button()
Default constructor.
Definition: Button.cpp:12
Definition: ColorAccess.hpp:26
Definition: HaveOutline.hpp:15
Definition: Pressable.hpp:42