Simple SFML GUI  0.2a
PanelScrolled.hpp
1 #ifndef PANELSCROLLED_HPP
2 #define PANELSCROLLED_HPP
3 
4 #include "Panel.hpp"
5 #include "Button.hpp"
6 
7 class PanelScrolled : public Panel {
8 public:
10  virtual ~PanelScrolled();
11  virtual bool update(sf::Vector2f mp, bool pressLeft, bool pressRight, bool aboveHover);
12  virtual void draw(sf::RenderTarget& target, sf::RenderStates states);
13  virtual void updateArea();
14 
15  bool addScroll(float delta, Orientation type);
16  void centerScroll(sf::Vector2f position);
17 
18  void setVerticalScrollVelocityMultiplier(float value);
19  void setHorizontalScrollVelocityMultiplier(float value);
20  void setVerticalScrollBrakeMultiplier(float value);
21  void setHorizontalScrollBrakeMultiplier(float value);
22  static bool notifyScroll(float delta, Orientation type);
23  const float scrollVisibleTime = 2.f;
24  void setScrollType(ScrollType value);
25  void setScrollEnable(ScrollEnable value);
26  void setScrollButtonThick(float value);
27  void setScrollButtonSize(float value);
28  std::pair<float, float> getVerticalScrollLimits() const;
29  std::pair<float, float> getHorizontalScrollLimits() const;
30  sf::Vector2f getScrollSize() const;
31 
32  const Button& getVerticalScrollButton() const;
33  const Button& getHorizontalScrollButton() const;
34  const Panel& getVerticalScrollPanel() const;
35  const Panel& getHorizontalScrollPanel() const;
36 
37 protected:
38  Button verticalScrollButton;
39  Button horizontalScrollButton;
40  Panel verticalScrollPanel;
41  Panel horizontalScrollPanel;
42  sf::Vector2f scroll;
43  sf::Vector2f scrollSize;
44  sf::Vector2f scrollVelocity;
45  sf::FloatRect insideRelativeArea;
46  std::pair<float, float> verticalLimits;
47  std::pair<float, float> horizontalLimits;
48  float scrollVisibleTimer;
49  float verticalScrollWakeTimer;
50  float horizontalScrollWakeTimer;
51  float verticalScrollVelocityMultiplier;
52  float horizontalScrollVelocityMultiplier;
53  float verticalScrollBrakeMultiplier;
54  float horizontalScrollBrakeMultiplier;
55  float buttonSize;
56  float buttonThick;
57  ScrollType scrollType;
58  ScrollEnable scrollEnable;
59  static PanelScrolled* lastPanelScrolledHovered;
60 
61  const float scrollSizeThreshold = 1.5f;
62 
63 private:
64  void updateVerticalLimits();
65  bool updateAreaInternal();
66 };
67 
68 typedef std::shared_ptr<PanelScrolled> PanelScrolledPtr;
69 
70 #endif // PANELSCROLLED_HPP
Definition: Panel.hpp:29
Pressable button with some configuration options.
Definition: Button.hpp:41
Definition: PanelScrolled.hpp:7