aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/control.h
diff options
context:
space:
mode:
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_;