init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
This commit is contained in:
73
Telegram/lib_ui/ui/layers/layer_manager.h
Normal file
73
Telegram/lib_ui/ui/layers/layer_manager.h
Normal file
@@ -0,0 +1,73 @@
|
||||
// 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 <QtCore/QMargins>
|
||||
|
||||
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<RpWidget*> widget);
|
||||
|
||||
void setStyleOverrides(
|
||||
const style::Box *boxSt,
|
||||
const style::Box *layerSt);
|
||||
|
||||
void setHideByBackgroundClick(bool hide);
|
||||
void showBox(
|
||||
object_ptr<BoxContent> box,
|
||||
LayerOptions options = LayerOption::KeepOther,
|
||||
anim::type animated = anim::type::normal);
|
||||
void showLayer(
|
||||
std::unique_ptr<LayerWidget> 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<bool> layerShownValue() const {
|
||||
return _layerShown.value();
|
||||
}
|
||||
|
||||
[[nodiscard]] not_null<Ui::RpWidget*> toastParent() const {
|
||||
return _widget;
|
||||
}
|
||||
[[nodiscard]] const LayerWidget *topShownLayer() const;
|
||||
|
||||
[[nodiscard]] std::shared_ptr<Show> uiShow();
|
||||
|
||||
private:
|
||||
class ManagerShow;
|
||||
|
||||
void ensureLayerCreated();
|
||||
void destroyLayer();
|
||||
|
||||
const not_null<RpWidget*> _widget;
|
||||
base::unique_qptr<LayerStackWidget> _layer;
|
||||
std::shared_ptr<ManagerShow> _cachedShow;
|
||||
rpl::variable<bool> _layerShown;
|
||||
|
||||
const style::Box *_boxSt = nullptr;
|
||||
const style::Box *_layerSt = nullptr;
|
||||
bool _hideByBackgroundClick = false;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Ui
|
||||
Reference in New Issue
Block a user