Example #1
2
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
}
Example #2
0
TSharedRef<SWidget> UMenuAnchor::HandleGetMenuContent()
{
	TSharedPtr<SWidget> SlateMenuWidget;

	if ( OnGetMenuContentEvent.IsBound() )
	{
		UWidget* MenuWidget = OnGetMenuContentEvent.Execute();
		if ( MenuWidget )
		{
			SlateMenuWidget = MenuWidget->TakeWidget();
		}
	}
	else
	{
		if ( MenuClass != nullptr && !MenuClass->HasAnyClassFlags(CLASS_Abstract) )
		{
			UUserWidget* MenuWidget = CreateWidget<UUserWidget>(GetWorld(), MenuClass);
			if ( MenuWidget )
			{
				SlateMenuWidget = MenuWidget->TakeWidget();
			}
		}
	}

	return SlateMenuWidget.IsValid() ? SlateMenuWidget.ToSharedRef() : SNullWidget::NullWidget;
}
Example #3
0
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));
}