/* This file is part of Telegram Desktop, the official desktop version of Telegram messaging app, see https://telegram.org Telegram Desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #pragma once #include #include #include "window/section_widget.h" namespace Ui { class SettingsSlider; class FadeShadow; class PlainShadow; } // namespace Ui namespace Window { enum class SlideDirection; } // namespace Window namespace Info { namespace Profile { class Widget; } // namespace Profile namespace Media { class Widget; } // namespace Media class Controller; class Section; class Memento; class MoveMemento; class ContentMemento; class ContentWidget; class TopBar; class TopBarOverride; 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); not_null peer() const; PeerData *peerForDialogs() const override { return peer(); } Wrap wrap() const { return _wrap.current(); } rpl::producer wrapValue() const { return _wrap.value(); } void setWrap(Wrap wrap); bool hasStackHistory() const { return !_historyStack.empty(); } not_null controller() { return _controller.get(); } bool hasTopBarShadow() const override; QPixmap grabForShowAnimation( const Window::SectionSlideParams ¶ms) override; void showAnimatedHook( const Window::SectionSlideParams ¶ms) override; void forceContentRepaint(); bool showInternal( not_null memento, const Window::SectionShow ¶ms) override; 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; ~WrapWidget(); protected: void resizeEvent(QResizeEvent *e) override; void doSetInnerFocus() override; void showFinishedHook() override; private: using SlideDirection = Window::SlideDirection; using SectionSlideParams = Window::SectionSlideParams; enum class Tab { Profile, Media, None, }; struct StackItem; void restoreHistoryStack( std::vector> stack); void showBackFromStack(); void showNewContent(not_null memento); void showNewContent( not_null memento, const Window::SectionShow ¶ms); void setupTop(); void setupTabbedTop(); void setupTabs(Tab tab); void createTabs(); void createTopBar(); 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; void refreshTopBarOverride(); void refreshTopBarOverride(SelectedItems &&items); void createTopBarOverride(SelectedItems &&items); void destroyTopBarOverride(); bool requireTopBarSearch() const; rpl::variable _wrap; std::unique_ptr _controller; object_ptr _content = { nullptr }; object_ptr _topTabsBackground = { nullptr }; object_ptr _topTabs = { nullptr }; object_ptr _topBar = { nullptr }; object_ptr _topBarOverride = { nullptr }; Animation _topBarOverrideAnimation; object_ptr _topShadow; Tab _tab = Tab::Profile; std::unique_ptr _anotherTabMemento; std::vector _historyStack; rpl::event_stream> _desiredHeights; rpl::event_stream> _desiredShadowVisibilities; rpl::event_stream> _selectedLists; }; } // namespace Info