window_adaptive.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. namespace Window {
  9. class Adaptive {
  10. public:
  11. enum class WindowLayout {
  12. OneColumn,
  13. Normal,
  14. ThreeColumn,
  15. };
  16. enum class ChatLayout {
  17. Normal,
  18. Wide,
  19. };
  20. Adaptive();
  21. void setWindowLayout(WindowLayout value);
  22. void setChatLayout(ChatLayout value);
  23. [[nodiscard]] rpl::producer<> value() const;
  24. [[nodiscard]] rpl::producer<> changes() const;
  25. [[nodiscard]] rpl::producer<bool> oneColumnValue() const;
  26. [[nodiscard]] rpl::producer<ChatLayout> chatLayoutValue() const;
  27. [[nodiscard]] bool isOneColumn() const;
  28. [[nodiscard]] bool isNormal() const;
  29. [[nodiscard]] bool isThreeColumn() const;
  30. [[nodiscard]] rpl::producer<bool> chatWideValue() const;
  31. [[nodiscard]] bool isChatWide() const;
  32. private:
  33. rpl::variable<ChatLayout> _chatLayout;
  34. rpl::variable<WindowLayout> _layout;
  35. };
  36. } // namespace Window