// This file is part of Desktop App Toolkit, // a set of libraries for developing nice desktop applications. // // For license and copyright information please follow this link: // https://github.com/desktop-app/legal/blob/master/LEGAL // #pragma once #include "base/weak_ptr.h" #include "ui/layers/layer_widget.h" #include namespace style { struct Box; } // namespace style namespace Ui { class BoxContent; class RpWidget; class Show; class LayerManager final : public base::has_weak_ptr { public: explicit LayerManager(not_null widget); void setStyleOverrides( const style::Box *boxSt, const style::Box *layerSt); void setHideByBackgroundClick(bool hide); void showBox( object_ptr box, LayerOptions options = LayerOption::KeepOther, anim::type animated = anim::type::normal); void showLayer( std::unique_ptr layer, LayerOptions options = LayerOption::KeepOther, anim::type animated = anim::type::normal); void hideAll(anim::type animated = anim::type::normal); void raise(); bool setFocus(); [[nodiscard]] rpl::producer layerShownValue() const { return _layerShown.value(); } [[nodiscard]] not_null toastParent() const { return _widget; } [[nodiscard]] const LayerWidget *topShownLayer() const; [[nodiscard]] std::shared_ptr uiShow(); private: class ManagerShow; void ensureLayerCreated(); void destroyLayer(); const not_null _widget; base::unique_qptr _layer; std::shared_ptr _cachedShow; rpl::variable _layerShown; const style::Box *_boxSt = nullptr; const style::Box *_layerSt = nullptr; bool _hideByBackgroundClick = false; }; } // namespace Ui