GUI
Scrollbar.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 by Maciej Wiecierzewski
3  */
4 
5 #ifndef SCROLLBAR_H
6 #define SCROLLBAR_H
7 
8 #include "Button.h"
9 #include "EventListener.h"
10 #include "Handle.h"
11 #include "MouseEvent.h"
12 #include "Renderer.h"
13 #include "Widget.h"
14 
15 namespace gui
16 {
17 
18 class GUISystem;
19 
21 
22 class Scrollbar : public Widget
23 {
24  public:
25  Scrollbar(GUISystem *guiSystem, int x, int y, int w, int h);
26  virtual ~Scrollbar() {};
27 
28  void render(Renderer *renderer);
29 
30  void downButtonClick(Event& event);
31  void upButtonClick(Event& event);
32  void sliderMouseDown(Event& event);
33  void sliderMouseUp(Event& event);
34  void sliderMouseMove(Event& event);
35 
36  void setSlider(float position);
37  void setSliderLength(float length);
38  float getSliderPosition() { return sliderPosition; }
39 
40  protected:
43 
44  private:
48 
50 
52  float sliderLength;
56 
57  friend class GUISystem;
58 };
59 
60 }
61 
62 #endif // SCROLLBAR_H