AbstractButton.hpp
1 /*
2  * Copyright © 2013 mathdu07
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ABSTRACTBUTTON_H_
19 #define ABSTRACTBUTTON_H_
20 
21 #include <SFML/UI/Focusable.hpp>
22 
23 namespace sf
24 {
25 namespace ui
26 {
27 
28 class AbstractButton : public Focusable
29 {
30 public:
31  //CONSTRUCTORS/DESTRUCTORS -------------------------------------------
32 
39 
48  AbstractButton(sf::Texture const &texture, sf::Texture const &textureFocused);
49 
50  virtual ~AbstractButton();
51  //--------------------------------------------------------------------
52 
53  //METHODS ------------------------------------------------------------
54 protected:
62  virtual void onClick() = 0;
63 
64 public:
71  virtual void updateEvent(sf::Event const &event);
72  //--------------------------------------------------------------------
73 
74  //GETTERS/SETTERS ----------------------------------------------------
75 
76  //--------------------------------------------------------------------
77 
78  //FIELDS -------------------------------------------------------------
79 
80  //--------------------------------------------------------------------
81 };
82 
83 } /* namespace ui */
84 } /* namespace sf */
85 #endif /* ABSTRACTBUTTON_H_ */
86 
The base class for all UI components that can be focused.
Definition: Focusable.hpp:28
virtual void onClick()=0
Called when the button is clicked.
virtual void updateEvent(sf::Event const &event)
Update the component each time an event has been polled.
AbstractButton()
Creates an empty abstract button that is implemented by buttons, check box ...
Abstract class for all component that are button-like.