mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Added history view LambdaGenericPart.
This commit is contained in:
@@ -391,6 +391,35 @@ QSize TextDelimeterPart::countCurrentSize(int newWidth) {
|
||||
return { newWidth, minHeight() };
|
||||
}
|
||||
|
||||
LambdaGenericPart::LambdaGenericPart(
|
||||
QSize size,
|
||||
Fn<void(
|
||||
Painter &p,
|
||||
not_null<const MediaGeneric*> owner,
|
||||
const PaintContext &context,
|
||||
int outerWidth)> draw)
|
||||
: _size(size)
|
||||
, _draw(std::move(draw)) {
|
||||
}
|
||||
|
||||
void LambdaGenericPart::draw(
|
||||
Painter &p,
|
||||
not_null<const MediaGeneric*> owner,
|
||||
const PaintContext &context,
|
||||
int outerWidth) const {
|
||||
if (_draw) {
|
||||
_draw(p, owner, context, outerWidth);
|
||||
}
|
||||
}
|
||||
|
||||
QSize LambdaGenericPart::countOptimalSize() {
|
||||
return _size;
|
||||
}
|
||||
|
||||
QSize LambdaGenericPart::countCurrentSize(int newWidth) {
|
||||
return { newWidth, _size.height() };
|
||||
}
|
||||
|
||||
StickerInBubblePart::StickerInBubblePart(
|
||||
not_null<Element*> parent,
|
||||
Element *replacing,
|
||||
|
||||
@@ -194,6 +194,35 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class LambdaGenericPart final : public MediaGenericPart {
|
||||
public:
|
||||
LambdaGenericPart(
|
||||
QSize size,
|
||||
Fn<void(
|
||||
Painter &p,
|
||||
not_null<const MediaGeneric*> owner,
|
||||
const PaintContext &context,
|
||||
int outerWidth)> draw);
|
||||
|
||||
void draw(
|
||||
Painter &p,
|
||||
not_null<const MediaGeneric*> owner,
|
||||
const PaintContext &context,
|
||||
int outerWidth) const override;
|
||||
|
||||
QSize countOptimalSize() override;
|
||||
QSize countCurrentSize(int newWidth) override;
|
||||
|
||||
private:
|
||||
QSize _size;
|
||||
Fn<void(
|
||||
Painter &p,
|
||||
not_null<const MediaGeneric*> owner,
|
||||
const PaintContext &context,
|
||||
int outerWidth)> _draw;
|
||||
|
||||
};
|
||||
|
||||
class StickerInBubblePart final : public MediaGenericPart {
|
||||
public:
|
||||
struct Data {
|
||||
|
||||
Reference in New Issue
Block a user