continuous_scroll.h 874 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. #include "ui/widgets/scroll_area.h"
  9. #include "base/qt_connection.h"
  10. namespace Ui {
  11. // This class is designed for seamless scrolling of
  12. // on-demand augmented content.
  13. class ContinuousScroll final : public ScrollArea {
  14. public:
  15. using ScrollArea::ScrollArea;
  16. [[nodiscard]] rpl::producer<> addContentRequests() const;
  17. void contentAdded();
  18. void setTrackingContent(bool value);
  19. protected:
  20. void wheelEvent(QWheelEvent *e) override;
  21. private:
  22. void reconnect();
  23. base::qt_connection _connection;
  24. bool _contentAdded = false;
  25. bool _tracking = false;
  26. rpl::event_stream<> _addContentRequests;
  27. };
  28. } // namespace Ui