Neo  0.5.0
Developer Documentation
Button.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 (C) Yannick Pflanzer <neo-engine.de>
3  *
4  * This file is part of Neo2D.
5  *
6  * Neo2D is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Neo2D is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with Neo2D. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Diese Datei ist Teil von Neo2D.
20  *
21  * Neo2D ist Freie Software: Sie können es unter den Bedingungen
22  * der GNU Lesser General Public License, wie von der Free Software Foundation,
23  * Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
24  * veröffentlichten Version, weiterverbreiten und/oder modifizieren.
25  *
26  * Neo2D wird in der Hoffnung, dass es nützlich sein wird, aber
27  * OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
28  * Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
29  * Siehe die GNU Lesser General Public License für weitere Details.
30  *
31  * Sie sollten eine Kopie der GNU Lesser General Public License zusammen mit
32  *diesem
33  * Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
34  */
35 
36 #ifndef __BUTTON_H__
37 #define __BUTTON_H__
38 
39 #include <NeoEngine.h>
40 #include <Widget.h>
41 
42 namespace Neo2D
43 {
44 namespace Gui
45 {
46 
47 using namespace Neo;
48 
53 {
60 };
61 
67 class NEO2D_EXPORT Button : public Widget
68 {
69 protected:
72 
74  float m_fontSize;
75 
76 public:
77  Button(unsigned int x, unsigned int y, unsigned int width,
78  unsigned int height, const char* label);
79 
80  TEXT_ALIGN_MODES getAlignment() { return m_alignment; }
81  void setAlignment(TEXT_ALIGN_MODES align) { m_alignment = align; }
82 
83  void setButtonState(BUTTON_STATE s) { m_state = s; }
84  BUTTON_STATE getButtonState() { return m_state; }
85 
86  float getFontSize() { return m_fontSize; }
87  void setFontSize(float f) { m_fontSize = f; }
88 
89  void draw(Vector2 offset);
90  void update();
91 };
92 }
93 }
94 #endif
BUTTON_STATE
Definition: Button.h:52
void setAlignment(TEXT_ALIGN_MODES align)
Definition: Button.h:81
TEXT_ALIGN_MODES m_alignment
Definition: Button.h:73
void setFontSize(float f)
Definition: Button.h:87
Definition: OText.h:40
If the mouse is hovering over the button and the left mouse button is pressed.
Definition: Button.h:59
The Widget class contains all information that is common to all GUI widgets.
Definition: Widget.h:72
BUTTON_STATE m_state
Definition: Button.h:71
Implements a simple pushable button that calls the specified callback.
Definition: Button.h:67
TEXT_ALIGN_MODES
Definition: OText.h:32
float getFontSize()
Definition: Button.h:86
Definition: Vector2.h:31
Definition: Button.h:42
void setButtonState(BUTTON_STATE s)
Definition: Button.h:83
BUTTON_STATE getButtonState()
Definition: Button.h:84
float m_fontSize
Definition: Button.h:74
If the button is neither selected nor pressed.
Definition: Button.h:55
Definition: Color.h:29
If the button has the mouse cursor over it.
Definition: Button.h:57
TEXT_ALIGN_MODES getAlignment()
Definition: Button.h:80
OText * m_labelText
Definition: Button.h:70