/* 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 Data { class Feed; } // namespace Data namespace Ui { class SettingsSlider; class FadeShadow; class PlainShadow; class DropdownMenu; class IconButton; } // 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(FullMsgId msgId) : msgId(msgId) { } FullMsgId msgId; bool canDelete = false; bool canForward = false; }; struct SelectedItems { explicit SelectedItems(Storage::SharedMediaType type) : type(type) { } Storage::SharedMediaType type; std::vector list; }; 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); std::unique_ptr createMemento() override; rpl::producer desiredHeightValue() const override; void updateInternalState(not_null memento); // Float player interface. bool wheelEventFromFloatPlayer(QEvent *e) override; QRect rectForFloatPlayer() const override; object_ptr createTopBarSurrogate(QWidget *parent); bool closeByOutsideClick() const; void updateGeometry(QRect newGeometry, int additionalScroll); int scrollTillBottom(int forHeight) const; rpl::producer scrollTillBottomChanges() const; ~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; //enum class Tab { // Profile, // Media, // None, //}; struct StackItem; void startInjectingActivePeerProfiles(); void injectActiveProfile(Dialogs::Key key); void injectActivePeerProfile(not_null peer); void injectActiveFeedProfile(not_null feed); void injectActiveProfileMemento( std::unique_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 setupTabbedTop(); //void setupTabs(Tab tab); //void createTabs(); void createTopBar(); void highlightTopBar(); void setupShortcuts(); not_null topWidget() const; QRect contentGeometry() const; rpl::producer desiredHeightForContent() const; void finishShowContent(); rpl::producer topShadowToggledValue() const; void updateContentGeometry(); //void showTab(Tab tab); void showContent(object_ptr content); //std::unique_ptr createTabMemento(Tab tab); object_ptr createContent( not_null memento, not_null controller); std::unique_ptr createController( not_null window, not_null memento); //void convertProfileFromStackToTab(); rpl::producer selectedListValue() const; bool requireTopBarSearch() const; void addTopBarMenuButton(); void addContentSaveButton(); void addProfileCallsButton(); void addProfileNotificationsButton(); void showTopBarMenu(); rpl::variable _wrap; std::unique_ptr _controller; object_ptr _content = { nullptr }; int _additionalScroll = 0; //object_ptr _topTabsBackground = { nullptr }; //object_ptr _topTabs = { nullptr }; object_ptr _topBar = { nullptr }; object_ptr _topBarSurrogate = { nullptr }; Ui::Animations::Simple _topBarOverrideAnimation; bool _topBarOverrideShown = false; object_ptr _topShadow; base::unique_qptr _topBarMenuToggle; base::unique_qptr _topBarMenu; // Tab _tab = Tab::Profile; // std::unique_ptr _anotherTabMemento; std::vector _historyStack; rpl::event_stream> _desiredHeights; rpl::event_stream> _desiredShadowVisibilities; rpl::event_stream> _selectedLists; rpl::event_stream> _scrollTillBottomChanges; rpl::event_stream<> _contentChanges; }; } // namespace Info