2021-10-01 12:42:44 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2021-10-01 14:58:41 +00:00
|
|
|
#include <any>
|
|
|
|
|
|
|
|
class Image;
|
2021-10-01 12:42:44 +00:00
|
|
|
class HistoryItem;
|
2021-10-01 14:58:41 +00:00
|
|
|
enum class ImageRoundRadius;
|
2021-10-01 12:42:44 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace HistoryView {
|
|
|
|
struct ToPreviewOptions;
|
2021-10-04 19:37:55 +00:00
|
|
|
struct ItemPreviewImage;
|
2021-10-01 12:42:44 +00:00
|
|
|
struct ItemPreview;
|
|
|
|
} // namespace HistoryView
|
|
|
|
|
|
|
|
namespace Dialogs::Ui {
|
|
|
|
|
|
|
|
using namespace ::Ui;
|
|
|
|
|
|
|
|
class MessageView final {
|
|
|
|
public:
|
|
|
|
MessageView();
|
|
|
|
~MessageView();
|
|
|
|
|
|
|
|
using ToPreviewOptions = HistoryView::ToPreviewOptions;
|
2021-10-04 19:37:55 +00:00
|
|
|
using ItemPreviewImage = HistoryView::ItemPreviewImage;
|
2021-10-01 12:42:44 +00:00
|
|
|
using ItemPreview = HistoryView::ItemPreview;
|
|
|
|
|
|
|
|
void itemInvalidated(not_null<const HistoryItem*> item);
|
|
|
|
[[nodiscard]] bool dependsOn(not_null<const HistoryItem*> item) const;
|
|
|
|
|
|
|
|
void paint(
|
|
|
|
Painter &p,
|
|
|
|
not_null<const HistoryItem*> item,
|
|
|
|
const QRect &geometry,
|
|
|
|
bool active,
|
|
|
|
bool selected,
|
|
|
|
ToPreviewOptions options) const;
|
|
|
|
|
|
|
|
private:
|
2021-10-01 14:58:41 +00:00
|
|
|
struct LoadingContext;
|
|
|
|
|
2021-10-01 12:42:44 +00:00
|
|
|
mutable const HistoryItem *_textCachedFor = nullptr;
|
2021-10-04 07:58:31 +00:00
|
|
|
mutable Ui::Text::String _senderCache;
|
2021-10-01 12:42:44 +00:00
|
|
|
mutable Ui::Text::String _textCache;
|
2021-10-04 19:37:55 +00:00
|
|
|
mutable std::vector<ItemPreviewImage> _imagesCache;
|
2021-10-01 14:58:41 +00:00
|
|
|
mutable std::unique_ptr<LoadingContext> _loadingContext;
|
2021-10-01 12:42:44 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-10-04 07:58:31 +00:00
|
|
|
[[nodiscard]] HistoryView::ItemPreview PreviewWithSender(
|
|
|
|
HistoryView::ItemPreview &&preview,
|
|
|
|
const QString &sender);
|
|
|
|
|
2021-10-01 12:42:44 +00:00
|
|
|
} // namespace Dialogs::Ui
|