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

57 lines
1.3 KiB
C
Raw Normal View History

2020-03-04 09:21:19 +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
#include "history/view/media/history_view_media_unwrapped.h"
#include "history/view/media/history_view_sticker.h"
2020-03-06 12:12:03 +00:00
namespace Data {
class MediaDice;
} // namespace Data
2020-03-04 09:21:19 +00:00
namespace HistoryView {
class Dice final : public UnwrappedMedia::Content {
public:
2020-03-06 12:12:03 +00:00
Dice(not_null<Element*> parent, not_null<Data::MediaDice*> dice);
2020-03-04 09:21:19 +00:00
~Dice();
QSize size() override;
void draw(Painter &p, const QRect &r, bool selected) override;
ClickHandlerPtr link() override;
2020-05-26 13:40:36 +00:00
bool hasHeavyPart() const override {
return (_start ? _start->hasHeavyPart() : false)
|| (_end ? _end->hasHeavyPart() : false);
2020-04-08 10:53:28 +00:00
}
2020-03-04 09:21:19 +00:00
void unloadHeavyPart() override {
2020-04-19 12:17:53 +00:00
if (_start) {
_start->unloadHeavyPart();
}
2020-03-04 09:21:19 +00:00
if (_end) {
_end->unloadHeavyPart();
}
}
2020-03-06 07:53:59 +00:00
bool hidesForwardedInfo() override {
return false;
}
2020-03-04 09:21:19 +00:00
private:
const not_null<Element*> _parent;
2020-03-06 12:12:03 +00:00
const not_null<Data::MediaDice*> _dice;
ClickHandlerPtr _link;
2020-04-19 12:17:53 +00:00
std::optional<Sticker> _start;
2020-03-04 09:21:19 +00:00
std::optional<Sticker> _end;
mutable bool _showLastFrame = false;
2020-03-04 09:21:19 +00:00
mutable bool _drawingEnd = false;
};
} // namespace HistoryView