MCPcopy Create free account
hub / github.com/TankOs/SFGUI / HandleAdd

Method HandleAdd

src/SFGUI/Notebook.cpp:494–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494bool Notebook::HandleAdd( Widget::Ptr child ) {
495 auto allowed = false;
496
497 for( const auto& tab : m_children ) {
498 if( ( tab.child == child ) || ( tab.tab_label == child ) ) {
499 allowed = true;
500 break;
501 }
502 }
503
504 // If the child or label isn't found on the children list, the user added the widget
505 // manually, which is not allowed for this class.
506 if( !allowed ) {
507
508#if defined( SFGUI_DEBUG )
509 std::cerr << "SFGUI warning: Child must be added via AppendPage() or PrependPage() or InsertPage() for sfg::Notebook widgets.\n";
510#endif
511
512 return false;
513 }
514
515 Container::HandleAdd( child );
516
517 RequestResize();
518 Invalidate();
519
520 return true;
521}
522
523void Notebook::HandleRemove( Widget::Ptr child ) {
524 auto page_number = GetPageOf( child );

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected