tdesktop/Telegram/SourceFiles/media/player/media_player_button.h

53 lines
1.3 KiB
C
Raw Normal View History

2016-09-15 16:32:49 +00:00
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
2016-09-15 16:32:49 +00:00
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
2016-09-15 16:32:49 +00:00
*/
#pragma once
#include "ui/abstract_button.h"
2019-04-02 09:13:30 +00:00
#include "ui/effects/animations.h"
#include "styles/style_media_player.h"
2016-09-15 16:32:49 +00:00
namespace Media {
namespace Player {
class PlayButtonLayout {
public:
enum class State {
Play,
Pause,
Cancel,
};
PlayButtonLayout(const style::MediaPlayerButton &st, Fn<void()> callback);
void setState(State state);
void finishTransform();
2022-09-16 20:23:27 +00:00
void paint(QPainter &p, const QBrush &brush);
private:
void animationCallback();
void startTransform(float64 from, float64 to);
2022-09-16 20:23:27 +00:00
void paintPlay(QPainter &p, const QBrush &brush);
void paintPlayToPause(QPainter &p, const QBrush &brush, float64 progress);
void paintPlayToCancel(QPainter &p, const QBrush &brush, float64 progress);
void paintPauseToCancel(QPainter &p, const QBrush &brush, float64 progress);
const style::MediaPlayerButton &_st;
State _state = State::Play;
State _oldState = State::Play;
State _nextState = State::Play;
2019-04-02 09:13:30 +00:00
Ui::Animations::Simple _transformProgress;
bool _transformBackward = false;
Fn<void()> _callback;
};
2019-02-27 11:36:19 +00:00
} // namespace Player
2016-09-15 16:32:49 +00:00
} // namespace Media