/** * Add a child to this widget. * This function should not be called directly, instead send this widget as parameter to constructor * of new widgets, and they use this function to register them in their parent. * @param jWidget $Widget */ protected final function AddChild(jWidget $Widget) { $t = debug_backtrace(); if (!($t[1]['class'] == "jWidget" and $t[1]['function'] == "__construct")) { throw new Exception("Add child is implicitly called by jWidget constructors. You should not manually call it."); } if ($this->IsTerminal()) { throw new TerminalAddChildException("Widget {$this->Name()} of type " . get_class($this) . " is terminal, i.e it can not contain children."); } $this->Children[$Widget->Name()] = $Widget; }