OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ScrollBar.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_SCROLLBAR_H
20 #define OPENXCOM_SCROLLBAR_H
21 
22 #include "../Engine/InteractiveSurface.h"
23 
24 namespace OpenXcom
25 {
26 
27 class TextList;
28 
33 {
34 private:
35  TextList *_list;
36  Uint8 _color;
37  bool _pressed, _contrast;
38  Surface *_track, *_thumb;
39  SDL_Rect _thumbRect;
40  int _offset;
41  Surface *_bg;
43  void drawTrack();
45  void drawThumb();
46 public:
48  ScrollBar(int width, int height, int x = 0, int y = 0);
50  ~ScrollBar();
52  void setX(int x);
54  void setY(int y);
56  void setHeight(int height);
58  void setColor(Uint8 color);
60  Uint8 getColor() const;
62  void setHighContrast(bool contrast);
64  void setTextList(TextList *list);
66  void setBackground(Surface *bg);
68  void setPalette(SDL_Color *colors, int firstcolor = 0, int ncolors = 256);
70  void blit(Surface *surface);
72  void handle(Action *action, State *state);
74  void mousePress(Action *action, State *state);
76  void mouseRelease(Action *action, State *state);
78  void draw();
79 };
80 
81 }
82 
83 #endif
void draw()
Draws the scrollbar contents.
Definition: ScrollBar.cpp:232
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
void handle(Action *action, State *state)
Moves the scrollbar.
Definition: ScrollBar.cpp:155
void mousePress(Action *action, State *state)
Special handling for mouse presses.
Definition: ScrollBar.cpp:188
void mouseRelease(Action *action, State *state)
Special handling for mouse releases.
Definition: ScrollBar.cpp:219
A game state that receives user input and reacts accordingly.
Definition: State.h:44
void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the scrollbar's palette.
Definition: ScrollBar.cpp:142
Surface that the user can interact with.
Definition: InteractiveSurface.h:39
Horizontal scrollbar control to select from a range of values.
Definition: ScrollBar.h:32
List of Text's split into columns.
Definition: TextList.h:42
Uint8 getColor() const
Gets the scrollbar's color.
Definition: ScrollBar.cpp:102
void blit(Surface *surface)
Blits the scrollbar onto another surface.
Definition: ScrollBar.cpp:172
void setX(int x)
Sets the X position of the surface.
Definition: ScrollBar.cpp:59
void setTextList(TextList *list)
Sets the scrollbar's list.
Definition: ScrollBar.cpp:122
void setColor(Uint8 color)
Sets the scrollbar's color.
Definition: ScrollBar.cpp:93
void setBackground(Surface *bg)
Sets the background for the track.
Definition: ScrollBar.cpp:131
~ScrollBar()
Cleans up the scrollbar.
Definition: ScrollBar.cpp:49
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
ScrollBar(int width, int height, int x=0, int y=0)
Creates a new scrollbar with the specified size and position.
Definition: ScrollBar.cpp:36
void setHeight(int height)
Sets the height of the surface.
Definition: ScrollBar.cpp:81
void setHighContrast(bool contrast)
Sets the scrollbar's high contrast color setting.
Definition: ScrollBar.cpp:112
void setY(int y)
Sets the Y position of the surface.
Definition: ScrollBar.cpp:70