neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
async_layout.hpp
Go to the documentation of this file.
1// async_layout.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2021 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
23#include <vector>
27
28namespace neogfx
29{
31 {
32 private:
33 struct entry
34 {
35 destroyed_flag destroyed;
37 bool validated;
38 std::optional<pause_rendering> pauseRendering;
39
40 entry(destroyed_flag&& destroyed, i_widget* widget) :
41 destroyed{ std::move(destroyed) }, widget{ widget }, validated{ false }
42 {
43 if (!widget->is_root())
44 pauseRendering.emplace(widget->root());
45 }
46 entry(entry&&) = default;
47 entry& operator=(entry&&) = default;
48 };
49 typedef std::vector<entry> entry_queue;
50 public:
52 public:
53 bool exists(i_widget& aWidget) const noexcept override;
54 bool defer_layout(i_widget& aWidget) override;
55 void validate(i_widget& aWidget) override;
56 void invalidate(i_widget& aWidget) override;
57 private:
58 std::optional<entry_queue::const_iterator> pending(i_widget& aWidget) const noexcept;
59 std::optional<entry_queue::iterator> pending(i_widget& aWidget) noexcept;
60 std::optional<entry_queue::const_iterator> processing(i_widget& aWidget) const noexcept;
61 std::optional<entry_queue::iterator> processing(i_widget& aWidget) noexcept;
62 void process();
63 private:
65 entry_queue iPending;
66 entry_queue iProcessing;
67 };
68}
void invalidate(i_widget &aWidget) override
bool exists(i_widget &aWidget) const noexcept override
void validate(i_widget &aWidget) override
bool defer_layout(i_widget &aWidget) override
bool is_root() const final
Definition widget.ipp:181
const i_window & root() const final
Definition widget.ipp:204