/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "window/section_widget.h" #include "ui/effects/animations.h" namespace Storage { enum class SharedMediaType : signed char; } // namespace Storage namespace Ui { class SettingsSlider; class FadeShadow; class PlainShadow; class PopupMenu; class IconButton; class RoundRect; } // namespace Ui namespace Window { enum class SlideDirection; } // namespace Window namespace Info { namespace Profile { class Widget; } // namespace Profile namespace Media { class Widget; } // namespace Media class Key; class Controller; class Section; class Memento; class MoveMemento; class ContentMemento; class ContentWidget; class TopBar; enum class Wrap { Layer, Narrow, Side, }; struct SelectedItem { explicit SelectedItem(GlobalMsgId globalId) : globalId(globalId) { } GlobalMsgId globalId; bool canDelete = false; bool canForward = false; }; struct SelectedItems { explicit SelectedItems(Storage::SharedMediaType type) : type(type) { } Storage::SharedMediaType type; std::vector list; }; enum class SelectionAction { Clear, Forward, Delete, }; class WrapWidget final : public Window::SectionWidget { public: WrapWidget( QWidget *parent, not_null window, Wrap wrap, not_null memento); Key key() const; Dialogs::RowDescriptor activeChat() const override; Wrap wrap() const { return _wrap.current(); } rpl::producer wrapValue() const; void setWrap(Wrap wrap); rpl::producer<> contentChanged() const; not_null controller() { return _controller.get(); } bool hasTopBarShadow() const override; QPixmap grabForShowAnimation( const Window::SectionSlideParams ¶ms) override; void forceContentRepaint(); bool showInternal( not_null memento, const Window::SectionShow ¶ms) override; bool showBackFromStackInternal(const Window::SectionShow ¶ms); void removeFromStack(const std::vector
§ions); std::shared_ptr createMemento() override; rpl::producer desiredHeightValue() const override; void updateInternalState(not_null memento); // Float player interface. bool floatPlayerHandleWheelEvent(QEvent *e) override; QRect floatPlayerAvailableRect() override; object_ptr createTopBarSurrogate(QWidget *parent); [[nodiscard]] bool closeByOutsideClick() const; void updateGeometry( QRect newGeometry, bool expanding, int additionalScroll); [[nodiscard]] int scrollBottomSkip() const; [[nodiscard]] int scrollTillBottom(int forHeight) const; [[nodiscard]] rpl::producer scrollTillBottomChanges() const; [[nodiscard]] rpl::producer grabbingForExpanding() const; [[nodiscard]] const Ui::RoundRect *bottomSkipRounding() const; [[nodiscard]] rpl::producer<> removeRequests() const override { return _removeRequests.events(); } ~WrapWidget(); protected: void resizeEvent(QResizeEvent *e) override; void keyPressEvent(QKeyEvent *e) override; void doSetInnerFocus() override; void showFinishedHook() override; void showAnimatedHook( const Window::SectionSlideParams ¶ms) override; private: using SlideDirection = Window::SlideDirection; using SectionSlideParams = Window::SectionSlideParams; struct StackItem; void startInjectingActivePeerProfiles(); void injectActiveProfile(Dialogs::Key key); void injectActivePeerProfile(not_null peer); void injectActiveProfileMemento( std::shared_ptr memento); void checkBeforeClose(Fn close); void restoreHistoryStack( std::vector> stack); bool hasStackHistory() const { return !_historyStack.empty(); } void showNewContent(not_null memento); void showNewContent( not_null memento, const Window::SectionShow ¶ms); bool returnToFirstStackFrame( not_null memento, const Window::SectionShow ¶ms); void setupTop(); void createTopBar(); void highlightTopBar(); void setupShortcuts(); [[nodiscard]] bool hasBackButton() const; not_null topWidget() const; QRect contentGeometry() const; rpl::producer desiredHeightForContent() const; void finishShowContent(); rpl::producer topShadowToggledValue() const; void updateContentGeometry(); void showContent(object_ptr content); object_ptr createContent( not_null memento, not_null controller); std::unique_ptr createController( not_null window, not_null memento); rpl::producer selectedListValue() const; bool requireTopBarSearch() const; void addTopBarMenuButton(); void addProfileCallsButton(); void showTopBarMenu(bool check); void deleteAllDownloads(); rpl::variable _wrap; std::unique_ptr _controller; object_ptr _content = { nullptr }; int _additionalScroll = 0; bool _expanding = false; rpl::variable _grabbingForExpanding = false; object_ptr _topBar = { nullptr }; object_ptr _topBarSurrogate = { nullptr }; Ui::Animations::Simple _topBarOverrideAnimation; bool _topBarOverrideShown = false; object_ptr _topShadow; object_ptr _bottomShadow; base::unique_qptr _topBarMenuToggle; base::unique_qptr _topBarMenu; std::vector _historyStack; rpl::event_stream<> _removeRequests; rpl::event_stream> _desiredHeights; rpl::event_stream> _desiredShadowVisibilities; rpl::event_stream> _desiredBottomShadowVisibilities; rpl::event_stream> _selectedLists; rpl::event_stream> _scrollTillBottomChanges; rpl::event_stream<> _contentChanges; }; } // namespace Info