lxgui
Loading...
Searching...
No Matches
gui_alive_checker.hpp
1#ifndef LXGUI_GUI_ALIVE_CHECKER_HPP
2#define LXGUI_GUI_ALIVE_CHECKER_HPP
3
4#include "lxgui/lxgui.hpp"
5#include "lxgui/utils.hpp"
6#include "lxgui/utils_observer.hpp"
7
8namespace lxgui::gui {
9
10class region;
11
31public:
36 explicit alive_checker(region& object) : object_(object.observer_from_this()) {}
37
38 // Non-copiable, non-movable
39 alive_checker(const alive_checker&) = delete;
43
48 bool is_alive() const {
49 return !object_.expired();
50 }
51
52private:
53 utils::observer_ptr<region> object_;
54};
55
56} // namespace lxgui::gui
57
58#endif
Utility class for safe checking of region validity.
alive_checker & operator=(const alive_checker &)=delete
bool is_alive() const
Check if the wrapped region is still alive.
alive_checker(const alive_checker &)=delete
alive_checker(alive_checker &&)=delete
alive_checker(region &object)
Contructor.
alive_checker & operator=(alive_checker &&)=delete
The base class of all elements in the GUI.