// This file is part of Desktop App Toolkit, // a set of libraries for developing nice desktop applications. // // For license and copyright information please follow this link: // https://github.com/desktop-app/legal/blob/master/LEGAL // #pragma once #include "base/object_ptr.h" #include "ui/widgets/buttons.h" #include "ui/effects/animations.h" namespace Ui { class FlatLabel; struct CallButtonColors { std::optional bg; std::optional ripple; }; class CallButton final : public RippleButton { public: CallButton( QWidget *parent, const style::CallButton &stFrom, const style::CallButton *stTo = nullptr); void setProgress(float64 progress); void setOuterValue(float64 value); void setText(rpl::producer text); void setColorOverrides(rpl::producer &&colors); void setStyle( const style::CallButton &stFrom, const style::CallButton *stTo = nullptr); protected: void paintEvent(QPaintEvent *e) override; void onStateChanged(State was, StateChangeSource source) override; QImage prepareRippleMask() const override; QPoint prepareRippleStartPosition() const override; private: void init(); QPoint iconPosition(not_null st) const; void mixIconMasks(); not_null _stFrom; const style::CallButton *_stTo = nullptr; float64 _progress = 0.; object_ptr _label = { nullptr }; std::optional _bgOverride; std::optional _rippleOverride; QImage _bgMask, _bg; QPixmap _bgFrom, _bgTo; QImage _iconMixedMask, _iconFrom, _iconTo, _iconMixed; float64 _outerValue = 0.; Animations::Simple _outerAnimation; }; } // namespace Ui