| 1875 | //----------------------------------------------------------------------------- |
| 1876 | |
| 1877 | void GuiControl::addObject(SimObject *object) |
| 1878 | { |
| 1879 | GuiControl *ctrl = dynamic_cast<GuiControl *>(object); |
| 1880 | if(object->getGroup() == this) |
| 1881 | return; |
| 1882 | |
| 1883 | AssertFatal( ctrl, "GuiControl::addObject() - cannot add non-GuiControl as child of GuiControl" ); |
| 1884 | |
| 1885 | Parent::addObject(object); |
| 1886 | |
| 1887 | AssertFatal(!ctrl->isAwake(), "GuiControl::addObject: object is already awake before add"); |
| 1888 | if( mAwake ) |
| 1889 | ctrl->awaken(); |
| 1890 | |
| 1891 | // If we are a child, notify our parent that we've been removed |
| 1892 | GuiControl *parent = ctrl->getParent(); |
| 1893 | if( parent ) |
| 1894 | parent->onChildAdded( ctrl ); |
| 1895 | } |
| 1896 | |
| 1897 | //----------------------------------------------------------------------------- |
| 1898 | |