dialogs_layout.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 "dialogs/ui/dialogs_quick_action_context.h"
  9. #include "ui/cached_round_corners.h"
  10. namespace style {
  11. struct DialogRow;
  12. struct VerifiedBadge;
  13. } // namespace style
  14. namespace st {
  15. extern const style::DialogRow &defaultDialogRow;
  16. } // namespace st
  17. namespace Data {
  18. class Forum;
  19. class Folder;
  20. } // namespace Data
  21. namespace Dialogs {
  22. class Row;
  23. class FakeRow;
  24. class BasicRow;
  25. struct RightButton;
  26. } // namespace Dialogs
  27. namespace Dialogs::Ui {
  28. using namespace ::Ui;
  29. class VideoUserpic;
  30. struct TopicJumpCorners {
  31. CornersPixmaps normal;
  32. CornersPixmaps inverted;
  33. QPixmap small;
  34. int invertedRadius = 0;
  35. int smallKey = 0; // = `-radius` if top right else `radius`.
  36. };
  37. struct TopicJumpCache {
  38. TopicJumpCorners corners;
  39. TopicJumpCorners over;
  40. TopicJumpCorners selected;
  41. TopicJumpCorners rippleMask;
  42. };
  43. struct PaintContext {
  44. RightButton *rightButton = nullptr;
  45. std::vector<QImage*> *chatsFilterTags = nullptr;
  46. QuickActionContext *quickActionContext = nullptr;
  47. not_null<const style::DialogRow*> st;
  48. TopicJumpCache *topicJumpCache = nullptr;
  49. Data::Folder *folder = nullptr;
  50. Data::Forum *forum = nullptr;
  51. required<QBrush> currentBg;
  52. FilterId filter = 0;
  53. float64 topicsExpanded = 0.;
  54. crl::time now = 0;
  55. int width = 0;
  56. bool active = false;
  57. bool selected = false;
  58. bool topicJumpSelected = false;
  59. bool paused = false;
  60. bool search = false;
  61. bool narrow = false;
  62. bool displayUnreadInfo = false;
  63. };
  64. [[nodiscard]] const style::icon *ChatTypeIcon(
  65. not_null<PeerData*> peer,
  66. const PaintContext &context);
  67. [[nodiscard]] const style::icon *ChatTypeIcon(not_null<PeerData*> peer);
  68. [[nodiscard]] const style::VerifiedBadge &VerifiedStyle(
  69. const PaintContext &context);
  70. class RowPainter {
  71. public:
  72. static void Paint(
  73. Painter &p,
  74. not_null<const Row*> row,
  75. VideoUserpic *videoUserpic,
  76. const PaintContext &context);
  77. static void Paint(
  78. Painter &p,
  79. not_null<const FakeRow*> row,
  80. const PaintContext &context);
  81. static QRect SendActionAnimationRect(
  82. not_null<const style::DialogRow*> st,
  83. int animationLeft,
  84. int animationWidth,
  85. int animationHeight,
  86. int fullWidth,
  87. bool textUpdated);
  88. };
  89. void PaintCollapsedRow(
  90. Painter &p,
  91. const BasicRow &row,
  92. Data::Folder *folder,
  93. const QString &text,
  94. int unread,
  95. const PaintContext &context);
  96. } // namespace Dialogs::Ui