dragging_scroll_manager.h 706 B

12345678910111213141516171819202122232425262728293031323334
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. namespace base {
  9. class Timer;
  10. } // namespace base
  11. namespace Ui {
  12. class DraggingScrollManager final {
  13. public:
  14. DraggingScrollManager();
  15. void checkDeltaScroll(int delta);
  16. void checkDeltaScroll(const QPoint &point, int top, int bottom);
  17. void cancel();
  18. [[nodiscard]] rpl::producer<int> scrolls() const;
  19. private:
  20. void scrollByTimer();
  21. std::unique_ptr<base::Timer> _timer;
  22. int _delta = 0;
  23. rpl::event_stream<int> _scrolls;
  24. };
  25. } // namespace Ui