diff --git a/Telegram/SourceFiles/ui/controls/who_read_context_action.cpp b/Telegram/SourceFiles/ui/controls/who_read_context_action.cpp index a5203a27b..3e97339e6 100644 --- a/Telegram/SourceFiles/ui/controls/who_read_context_action.cpp +++ b/Telegram/SourceFiles/ui/controls/who_read_context_action.cpp @@ -112,6 +112,11 @@ Action::Action( updateUserpicsFromContent(); refreshText(); refreshDimensions(); + setPointerCursor(isEnabled()); + _dummyAction->setEnabled(isEnabled()); + if (!isEnabled()) { + setSelected(false); + } update(); }, lifetime()); @@ -172,6 +177,9 @@ void Action::updateUserpicsFromContent() { void Action::populateSubmenu() { if (_content.participants.size() < 2) { _parentMenu->removeSubmenu(action()); + if (!isEnabled()) { + setSelected(false); + } return; } const auto submenu = _parentMenu->ensureSubmenu(action()); @@ -186,15 +194,20 @@ void Action::populateSubmenu() { } void Action::paint(Painter &p) { + const auto enabled = isEnabled(); const auto selected = isSelected(); if (selected && _st.itemBgOver->c.alpha() < 255) { p.fillRect(0, 0, width(), _height, _st.itemBg); } p.fillRect(0, 0, width(), _height, selected ? _st.itemBgOver : _st.itemBg); - if (isEnabled()) { + if (enabled) { paintRipple(p, 0, 0); } - p.setPen(selected ? _st.itemFgOver : _st.itemFg); + p.setPen(!enabled + ? _st.itemFgDisabled + : selected + ? _st.itemFgOver + : _st.itemFg); _text.drawLeftElided( p, _st.itemPadding.left(), @@ -247,7 +260,7 @@ void Action::refreshDimensions() { } bool Action::isEnabled() const { - return true; + return !_content.participants.empty(); } not_null Action::action() const { diff --git a/Telegram/lib_ui b/Telegram/lib_ui index f4cf3094c..02c1bd567 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit f4cf3094c29e445256bd1c198323d393be4405c1 +Subproject commit 02c1bd567451152e4f15f674a21ca118421c3c3e diff --git a/cmake b/cmake index f343a1634..e97617c7c 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit f343a1634cbdefb476e9020687db30a356ffe8f2 +Subproject commit e97617c7c5e5e00a06b9b7fb2fa735e3a23e2673