OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ToggleTextButton.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU 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  * OpenXcom 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 General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __OXC_TOGGLETEXTBUTTON_H
21 #define __OXC_TOGGLETEXTBUTTON_H
22 
23 
24 #include "TextButton.h"
25 #include "../Engine/Action.h"
26 #include "../Engine/State.h"
27 
28 namespace OpenXcom
29 {
30 
32  public TextButton
33 {
34 private:
35  bool _isPressed;
36  int _invertMid;
37  TextButton *_fakeGroup;
38 
39 public:
40 
41  void draw();
42  void mousePress(Action *action, State *state);
43  void setPressed(bool pressed);
44  bool getPressed() const { return _isPressed; }
45  void setInvertColor(Uint8 mid);
46  ToggleTextButton(int width, int height, int x, int y);
47  ~ToggleTextButton(void);
48 };
49 
50 }
51 
52 #endif
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
A game state that receives user input and reacts accordingly.
Definition: State.h:44
void setPressed(bool pressed)
set the _isPressed state of the button and force it to redraw
Definition: ToggleTextButton.cpp:53
Definition: ToggleTextButton.h:31
void draw()
handle draw() in case we need to paint the button a garish color
Definition: ToggleTextButton.cpp:70
void setInvertColor(Uint8 mid)
When this is set, Surface::invert() is called with the value from mid when it's time to invert the bu...
Definition: ToggleTextButton.cpp:62
void mousePress(Action *action, State *state)
handle mouse clicks by toggling the button state; use _fakeGroup to trick TextButton into drawing the...
Definition: ToggleTextButton.cpp:40
Coloured button with a text label.
Definition: TextButton.h:40