Expose topShownLayer from LayerStackWidget/LaayerManager.

This commit is contained in:
John Preston 2021-08-11 11:05:27 +03:00
parent 024f6fc1a9
commit 1b590f9e16
4 changed files with 18 additions and 0 deletions

View file

@ -59,6 +59,10 @@ bool LayerManager::setFocus() {
return true;
}
const LayerWidget *LayerManager::topShownLayer() const {
return _layer ? _layer->topShownLayer() : nullptr;
}
void LayerManager::ensureLayerCreated() {
if (_layer) {
return;

View file

@ -36,6 +36,8 @@ public:
void raise();
bool setFocus();
const LayerWidget *topShownLayer() const;
private:
void ensureLayerCreated();
void destroyLayer();

View file

@ -458,6 +458,17 @@ bool LayerStackWidget::layerShown() const {
return _specialLayer || currentLayer() || _mainMenu;
}
const LayerWidget *LayerStackWidget::topShownLayer() const {
if (const auto result = currentLayer()) {
return result;
} else if (const auto special = _specialLayer.data()) {
return special;
} else if (const auto menu = _mainMenu.data()) {
return menu;
}
return nullptr;
}
void LayerStackWidget::setStyleOverrides(
const style::Box *boxSt,
const style::Box *layerSt) {

View file

@ -144,6 +144,7 @@ public:
const ::Window::SectionShow &params);
bool layerShown() const;
const LayerWidget *topShownLayer() const;
~LayerStackWidget();