| 593 | } |
| 594 | |
| 595 | std::pair<UITab*, UIWidget*> |
| 596 | UICodeEditorSplitter::createWidgetInTabWidget( UITabWidget* tabWidget, UIWidget* widget, |
| 597 | const std::string& tabName, bool focus ) { |
| 598 | eeASSERT( curWidgetExists() ); |
| 599 | if ( nullptr == tabWidget ) |
| 600 | return std::make_pair( (UITab*)nullptr, (UIWidget*)nullptr ); |
| 601 | UITab* tab = tabWidget->add( tabName, widget ); |
| 602 | widget->setData( (UintPtr)tab ); |
| 603 | widget->on( Event::OnFocus, [this]( const Event* event ) { |
| 604 | setCurrentWidget( event->getNode()->asType<UIWidget>() ); |
| 605 | } ); |
| 606 | widget->on( Event::OnTitleChange, [this]( const Event* event ) { |
| 607 | const TextEvent* tevent = static_cast<const TextEvent*>( event ); |
| 608 | UIWidget* widget = event->getNode()->asType<UIWidget>(); |
| 609 | UITabWidget* tabWidget = tabWidgetFromWidget( widget ); |
| 610 | UITab* tab = tabWidget->getTabFromOwnedWidget( widget ); |
| 611 | if ( !tab ) |
| 612 | return; |
| 613 | tab->setText( tevent->getText() ); |
| 614 | } ); |
| 615 | if ( focus ) |
| 616 | tabWidget->setTabSelected( tab ); |
| 617 | mClient->onTabCreated( tab, widget ); |
| 618 | return std::make_pair( tab, widget ); |
| 619 | } |
| 620 | |
| 621 | std::vector<std::pair<UITab*, UITabWidget*>> |
| 622 | UICodeEditorSplitter::getTabFromOwnedWidgetId( const std::string& id ) { |
no test coverage detected