tdesktop/Telegram/SourceFiles/history/view/media/history_view_large_emoji.h

65 lines
1.4 KiB
C
Raw Normal View History

2019-08-02 20:19:14 +02: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
#include "history/view/media/history_view_media_unwrapped.h"
#include "ui/text/text_isolated_emoji.h"
2020-05-29 16:29:21 +02:00
namespace Stickers {
struct LargeEmojiImage;
} // namespace Stickers
2019-08-02 20:19:14 +02:00
namespace HistoryView {
2022-07-25 16:54:37 +02:00
using LargeEmojiMedia = std::variant<
v::null_t,
std::shared_ptr<Stickers::LargeEmojiImage>,
std::unique_ptr<Ui::Text::CustomEmoji>>;
2019-08-02 20:19:14 +02:00
class LargeEmoji final : public UnwrappedMedia::Content {
public:
LargeEmoji(
not_null<Element*> parent,
2019-08-05 13:44:40 +02:00
const Ui::Text::IsolatedEmoji &emoji);
2022-07-26 12:17:04 +02:00
~LargeEmoji();
2019-08-02 20:19:14 +02:00
QSize countOptimalSize() override;
void draw(
Painter &p,
const PaintContext &context,
const QRect &r) override;
2019-08-02 20:19:14 +02:00
2019-08-06 13:27:11 +02:00
bool alwaysShowOutTimestamp() override {
return true;
}
2022-07-27 00:10:56 +02:00
bool hasTextForCopy() const override {
return true;
}
2019-08-06 13:27:11 +02:00
2022-07-25 16:54:37 +02:00
bool hasHeavyPart() const override;
void unloadHeavyPart() override;
2019-08-02 20:19:14 +02:00
private:
2022-07-25 16:54:37 +02:00
void paintCustom(
QPainter &p,
int x,
int y,
not_null<Ui::Text::CustomEmoji*> emoji,
const PaintContext &context,
bool paused);
2019-08-02 20:19:14 +02:00
const not_null<Element*> _parent;
2022-07-25 16:54:37 +02:00
const std::array<LargeEmojiMedia, Ui::Text::kIsolatedEmojiLimit> _images;
QImage _selectedFrame;
2019-08-02 20:19:14 +02:00
QSize _size;
2022-07-25 16:54:37 +02:00
bool _hasHeavyPart = false;
2019-08-02 20:19:14 +02:00
};
} // namespace HistoryView