2016-05-12 16:05:20 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-05-12 16:05:20 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-05-12 16:05:20 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2019-04-02 09:13:30 +00:00
|
|
|
#include "ui/effects/animations.h"
|
|
|
|
|
2016-05-19 12:03:51 +00:00
|
|
|
namespace Window {
|
|
|
|
|
2016-05-12 16:05:20 +00:00
|
|
|
enum class SlideDirection {
|
|
|
|
FromRight,
|
|
|
|
FromLeft,
|
|
|
|
};
|
|
|
|
|
|
|
|
class SlideAnimation {
|
|
|
|
public:
|
2022-02-23 10:53:27 +00:00
|
|
|
void paintContents(Painter &p) const;
|
2016-05-12 16:05:20 +00:00
|
|
|
|
|
|
|
void setDirection(SlideDirection direction);
|
2022-05-19 07:33:13 +00:00
|
|
|
void setPixmaps(
|
|
|
|
const QPixmap &oldContentCache,
|
|
|
|
const QPixmap &newContentCache);
|
2016-05-19 12:03:51 +00:00
|
|
|
void setTopBarShadow(bool enabled);
|
2022-02-23 10:53:27 +00:00
|
|
|
void setTopSkip(int skip);
|
2022-05-19 07:51:03 +00:00
|
|
|
void setTopBarMask(const QPixmap &mask);
|
2017-10-03 17:41:44 +00:00
|
|
|
void setWithFade(bool withFade);
|
2016-05-12 16:05:20 +00:00
|
|
|
|
2018-06-04 15:35:11 +00:00
|
|
|
using RepaintCallback = Fn<void()>;
|
2016-05-12 16:05:20 +00:00
|
|
|
void setRepaintCallback(RepaintCallback &&callback);
|
|
|
|
|
2018-06-04 15:35:11 +00:00
|
|
|
using FinishedCallback = Fn<void()>;
|
2016-05-12 16:05:20 +00:00
|
|
|
void setFinishedCallback(FinishedCallback &&callback);
|
|
|
|
|
|
|
|
void start();
|
|
|
|
|
2016-11-07 11:24:19 +00:00
|
|
|
static const anim::transition &transition() {
|
|
|
|
return anim::easeOutCirc;
|
|
|
|
}
|
|
|
|
|
2016-05-12 16:05:20 +00:00
|
|
|
private:
|
2016-11-11 08:59:55 +00:00
|
|
|
void animationCallback();
|
2016-05-12 16:05:20 +00:00
|
|
|
|
|
|
|
SlideDirection _direction = SlideDirection::FromRight;
|
2022-02-23 10:53:27 +00:00
|
|
|
int _topSkip = 0;
|
2016-05-19 12:03:51 +00:00
|
|
|
bool _topBarShadowEnabled = false;
|
2017-10-03 17:41:44 +00:00
|
|
|
bool _withFade = false;
|
2016-05-12 16:05:20 +00:00
|
|
|
|
2019-04-02 09:13:30 +00:00
|
|
|
mutable Ui::Animations::Simple _animation;
|
2016-05-12 16:05:20 +00:00
|
|
|
QPixmap _cacheUnder, _cacheOver;
|
2022-05-19 07:51:03 +00:00
|
|
|
QPixmap _mask;
|
2016-05-12 16:05:20 +00:00
|
|
|
|
|
|
|
RepaintCallback _repaintCallback;
|
|
|
|
FinishedCallback _finishedCallback;
|
|
|
|
|
|
|
|
};
|
2016-05-19 12:03:51 +00:00
|
|
|
|
|
|
|
} // namespace Window
|