2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-24 11:27:11 +00:00

73 lines
1.7 KiB
C
Raw Normal View History

/*
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
#include <any>
class Image;
class HistoryItem;
enum class ImageRoundRadius;
namespace Ui {
} // namespace Ui
namespace HistoryView {
struct ToPreviewOptions;
2021-10-04 23:37:55 +04:00
struct ItemPreviewImage;
struct ItemPreview;
} // namespace HistoryView
namespace Dialogs::Ui {
using namespace ::Ui;
struct PaintContext;
[[nodiscard]] TextWithEntities DialogsPreviewText(TextWithEntities text);
class MessageView final {
public:
MessageView();
~MessageView();
using ToPreviewOptions = HistoryView::ToPreviewOptions;
2021-10-04 23:37:55 +04:00
using ItemPreviewImage = HistoryView::ItemPreviewImage;
using ItemPreview = HistoryView::ItemPreview;
void itemInvalidated(not_null<const HistoryItem*> item);
[[nodiscard]] bool dependsOn(not_null<const HistoryItem*> item) const;
[[nodiscard]] bool prepared(not_null<const HistoryItem*> item) const;
void prepare(
not_null<const HistoryItem*> item,
Fn<void()> customEmojiRepaint,
ToPreviewOptions options);
void paint(
Painter &p,
const QRect &geometry,
const PaintContext &context) const;
private:
struct LoadingContext;
mutable const HistoryItem *_textCachedFor = nullptr;
2022-09-17 00:23:27 +04:00
mutable Text::String _senderCache;
2022-11-02 16:39:13 +04:00
mutable Text::String _topicCache;
2022-09-17 00:23:27 +04:00
mutable Text::String _textCache;
2021-10-04 23:37:55 +04:00
mutable std::vector<ItemPreviewImage> _imagesCache;
mutable std::unique_ptr<LoadingContext> _loadingContext;
};
2021-10-04 11:58:31 +04:00
[[nodiscard]] HistoryView::ItemPreview PreviewWithSender(
HistoryView::ItemPreview &&preview,
2022-11-02 16:39:13 +04:00
const QString &sender,
TextWithEntities topic);
2021-10-04 11:58:31 +04:00
} // namespace Dialogs::Ui