OpenXcom  1.0
Open-source clone of the original X-Com
ScrollBar.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 "../Engine/InteractiveSurface.h"
21 
22 namespace OpenXcom
23 {
24 
25 class TextList;
26 
31 {
32 private:
33  TextList *_list;
34  Uint8 _color;
35  bool _pressed, _contrast;
36  Surface *_track, *_thumb;
37  SDL_Rect _thumbRect;
38  int _offset;
39  Surface *_bg;
41  void drawTrack();
43  void drawThumb();
44 public:
46  ScrollBar(int width, int height, int x = 0, int y = 0);
48  ~ScrollBar();
50  void setX(int x);
52  void setY(int y);
54  void setHeight(int height);
56  void setColor(Uint8 color);
58  Uint8 getColor() const;
60  void setHighContrast(bool contrast);
62  void setTextList(TextList *list);
64  void setBackground(Surface *bg);
66  void setPalette(SDL_Color *colors, int firstcolor = 0, int ncolors = 256);
68  void blit(Surface *surface);
70  void handle(Action *action, State *state);
72  void mousePress(Action *action, State *state);
74  void mouseRelease(Action *action, State *state);
76  void draw();
77 };
78 
79 }
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:32
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&#39;s palette.
Definition: ScrollBar.cpp:142
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
Horizontal scrollbar control to select from a range of values.
Definition: ScrollBar.h:30
List of Text&#39;s split into columns.
Definition: TextList.h:40
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&#39;s list.
Definition: ScrollBar.cpp:122
void setColor(Uint8 color)
Sets the scrollbar&#39;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:38
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
Uint8 getColor() const
Gets the scrollbar&#39;s color.
Definition: ScrollBar.cpp:102
void setHighContrast(bool contrast)
Sets the scrollbar&#39;s high contrast color setting.
Definition: ScrollBar.cpp:112
Definition: BaseInfoState.cpp:40
void setY(int y)
Sets the Y position of the surface.
Definition: ScrollBar.cpp:70