compose_show.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 "base/flags.h"
  9. #include "main/session/session_show.h"
  10. class PhotoData;
  11. class DocumentData;
  12. namespace Data {
  13. struct FileOrigin;
  14. } // namespace Data
  15. namespace Window {
  16. class SessionController;
  17. } // namespace Window
  18. namespace SendMenu {
  19. struct Details;
  20. } // namespace SendMenu
  21. namespace ChatHelpers {
  22. struct FileChosen;
  23. enum class PauseReason {
  24. Any = 0,
  25. InlineResults = (1 << 0),
  26. TabbedPanel = (1 << 1),
  27. Layer = (1 << 2),
  28. RoundPlaying = (1 << 3),
  29. MediaPreview = (1 << 4),
  30. };
  31. using PauseReasons = base::flags<PauseReason>;
  32. inline constexpr bool is_flag_type(PauseReason) { return true; };
  33. using ResolveWindow = Fn<Window::SessionController*(
  34. not_null<Main::Session*>)>;
  35. [[nodiscard]] ResolveWindow ResolveWindowDefault();
  36. class Show : public Main::SessionShow {
  37. public:
  38. virtual void activate() = 0;
  39. [[nodiscard]] virtual bool paused(PauseReason reason) const = 0;
  40. [[nodiscard]] virtual rpl::producer<> pauseChanged() const = 0;
  41. [[nodiscard]] virtual rpl::producer<bool> adjustShadowLeft() const;
  42. [[nodiscard]] virtual SendMenu::Details sendMenuDetails() const = 0;
  43. virtual bool showMediaPreview(
  44. Data::FileOrigin origin,
  45. not_null<DocumentData*> document) const = 0;
  46. virtual bool showMediaPreview(
  47. Data::FileOrigin origin,
  48. not_null<PhotoData*> photo) const = 0;
  49. virtual void processChosenSticker(FileChosen &&chosen) const = 0;
  50. [[nodiscard]] virtual Window::SessionController *resolveWindow() const;
  51. };
  52. } // namespace ChatHelpers