aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/control.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-09-07 23:13:48 +0800
committercrupest <crupest@outlook.com>2018-09-07 23:13:48 +0800
commitf8f9ca9a99da8a9dc014f5ed9a4f7d121eb87252 (patch)
tree8aaa0eed1afc24c74c890da207b39e07d56d8d72 /CruUI/ui/control.h
parenteebec8297a8538c40518ceee043edfc41e3b1343 (diff)
downloadcru-f8f9ca9a99da8a9dc014f5ed9a4f7d121eb87252.tar.gz
cru-f8f9ca9a99da8a9dc014f5ed9a4f7d121eb87252.tar.bz2
cru-f8f9ca9a99da8a9dc014f5ed9a4f7d121eb87252.zip
...
Diffstat (limited to 'CruUI/ui/control.h')
-rw-r--r--CruUI/ui/control.h15
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_;