OpenXcom  1.0
Open-source clone of the original X-Com
ArrowButton.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include "ImageButton.h"
21 
22 namespace OpenXcom
23 {
24 
25 enum ArrowShape { ARROW_NONE, ARROW_BIG_UP, ARROW_BIG_DOWN, ARROW_SMALL_UP, ARROW_SMALL_DOWN, ARROW_SMALL_LEFT, ARROW_SMALL_RIGHT };
26 
27 class TextList;
28 class Timer;
29 
35 class ArrowButton : public ImageButton
36 {
37 private:
38  ArrowShape _shape;
39  TextList *_list;
40  Timer *_timer;
41 protected:
42  bool isButtonHandled(Uint8 button = 0);
43 public:
45  ArrowButton(ArrowShape shape, int width, int height, int x = 0, int y = 0);
47  ~ArrowButton();
49  void setColor(Uint8 color);
51  void setShape(ArrowShape shape);
53  void setTextList(TextList *list);
55  void think();
57  void scroll();
59  void draw();
61  void mousePress(Action *action, State *state);
63  void mouseRelease(Action *action, State *state);
65  void mouseClick(Action *action, State *state);
66 };
67 
68 }
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
void setColor(Uint8 color)
Sets the arrow button&#39;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:35
void setShape(ArrowShape shape)
Sets the arrow button&#39;s shape.
Definition: ArrowButton.cpp:75
List of Text&#39;s split into columns.
Definition: TextList.h:40
void scroll()
Scrolls the list.
Definition: ArrowButton.cpp:316
Regular image that works like a button.
Definition: ImageButton.h:32
void draw()
Draws the arrow button.
Definition: ArrowButton.cpp:94
void setTextList(TextList *list)
Sets the arrow button&#39;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:35
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
Definition: BaseInfoState.cpp:40
void mousePress(Action *action, State *state)
Special handling for mouse presses.
Definition: ArrowButton.cpp:333
void think()
Handles the timers.
Definition: ArrowButton.cpp:308