Add menuToggle style.

This commit is contained in:
John Preston 2019-09-20 14:10:25 +03:00
parent b4beb6abed
commit 82ccac3200
6 changed files with 38 additions and 10 deletions

BIN
icons/title_menu_dots.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 B

View file

@ -222,8 +222,8 @@ void DropdownMenu::childHiding(DropdownMenu *child) {
void DropdownMenu::hideFinish() { void DropdownMenu::hideFinish() {
_menu->clearSelection(); _menu->clearSelection();
if (_hiddenCallback) { if (const auto onstack = _hiddenCallback) {
_hiddenCallback(); onstack();
} }
} }

View file

@ -234,10 +234,13 @@ void InnerDropdown::hideFinished() {
_cache = QPixmap(); _cache = QPixmap();
_ignoreShowEvents = false; _ignoreShowEvents = false;
if (!isHidden()) { if (!isHidden()) {
if (_hiddenCallback) { const auto weak = Ui::MakeWeak(this);
_hiddenCallback(); if (const auto onstack = _hiddenCallback) {
onstack();
}
if (weak) {
hide();
} }
hide();
} }
} }
@ -256,19 +259,27 @@ void InnerDropdown::prepareCache() {
} }
void InnerDropdown::startOpacityAnimation(bool hiding) { void InnerDropdown::startOpacityAnimation(bool hiding) {
const auto weak = Ui::MakeWeak(this);
if (hiding) { if (hiding) {
if (_hideStartCallback) { if (const auto onstack = _hideStartCallback) {
_hideStartCallback(); onstack();
} }
} else if (_showStartCallback) { } else if (const auto onstack = _showStartCallback) {
_showStartCallback(); onstack();
}
if (!weak) {
return;
} }
_hiding = false; _hiding = false;
prepareCache(); prepareCache();
_hiding = hiding; _hiding = hiding;
hideChildren(); hideChildren();
_a_opacity.start([this] { opacityAnimationCallback(); }, _hiding ? 1. : 0., _hiding ? 0. : 1., _st.duration); _a_opacity.start(
[=] { opacityAnimationCallback(); },
_hiding ? 1. : 0.,
_hiding ? 0. : 1.,
_st.duration);
} }
void InnerDropdown::showStarted() { void InnerDropdown::showStarted() {

View file

@ -1128,3 +1128,20 @@ defaultLevelMeter: LevelMeter {
activeFg: mediaPlayerActiveFg; activeFg: mediaPlayerActiveFg;
inactiveFg: mediaPlayerInactiveFg; inactiveFg: mediaPlayerInactiveFg;
} }
menuToggleIcon: icon {{ "title_menu_dots", menuIconFg }};
menuToggleIconOver: icon {{ "title_menu_dots", menuIconFgOver }};
menuToggle: IconButton {
width: 40px;
height: 40px;
icon: menuToggleIcon;
iconOver: menuToggleIconOver;
iconPosition: point(16px, 10px);
rippleAreaPosition: point(0px, 0px);
rippleAreaSize: 40px;
ripple: RippleAnimation(defaultRippleAnimation) {
color: windowBgOver;
}
}