TSharedRef<SWidget> UUModComboBox::HandleGenerateWidget(TSharedPtr<FString> Item) const { FString StringItem = Item.IsValid() ? *Item : FString(); // Call the user's delegate to see if they want to generate a custom widget bound to the data source. if (!IsDesignTime() && OnGenerateWidgetEvent.IsBound()) { UWidget* Widget = OnGenerateWidgetEvent.Execute(StringItem); if (Widget != NULL) { return Widget->TakeWidget(); } } //UMod ComboBoxString Customize injector start TSharedRef<STextBlock> widget = SNew(STextBlock).Text(FText::FromString(StringItem)); if (!ElementsTooltipText.IsEmpty()) { FString rep = ElementsTooltipText.Replace(TEXT("%e"), **Item, ESearchCase::IgnoreCase); widget->SetToolTipText(FText::FromString(rep)); } FTextBlockStyle fuckUE4Const = ElementsTextStyle; FTextBlockStyle *style = new FTextBlockStyle(ElementsTextStyle); widget->SetTextStyle(style); return widget; //UMod ComboBoxString Customize injector end }
void USpinBox::HandleOnBeginSliderMovement() { if ( !IsDesignTime() ) { OnBeginSliderMovement.Broadcast(); } }
TSharedRef<SWidget> UNamedSlot::RebuildWidget() { MyBox = SNew(SBox); if ( IsDesignTime() ) { MyBox->SetContent( SNew(SBox) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(STextBlock) .Text(FText::FromName(GetFName())) ] ); } // Add any existing content to the new slate box if ( GetChildrenCount() > 0 ) { UPanelSlot* ContentSlot = GetContentSlot(); if ( ContentSlot->Content ) { MyBox->SetContent(ContentSlot->Content->TakeWidget()); } } return MyBox.ToSharedRef(); }
TSharedRef<SWidget> UPropertyEditor::RebuildWidget() { if (IsDesignTime()) { return BuildDesignTimeWidget(SNew(SBox) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(STextBlock) .Text(LOCTEXT("PropertyEditor", "PropertyEditor")) ]); } else { FPropertyEditorModule& EditModule = FModuleManager::Get().GetModuleChecked<FPropertyEditorModule>("PropertyEditor"); FDetailsViewArgs DetailsViewArgs(/*bUpdateFromSelection=*/ false, /*bLockable=*/ false, /*bAllowSearch=*/ false, /*InNameAreaSettings=*/ FDetailsViewArgs::HideNameArea, /*bHideSelectionTip=*/ true); View = EditModule.CreateDetailView(DetailsViewArgs); if (ObjectToInspect.IsValid()) { View->SetObject(ObjectToInspect.Get()); } View->OnFinishedChangingProperties().AddUObject(this, &UPropertyEditor::OnFinishedChangingProperties); return View.ToSharedRef(); } }
// Event handlers void USpinBox::HandleOnValueChanged(float InValue) { if ( !IsDesignTime() ) { OnValueChanged.Broadcast(InValue); } }
void USpinBox::HandleOnValueCommitted(float InValue, ETextCommit::Type CommitMethod) { if ( !IsDesignTime() ) { OnValueCommitted.Broadcast(InValue, CommitMethod); } }
void UTableListRow::TriggerOnSelected() { if (!IsDesignTime()) { OnRowSelected.Broadcast(this); } }
void USpinBox::HandleOnEndSliderMovement(float InValue) { if ( !IsDesignTime() ) { OnEndSliderMovement.Broadcast(InValue); } }
void UUserWidget::OnWidgetRebuilt() { if (!IsDesignTime()) { // Notify the widget that it has been constructed. Construct(); } }
TSharedRef<SWidget> UJavascriptGraphTextPropertyEditableTextBox::RebuildWidget() { auto defaultWidget = SNew(SBox) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(STextBlock) .Text(LOCTEXT("JavascriptGraphTextPropertyEditableTextBox", "JavascriptGraphTextPropertyEditableTextBox")) ]; if (IsDesignTime()) { return RebuildDesignWidget(defaultWidget); } else { if (OnGetGraphPin.IsBound()) { FJavascriptEdGraphPin GraphPin = OnGetGraphPin.Execute(); if (GraphPin.IsValid()) { if (OnGetDefaultValue.IsBound()) { MyTextProperty = OnGetDefaultValue.Execute(); if (!MyTextProperty.TableId.IsNone()) { GraphPin->DefaultTextValue = FText::FromStringTable(MyTextProperty.TableId, MyTextProperty.Key); } else if (!MyTextProperty.Value.IsEmpty()) { if (MyTextProperty.Key.IsEmpty()) { MyTextProperty.Key = FGuid::NewGuid().ToString(); OnTextCommitted.Broadcast(MyTextProperty); } GraphPin->DefaultTextValue = FText::ChangeKey(MyTextProperty.Namespace, MyTextProperty.Key, FText::FromString(MyTextProperty.Value)); } } MyEditableTextProperty = MakeShareable(new FJavascriptEditableTextGraphPin(GraphPin, this)); MyEditableTextBlock = SNew(STextPropertyEditableTextBox, MyEditableTextProperty.ToSharedRef()) .Style(&WidgetStyle) .WrapTextAt(WrapTextAt) .AutoWrapText(AutoWrapText) .MinDesiredWidth(MinimumDesiredWidth) .MaxDesiredHeight(MaximumDesiredHeight); return MyEditableTextBlock.ToSharedRef();; } } return defaultWidget; } }
void UComboBoxString::HandleSelectionChanged(TSharedPtr<FString> Item, ESelectInfo::Type SelectionType) { CurrentOptionPtr = Item; if ( !IsDesignTime() ) { OnSelectionChanged.Broadcast(Item.IsValid() ? *Item : FString(), SelectionType); } // When the selection changes we always generate another widget to represent the content area of the comobox. ComoboBoxContent->SetContent( HandleGenerateWidget(Item) ); }
void UUserWidget::OnWidgetRebuilt() { // When a user widget is rebuilt we can safely initialize the navigation now since all the slate // widgets should be held onto by a smart pointer at this point. WidgetTree->ForEachWidget([&] (UWidget* Widget) { Widget->BuildNavigation(); }); if (!IsDesignTime()) { // Notify the widget that it has been constructed. NativeConstruct(); } }
TSharedRef<SWidget> UTextBlock::RebuildWidget() { if (bWrapWithInvalidationPanel && !IsDesignTime()) { TSharedPtr<SWidget> RetWidget = SNew(SInvalidationPanel) [ SAssignNew(MyTextBlock, STextBlock) ]; return RetWidget.ToSharedRef(); } else { MyTextBlock = SNew(STextBlock); return MyTextBlock.ToSharedRef(); } }
TSharedRef<SWidget> UComboBoxString::HandleGenerateWidget(TSharedPtr<FString> Item) const { FString StringItem = Item.IsValid() ? *Item : FString(); // Call the user's delegate to see if they want to generate a custom widget bound to the data source. if ( !IsDesignTime() && OnGenerateWidgetEvent.IsBound() ) { UWidget* Widget = OnGenerateWidgetEvent.Execute(StringItem); if ( Widget != NULL ) { return Widget->TakeWidget(); } } // If a row wasn't generated just create the default one, a simple text block of the item's name. return SNew(STextBlock).Text(FText::FromString(StringItem)); }
TSharedRef<SWidget> UNativeWidgetHost::GetDefaultContent() { if ( IsDesignTime() ) { return SNew(SBorder) .Visibility(EVisibility::HitTestInvisible) .BorderImage(FUMGStyle::Get().GetBrush("MarchingAnts")) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(STextBlock) .Text(LOCTEXT("NativeWidgetHostText", "Slate Widget Host")) ]; } else { return SNullWidget::NullWidget; } }
TSharedRef<SWidget> URetainerBox::RebuildWidget() { MyRetainerWidget = SNew(SRetainerWidget) .Phase(Phase) .PhaseCount(PhaseCount) #if STATS .StatId( FName( *FString::Printf(TEXT("%s [%s]"), *GetFName().ToString(), *GetClass()->GetName() ) ) ) #endif//STATS ; MyRetainerWidget->SetRetainedRendering(IsDesignTime() ? false : true); if ( GetChildrenCount() > 0 ) { MyRetainerWidget->SetContent(GetContentSlot()->Content ? GetContentSlot()->Content->TakeWidget() : SNullWidget::NullWidget); } return BuildDesignTimeWidget(MyRetainerWidget.ToSharedRef()); }
void UUserWidget::TickActionsAndAnimation(const FGeometry& MyGeometry, float InDeltaTime) { if ( IsDesignTime() ) { return; } // Update active movie scenes for ( UUMGSequencePlayer* Player : ActiveSequencePlayers ) { Player->Tick(InDeltaTime); } const bool bWasPlayingAnimation = IsPlayingAnimation(); // The process of ticking the players above can stop them so we remove them after all players have ticked for ( UUMGSequencePlayer* StoppedPlayer : StoppedSequencePlayers ) { ActiveSequencePlayers.RemoveSwap(StoppedPlayer); } StoppedSequencePlayers.Empty(); // If we're no longer playing animations invalidate layout so that we recache the volatility of the widget. if ( bWasPlayingAnimation && IsPlayingAnimation() == false ) { TSharedPtr<SWidget> CachedWidget = GetCachedWidget(); if ( CachedWidget.IsValid() ) { CachedWidget->Invalidate(EInvalidateWidget::LayoutAndVolatility); } } UWorld* World = GetWorld(); if ( World ) { // Update any latent actions we have for this actor FLatentActionManager& LatentActionManager = World->GetLatentActionManager(); LatentActionManager.ProcessLatentActions(this, InDeltaTime); } }
void UNamedSlot::OnSlotRemoved(UPanelSlot* Slot) { // Remove the widget from the live slot if it exists. if ( MyBox.IsValid() ) { MyBox->SetContent(SNullWidget::NullWidget); if ( IsDesignTime() ) { MyBox->SetContent( SNew(SBox) .HAlign(HAlign_Center) .VAlign(VAlign_Center) [ SNew(STextBlock) .Text(FText::FromName(GetFName())) ] ); } } }