mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to change width between pinned bar animation entries.
This commit is contained in:
parent
16f616c5e0
commit
1710890886
3 changed files with 9 additions and 3 deletions
|
@ -222,7 +222,7 @@ QRect MessageBar::bodyRect(bool withImage) const {
|
||||||
const auto top = st::msgReplyPadding.top();
|
const auto top = st::msgReplyPadding.top();
|
||||||
const auto width = _widget.width() - left - st::msgReplyPadding.right();
|
const auto width = _widget.width() - left - st::msgReplyPadding.right();
|
||||||
const auto height = st::msgReplyBarSize.height();
|
const auto height = st::msgReplyBarSize.height();
|
||||||
return QRect(left, top, width, height);
|
return QRect(left, top, width, height) - _content.margins;
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect MessageBar::bodyRect() const {
|
QRect MessageBar::bodyRect() const {
|
||||||
|
|
|
@ -24,6 +24,7 @@ struct MessageBarContent {
|
||||||
QString title;
|
QString title;
|
||||||
TextWithEntities text;
|
TextWithEntities text;
|
||||||
QImage preview;
|
QImage preview;
|
||||||
|
style::margins margins;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageBar final {
|
class MessageBar final {
|
||||||
|
|
|
@ -51,6 +51,12 @@ void PinnedBar::setContent(rpl::producer<Ui::MessageBarContent> content) {
|
||||||
if (creating) {
|
if (creating) {
|
||||||
createControls();
|
createControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In most cases the new right button should arrive
|
||||||
|
// before we want to get its width.
|
||||||
|
const auto right = _right.button ? _right.button->width() : 0;
|
||||||
|
content.margins = { 0, 0, right, 0 };
|
||||||
|
|
||||||
_bar->set(std::move(content));
|
_bar->set(std::move(content));
|
||||||
if (creating) {
|
if (creating) {
|
||||||
_bar->finishAnimating();
|
_bar->finishAnimating();
|
||||||
|
@ -96,8 +102,7 @@ void PinnedBar::setRightButton(object_ptr<Ui::RpWidget> button) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PinnedBar::updateControlsGeometry(QRect wrapGeometry) {
|
void PinnedBar::updateControlsGeometry(QRect wrapGeometry) {
|
||||||
_bar->widget()->resizeToWidth(
|
_bar->widget()->resizeToWidth(wrapGeometry.width());
|
||||||
wrapGeometry.width() - (_right.button ? _right.button->width() : 0));
|
|
||||||
const auto hidden = _wrap.isHidden() || !wrapGeometry.height();
|
const auto hidden = _wrap.isHidden() || !wrapGeometry.height();
|
||||||
if (_shadow->isHidden() != hidden) {
|
if (_shadow->isHidden() != hidden) {
|
||||||
_shadow->setVisible(!hidden);
|
_shadow->setVisible(!hidden);
|
||||||
|
|
Loading…
Add table
Reference in a new issue