diff options
author | crupest <crupest@outlook.com> | 2018-09-07 23:13:48 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-09-07 23:13:48 +0800 |
commit | f8f9ca9a99da8a9dc014f5ed9a4f7d121eb87252 (patch) | |
tree | 8aaa0eed1afc24c74c890da207b39e07d56d8d72 /CruUI/ui/control.h | |
parent | eebec8297a8538c40518ceee043edfc41e3b1343 (diff) | |
download | cru-f8f9ca9a99da8a9dc014f5ed9a4f7d121eb87252.tar.gz cru-f8f9ca9a99da8a9dc014f5ed9a4f7d121eb87252.tar.bz2 cru-f8f9ca9a99da8a9dc014f5ed9a4f7d121eb87252.zip |
...
Diffstat (limited to 'CruUI/ui/control.h')
-rw-r--r-- | CruUI/ui/control.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/CruUI/ui/control.h b/CruUI/ui/control.h index ee6abe12..b9dccf19 100644 --- a/CruUI/ui/control.h +++ b/CruUI/ui/control.h @@ -29,7 +29,7 @@ namespace cru friend class Window; friend class WindowLayoutManager; protected: - Control(); + explicit Control(bool container = false); public: Control(const Control& other) = delete; @@ -42,6 +42,11 @@ namespace cru //*************** region: tree *************** + bool IsContainer() const + { + return is_container_; + } + //Get parent of control, return nullptr if it has no parent. Control* GetParent() const { @@ -235,7 +240,15 @@ namespace cru // be done. void CheckAndNotifyPositionChanged(); + void ThrowIfNotContainer() const + { + if (!is_container_) + throw std::runtime_error("You can't perform such operation on a non-container control."); + } + private: + bool is_container_; + Window * window_; Control * parent_; |