diff --git a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp index c2a059c90..3f98b5f23 100644 --- a/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp +++ b/Telegram/SourceFiles/info/channel_statistics/earn/info_channel_earn_list.cpp @@ -119,27 +119,6 @@ void ShowMenu(not_null box, const QString &text) { }); } -void AddArrow(not_null parent) { - const auto arrow = Ui::CreateChild(parent.get()); - arrow->paintRequest( - ) | rpl::start_with_next([=](const QRect &r) { - auto p = QPainter(arrow); - - const auto path = Ui::ToggleUpDownArrowPath( - st::statisticsShowMoreButtonArrowSize, - st::statisticsShowMoreButtonArrowSize, - st::statisticsShowMoreButtonArrowSize, - st::mainMenuToggleFourStrokes, - 0.); - - auto hq = PainterHighQualityEnabler(p); - p.fillPath(path, st::lightButtonFg); - }, arrow->lifetime()); - arrow->resize(Size(st::statisticsShowMoreButtonArrowSize * 2)); - arrow->move(st::statisticsShowMoreButtonArrowPosition); - arrow->show(); -} - void AddHeader( not_null content, tr::phrase<> text) { @@ -1372,7 +1351,7 @@ void InnerWidget::fill() { ) | tr::to_count()), st::statisticsShowMoreButton))); const auto button = wrap->entity(); - AddArrow(button); + Ui::AddToggleUpDownArrowToMoreButton(button); wrap->toggle(true, anim::type::instant); const auto handleReceived = [=]( diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp index 25c1d4f7d..a14d9141d 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp @@ -60,27 +60,6 @@ constexpr auto kColorIndexPending = int(4); + (entry.in ? '1' : '0')); } -void AddArrow(not_null parent) { - const auto arrow = Ui::CreateChild(parent.get()); - arrow->paintRequest( - ) | rpl::start_with_next([=](const QRect &r) { - auto p = QPainter(arrow); - - const auto path = Ui::ToggleUpDownArrowPath( - st::statisticsShowMoreButtonArrowSize, - st::statisticsShowMoreButtonArrowSize, - st::statisticsShowMoreButtonArrowSize, - st::mainMenuToggleFourStrokes, - 0.); - - auto hq = PainterHighQualityEnabler(p); - p.fillPath(path, st::lightButtonFg); - }, arrow->lifetime()); - arrow->resize(Size(st::statisticsShowMoreButtonArrowSize * 2)); - arrow->move(st::statisticsShowMoreButtonArrowPosition); - arrow->show(); -} - void AddSubtitle( not_null container, rpl::producer title) { @@ -1308,7 +1287,7 @@ not_null*> AddShowMoreButton( std::move(title), st::statisticsShowMoreButton)), { 0, -st::settingsButton.padding.top(), 0, 0 }); - AddArrow(wrap->entity()); + Ui::AddToggleUpDownArrowToMoreButton(wrap->entity()); return wrap; } diff --git a/Telegram/SourceFiles/ui/effects/toggle_arrow.cpp b/Telegram/SourceFiles/ui/effects/toggle_arrow.cpp index 57e152ff1..1c8779a93 100644 --- a/Telegram/SourceFiles/ui/effects/toggle_arrow.cpp +++ b/Telegram/SourceFiles/ui/effects/toggle_arrow.cpp @@ -7,6 +7,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "ui/effects/toggle_arrow.h" +#include "ui/rp_widget.h" +#include "ui/painter.h" +#include "ui/rect.h" +#include "styles/style_statistics.h" +#include "styles/style_window.h" + #include namespace Ui { @@ -50,4 +56,24 @@ namespace Ui { return path; } +void AddToggleUpDownArrowToMoreButton(not_null parent) { + const auto arrow = Ui::CreateChild(parent.get()); + arrow->paintRequest() | rpl::start_with_next([=](const QRect &r) { + auto p = QPainter(arrow); + + const auto path = ToggleUpDownArrowPath( + st::statisticsShowMoreButtonArrowSize, + st::statisticsShowMoreButtonArrowSize, + st::statisticsShowMoreButtonArrowSize, + st::mainMenuToggleFourStrokes, + 0.); + + auto hq = PainterHighQualityEnabler(p); + p.fillPath(path, st::lightButtonFg); + }, arrow->lifetime()); + arrow->resize(Size(st::statisticsShowMoreButtonArrowSize * 2)); + arrow->move(st::statisticsShowMoreButtonArrowPosition); + arrow->show(); +} + } // namespace Ui diff --git a/Telegram/SourceFiles/ui/effects/toggle_arrow.h b/Telegram/SourceFiles/ui/effects/toggle_arrow.h index 3a12c7e4d..51cb1e089 100644 --- a/Telegram/SourceFiles/ui/effects/toggle_arrow.h +++ b/Telegram/SourceFiles/ui/effects/toggle_arrow.h @@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Ui { +class RpWidget; + [[nodiscard]] QPainterPath ToggleUpDownArrowPath( float64 x, float64 y, @@ -16,4 +18,6 @@ namespace Ui { float64 fourStrokes, float64 progress); +void AddToggleUpDownArrowToMoreButton(not_null parent); + } // namespace Ui