OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ArrowButton.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 #ifndef OPENXCOM_ARROWBUTTON_H
20 #define OPENXCOM_ARROWBUTTON_H
21 
22 #include "ImageButton.h"
23 
24 namespace OpenXcom
25 {
26 
27 enum ArrowShape { ARROW_NONE, ARROW_BIG_UP, ARROW_BIG_DOWN, ARROW_SMALL_UP, ARROW_SMALL_DOWN, ARROW_SMALL_LEFT, ARROW_SMALL_RIGHT };
28 
29 class TextList;
30 class Timer;
31 
37 class ArrowButton : public ImageButton
38 {
39 private:
40  ArrowShape _shape;
41  TextList *_list;
42  Timer *_timer;
43 protected:
44  bool isButtonHandled(Uint8 button = 0);
45 public:
47  ArrowButton(ArrowShape shape, int width, int height, int x = 0, int y = 0);
49  ~ArrowButton();
51  void setColor(Uint8 color);
53  void setShape(ArrowShape shape);
55  void setTextList(TextList *list);
57  void think();
59  void scroll();
61  void draw();
63  void mousePress(Action *action, State *state);
65  void mouseRelease(Action *action, State *state);
67  void mouseClick(Action *action, State *state);
68 };
69 
70 }
71 
72 #endif
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
void setColor(Uint8 color)
Sets the arrow button's color.
Definition: ArrowButton.cpp:65
void mouseClick(Action *action, State *state)
Special handling for mouse clicks.
Definition: ArrowButton.cpp:366
A game state that receives user input and reacts accordingly.
Definition: State.h:44
Timer used to run code in fixed intervals.
Definition: Timer.h:37
void setShape(ArrowShape shape)
Sets the arrow button's shape.
Definition: ArrowButton.cpp:75
List of Text's split into columns.
Definition: TextList.h:42
void scroll()
Scrolls the list.
Definition: ArrowButton.cpp:316
Regular image that works like a button.
Definition: ImageButton.h:34
void draw()
Draws the arrow button.
Definition: ArrowButton.cpp:94
void setTextList(TextList *list)
Sets the arrow button's list.
Definition: ArrowButton.cpp:86
bool isButtonHandled(Uint8 button=0)
Is this mouse button event handled?
Definition: ArrowButton.cpp:49
~ArrowButton()
Cleans up the arrow button.
Definition: ArrowButton.cpp:44
Button with an arrow on it.
Definition: ArrowButton.h:37
void mouseRelease(Action *action, State *state)
Special handling for mouse releases.
Definition: ArrowButton.cpp:352
ArrowButton(ArrowShape shape, int width, int height, int x=0, int y=0)
Creates a new arrow button with the specified size and position.
Definition: ArrowButton.cpp:35
void mousePress(Action *action, State *state)
Special handling for mouse presses.
Definition: ArrowButton.cpp:333
void think()
Handles the timers.
Definition: ArrowButton.cpp:308