ScummVM API documentation
scrollbar.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program 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  * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NANCY_UI_SCROLLBAR_H
23 #define NANCY_UI_SCROLLBAR_H
24 
25 #include "engines/nancy/renderobject.h"
26 
27 namespace Nancy {
28 
29 struct NancyInput;
30 
31 namespace UI {
32 
33 class Scrollbar : public RenderObject {
34 public:
35  Scrollbar(uint16 zOrder, const Common::Rect &srcBounds, const Common::Point &topPosition, uint16 scrollDistance, bool isVertical = true);
36  Scrollbar(uint16 zOrder, const Common::Rect &srcBounds, Graphics::ManagedSurface &srcSurf, const Common::Point &topPosition, uint16 scrollDistance, bool isVertical = true);
37  virtual ~Scrollbar() = default;
38 
39  void init() override;
40 
41  void handleInput(NancyInput &input);
42 
43  void resetPosition();
44  float getPos() const { return _currentPosition; }
45 
46  void setPosition(float pos);
47  void calculatePosition();
48 
49  Common::Point _startPosition;
50  uint _maxDist;
51  bool _isVertical;
52 
53  float _currentPosition;
54  bool _isClicked;
55  Common::Point _mousePosOnClick;
56 };
57 
58 } // End of namespace UI
59 } // End of namespace Nancy
60 
61 #endif // NANCY_UI_SCROLLBAR_H
Definition: managed_surface.h:51
Definition: rect.h:144
Definition: scrollbar.h:33
Definition: input.h:41
Definition: soundequalizerpuzzle.h:27
Definition: renderobject.h:36
Definition: rect.h:45
Definition: actionmanager.h:32