Allow to change some styles in CallButton.
This commit is contained in:
parent
14c67cf724
commit
3c1866f52d
2 changed files with 21 additions and 0 deletions
|
|
@ -26,6 +26,10 @@ CallButton::CallButton(
|
|||
: RippleButton(parent, stFrom.button.ripple)
|
||||
, _stFrom(&stFrom)
|
||||
, _stTo(stTo) {
|
||||
init();
|
||||
}
|
||||
|
||||
void CallButton::init() {
|
||||
resize(_stFrom->button.width, _stFrom->button.height);
|
||||
|
||||
_bgMask = RippleAnimation::ellipseMask(QSize(_stFrom->bgSize, _stFrom->bgSize));
|
||||
|
|
@ -221,6 +225,18 @@ void CallButton::setColorOverrides(rpl::producer<CallButtonColors> &&colors) {
|
|||
}, lifetime());
|
||||
}
|
||||
|
||||
void CallButton::setStyle(
|
||||
const style::CallButton &stFrom,
|
||||
const style::CallButton *stTo) {
|
||||
if (_stFrom == &stFrom && _stTo == stTo) {
|
||||
return;
|
||||
}
|
||||
_stFrom = &stFrom;
|
||||
_stTo = stTo;
|
||||
init();
|
||||
update();
|
||||
}
|
||||
|
||||
QPoint CallButton::prepareRippleStartPosition() const {
|
||||
return mapFromGlobal(QCursor::pos()) - _stFrom->button.rippleAreaPosition;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ public:
|
|||
void setText(rpl::producer<QString> text);
|
||||
void setColorOverrides(rpl::producer<CallButtonColors> &&colors);
|
||||
|
||||
void setStyle(
|
||||
const style::CallButton &stFrom,
|
||||
const style::CallButton *stTo = nullptr);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
|
|
@ -40,6 +44,7 @@ protected:
|
|||
QPoint prepareRippleStartPosition() const override;
|
||||
|
||||
private:
|
||||
void init();
|
||||
QPoint iconPosition(not_null<const style::CallButton*> st) const;
|
||||
void mixIconMasks();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue