1 /*
2 Copyright © 2011-2012 Clint Bellanger
3 Copyright © 2012-2015 Justin Jacobs
4 Copyright © 2013 Kurt Rinnert
5 Copyright © 2014 Henrik Andersson
6 
7 This file is part of FLARE.
8 
9 FLARE is free software: you can redistribute it and/or modify it under the terms
10 of the GNU General Public License as published by the Free Software Foundation,
11 either version 3 of the License, or (at your option) any later version.
12 
13 FLARE is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License along with
18 FLARE.  If not, see http://www.gnu.org/licenses/
19 */
20 
21 /**
22  * class WidgetScrollBar
23  */
24 
25 #ifndef WIDGET_ScrollBar_H
26 #define WIDGET_ScrollBar_H
27 
28 #include "CommonIncludes.h"
29 #include "Widget.h"
30 
31 class Sprite;
32 
33 class WidgetScrollBar : public Widget {
34 private:
35 
36 	std::string fileName; // the path to the ScrollBar's atlas
37 
38 	Sprite *scrollbars;
39 
40 	int value;
41 	int bar_height;
42 	int maximum;
43 	bool lock_main1;
44 	bool dragging;
45 
46 	Sprite *bg;
47 
48 	Rect up_to_knob;
49 	Rect knob_to_down;
50 
51 public:
52 	static const std::string DEFAULT_FILE;
53 
54 	explicit WidgetScrollBar(const std::string& _fileName);
55 	~WidgetScrollBar();
56 
57 	void loadArt();
58 	int checkClick();
59 	int checkClickAt(int x, int y);
60 	void set();
61 	int getValue();
62 	Rect getBounds();
63 	void render();
64 	void refresh(int x, int y, int h, int val, int max);
65 
66 	Rect pos_up;
67 	Rect pos_down;
68 	Rect pos_knob;
69 	bool pressed_up;
70 	bool pressed_down;
71 	bool pressed_knob;
72 };
73 
74 #endif
75