PolyUIVScrollBar.h 877 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * PolyUIVScrollBar.h
  3. * Poly
  4. *
  5. * Created by Ivan Safrin on 3/25/10.
  6. * Copyright 2010 Ivan Safrin. All rights reserved.
  7. *
  8. */
  9. #pragma once
  10. #include "PolyGlobals.h"
  11. #include "PolyUIBox.h"
  12. namespace Polycode {
  13. class _PolyExport UIVScrollBar : public ScreenEntity {
  14. public:
  15. UIVScrollBar(float width, float height, float initialRatio);
  16. ~UIVScrollBar();
  17. void Update();
  18. float getScrollValue();
  19. void handleEvent(Event *event);
  20. void Resize(int newHeight);
  21. void onMouseWheelDown(float x, float y);
  22. void onMouseWheelUp(float x, float y);
  23. void scrollUpOneTick();
  24. void scrollDownOneTick();
  25. float minHandleSize;
  26. void setHandleRatio(float newRatio);
  27. private:
  28. float padding;
  29. float scrollValue;
  30. float lastPositionY;
  31. float scrollHandleHeight;
  32. float dragRectHeight;
  33. UIBox *bgBox;
  34. UIBox *handleBox;
  35. };
  36. }