Fixed title elision in separate panels when back button is present.
This commit is contained in:
parent
893dab0920
commit
5d7445ce7d
2 changed files with 11 additions and 15 deletions
|
|
@ -21,6 +21,7 @@
|
||||||
#include "ui/layers/show.h"
|
#include "ui/layers/show.h"
|
||||||
#include "ui/style/style_core_palette.h"
|
#include "ui/style/style_core_palette.h"
|
||||||
#include "ui/painter.h"
|
#include "ui/painter.h"
|
||||||
|
#include "ui/rect.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/debug_log.h"
|
#include "base/debug_log.h"
|
||||||
#include "styles/style_widgets.h"
|
#include "styles/style_widgets.h"
|
||||||
|
|
@ -170,15 +171,13 @@ void SeparatePanel::initControls() {
|
||||||
) | rpl::start_with_next([=](int width) {
|
) | rpl::start_with_next([=](int width) {
|
||||||
_back->moveToLeft(_padding.left(), _padding.top());
|
_back->moveToLeft(_padding.left(), _padding.top());
|
||||||
_close->moveToRight(_padding.right(), _padding.top());
|
_close->moveToRight(_padding.right(), _padding.top());
|
||||||
if (_title) {
|
|
||||||
updateTitleGeometry(width);
|
updateTitleGeometry(width);
|
||||||
}
|
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_back->toggledValue(
|
_back->toggledValue(
|
||||||
) | rpl::start_with_next([=](bool toggled) {
|
) | rpl::start_with_next([=](bool toggled) {
|
||||||
_titleLeft.start(
|
_titleLeft.start(
|
||||||
[=] { updateTitlePosition(); },
|
[=] { updateTitleGeometry(width()); },
|
||||||
toggled ? 0. : 1.,
|
toggled ? 0. : 1.,
|
||||||
toggled ? 1. : 0.,
|
toggled ? 1. : 0.,
|
||||||
st::fadeWrapDuration);
|
st::fadeWrapDuration);
|
||||||
|
|
@ -238,15 +237,7 @@ void SeparatePanel::overrideTitleColor(std::optional<QColor> color) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeparatePanel::updateTitleGeometry(int newWidth) {
|
void SeparatePanel::updateTitleGeometry(int newWidth) const {
|
||||||
_title->resizeToWidth(newWidth
|
|
||||||
- _padding.left() - _back->width()
|
|
||||||
- _padding.right() - _close->width()
|
|
||||||
- (_menuToggle ? _menuToggle->width() : 0));
|
|
||||||
updateTitlePosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SeparatePanel::updateTitlePosition() {
|
|
||||||
if (!_title) {
|
if (!_title) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -255,6 +246,11 @@ void SeparatePanel::updateTitlePosition() {
|
||||||
st::separatePanelTitleLeft,
|
st::separatePanelTitleLeft,
|
||||||
_back->width() + st::separatePanelTitleSkip,
|
_back->width() + st::separatePanelTitleSkip,
|
||||||
progress);
|
progress);
|
||||||
|
_title->resizeToWidth(newWidth
|
||||||
|
- rect::m::sum::h(_padding)
|
||||||
|
- left
|
||||||
|
- _close->width()
|
||||||
|
- (_menuToggle ? _menuToggle->width() : 0));
|
||||||
_title->moveToLeft(
|
_title->moveToLeft(
|
||||||
_padding.left() + left,
|
_padding.left() + left,
|
||||||
_padding.top() + st::separatePanelTitleTop);
|
_padding.top() + st::separatePanelTitleTop);
|
||||||
|
|
@ -295,6 +291,7 @@ void SeparatePanel::setMenuAllowed(
|
||||||
_padding.right() + _close->width(),
|
_padding.right() + _close->width(),
|
||||||
_padding.top());
|
_padding.top());
|
||||||
}, _menuToggle->lifetime());
|
}, _menuToggle->lifetime());
|
||||||
|
updateTitleGeometry(width());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SeparatePanel::showMenu(Fn<void(const Menu::MenuCallback&)> fill) {
|
void SeparatePanel::showMenu(Fn<void(const Menu::MenuCallback&)> fill) {
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,7 @@ private:
|
||||||
void ensureLayerCreated();
|
void ensureLayerCreated();
|
||||||
void destroyLayer();
|
void destroyLayer();
|
||||||
|
|
||||||
void updateTitleGeometry(int newWidth);
|
void updateTitleGeometry(int newWidth) const;
|
||||||
void updateTitlePosition();
|
|
||||||
void paintShadowBorder(QPainter &p) const;
|
void paintShadowBorder(QPainter &p) const;
|
||||||
void paintOpaqueBorder(QPainter &p) const;
|
void paintOpaqueBorder(QPainter &p) const;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue