MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / onChildAdded

Method onChildAdded

Engine/source/gui/containers/guiTabBookCtrl.cpp:158–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156//-----------------------------------------------------------------------------
157
158void GuiTabBookCtrl::onChildAdded( GuiControl *child )
159{
160 GuiTabPageCtrl *page = dynamic_cast<GuiTabPageCtrl*>(child);
161 if( !page )
162 {
163 Con::warnf("GuiTabBookCtrl::onChildAdded - attempting to add NON GuiTabPageCtrl as child page");
164 SimObject *simObj = reinterpret_cast<SimObject*>(child);
165 removeObject( simObj );
166 if( mActivePage )
167 {
168 mActivePage->addObject( simObj );
169 }
170 else
171 {
172 Con::warnf("GuiTabBookCtrl::onChildAdded - unable to find active page to reassign ownership of new child control to, placing on parent");
173 GuiControl *rent = getParent();
174 if( rent )
175 rent->addObject( simObj );
176 }
177 return;
178 }
179
180 TabHeaderInfo newPage;
181
182 newPage.Page = page;
183 newPage.TabRow = -1;
184 newPage.TabColumn = -1;
185
186 mPages.push_back( newPage );
187
188 // Calculate Page Information
189 calculatePageTabs();
190
191 if( page->getFitBook() )
192 fitPage( page );
193
194 // Select this Page
195 selectPage( page );
196}
197
198//-----------------------------------------------------------------------------
199

Callers

nothing calls this directly

Calls 3

warnfFunction · 0.50
addObjectMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected