TSharedRef<SWidget> UJavascriptMultiLineEditableTextBox::RebuildWidget() { auto Marshaller = MakeShareable(new FJavascriptTextLayoutMarshaller(this)); MyEditableTextBlock = SNew(SMultiLineEditableTextBox) .Style(&WidgetStyle) .TextStyle(&TextStyle) .Justification(Justification) .WrapTextAt(WrapTextAt) .AutoWrapText(!!AutoWrapText) .Marshaller(Marshaller) .IsReadOnly(bIsReadOnly) .AlwaysShowScrollbars(bAlwaysShowScrollbars) // .MinDesiredWidth(MinimumDesiredWidth) // .Padding(Padding) // .IsCaretMovedWhenGainFocus(IsCaretMovedWhenGainFocus) // .SelectAllTextWhenFocused(SelectAllTextWhenFocused) // .RevertTextOnEscape(RevertTextOnEscape) // .ClearKeyboardFocusOnCommit(ClearKeyboardFocusOnCommit) // .SelectAllTextOnCommit(SelectAllTextOnCommit) .OnVScrollBarUserScrolled_Lambda([&](float Offset) { OnVScrollBarUserScrolled.Broadcast(Offset); }) .OnTextChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, HandleOnTextChanged)) .OnTextCommitted(BIND_UOBJECT_DELEGATE(FOnTextCommitted, HandleOnTextCommitted)) ; return MyEditableTextBlock.ToSharedRef(); }
TSharedRef<SWidget> UComboBoxString::RebuildWidget() { int32 InitialIndex = FindOptionIndex(SelectedOption); if ( InitialIndex != -1 ) { CurrentOptionPtr = Options[InitialIndex]; } MyComboBox = SNew(SComboBox< TSharedPtr<FString> >) .ComboBoxStyle(&WidgetStyle) .OptionsSource(&Options) .InitiallySelectedItem(CurrentOptionPtr) .ContentPadding(ContentPadding) .MaxListHeight(MaxListHeight) .HasDownArrow(HasDownArrow) .OnGenerateWidget(BIND_UOBJECT_DELEGATE(SComboBox< TSharedPtr<FString> >::FOnGenerateWidget, HandleGenerateWidget)) .OnSelectionChanged(BIND_UOBJECT_DELEGATE(SComboBox< TSharedPtr<FString> >::FOnSelectionChanged, HandleSelectionChanged)) .OnComboBoxOpening(BIND_UOBJECT_DELEGATE(FOnComboBoxOpening, HandleOpening)) [ SAssignNew(ComoboBoxContent, SBox) ]; if ( InitialIndex != -1 ) { // Generate the widget for the initially selected widget if needed ComoboBoxContent->SetContent(HandleGenerateWidget(CurrentOptionPtr)); } return MyComboBox.ToSharedRef(); }
TSharedRef<SWidget> UEditableTextBox::RebuildWidget() { FString FontPath = FPaths::GameContentDir() / Font.FontName.ToString(); if ( !FPaths::FileExists(FontPath) ) { FontPath = FPaths::EngineContentDir() / Font.FontName.ToString(); } MyEditableTextBlock = SNew(SEditableTextBox) .Style(&WidgetStyle) .Font(FSlateFontInfo(FontPath, Font.Size)) .ForegroundColor(ForegroundColor) .BackgroundColor(BackgroundColor) .ReadOnlyForegroundColor(ReadOnlyForegroundColor) .MinDesiredWidth(MinimumDesiredWidth) .Padding(Padding) .IsCaretMovedWhenGainFocus(IsCaretMovedWhenGainFocus) .SelectAllTextWhenFocused(SelectAllTextWhenFocused) .RevertTextOnEscape(RevertTextOnEscape) .ClearKeyboardFocusOnCommit(ClearKeyboardFocusOnCommit) .SelectAllTextOnCommit(SelectAllTextOnCommit) .OnTextChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, HandleOnTextChanged)) .OnTextCommitted(BIND_UOBJECT_DELEGATE(FOnTextCommitted, HandleOnTextCommitted)) ; return MyEditableTextBlock.ToSharedRef(); }
TSharedRef<SWidget> USlider::RebuildWidget() { MySlider = SNew(SSlider) .Style(&WidgetStyle) .OnMouseCaptureBegin(BIND_UOBJECT_DELEGATE(FSimpleDelegate, HandleOnMouseCaptureBegin)) .OnMouseCaptureEnd(BIND_UOBJECT_DELEGATE(FSimpleDelegate, HandleOnMouseCaptureEnd)) .OnValueChanged(BIND_UOBJECT_DELEGATE(FOnFloatValueChanged, HandleOnValueChanged)); return MySlider.ToSharedRef(); }
TSharedRef<SWidget> USpinBox::RebuildWidget() { MySpinBox = SNew(SSpinBox<float>) .Style(&WidgetStyle) .Font(Font) .ClearKeyboardFocusOnCommit(ClearKeyboardFocusOnCommit) .SelectAllTextOnCommit(SelectAllTextOnCommit) .OnValueChanged(BIND_UOBJECT_DELEGATE(FOnFloatValueChanged, HandleOnValueChanged)) .OnValueCommitted(BIND_UOBJECT_DELEGATE(FOnFloatValueCommitted, HandleOnValueCommitted)) .OnBeginSliderMovement(BIND_UOBJECT_DELEGATE(FSimpleDelegate, HandleOnBeginSliderMovement)) .OnEndSliderMovement(BIND_UOBJECT_DELEGATE(FOnFloatValueChanged, HandleOnEndSliderMovement)) ; return BuildDesignTimeWidget( MySpinBox.ToSharedRef() ); }
TSharedRef<SWidget> UJavascriptTileView::RebuildWidget() { MyTileView = SNew(STileView< UObject* >) .SelectionMode(SelectionMode) .ListItemsSource(&Items) .ItemHeight(ItemHeight) .OnGenerateTile(BIND_UOBJECT_DELEGATE(STileView< UObject* >::FOnGenerateRow, HandleOnGenerateTile)) .OnSelectionChanged_Lambda([this](UObject* Object, ESelectInfo::Type SelectInfo){ OnSelectionChanged(Object, SelectInfo); }) .OnMouseButtonDoubleClick_Lambda([this](UObject* Object){ OnDoubleClick(Object); }) //.OnContextMenuOpening(this, &SSocketManager::OnContextMenuOpening) //.OnItemScrolledIntoView(this, &SSocketManager::OnItemScrolledIntoView) // .HeaderRow // ( // SNew(SHeaderRow) // .Visibility(EVisibility::Collapsed) // + SHeaderRow::Column(TEXT("Socket")) // ); ; return BuildDesignTimeWidget(MyTileView.ToSharedRef()); }
TSharedRef<SWidget> UEditableTextBox::RebuildWidget() { MyEditableTextBlock = SNew(SEditableTextBox) .Style(&WidgetStyle) .MinDesiredWidth(MinimumDesiredWidth) .IsCaretMovedWhenGainFocus(IsCaretMovedWhenGainFocus) .SelectAllTextWhenFocused(SelectAllTextWhenFocused) .RevertTextOnEscape(RevertTextOnEscape) .ClearKeyboardFocusOnCommit(ClearKeyboardFocusOnCommit) .SelectAllTextOnCommit(SelectAllTextOnCommit) .AllowContextMenu(AllowContextMenu) .OnTextChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, HandleOnTextChanged)) .OnTextCommitted(BIND_UOBJECT_DELEGATE(FOnTextCommitted, HandleOnTextCommitted)) .VirtualKeyboardType(EVirtualKeyboardType::AsKeyboardType(KeyboardType.GetValue())); return MyEditableTextBlock.ToSharedRef(); }
TSharedRef<SWidget> UEditableText::RebuildWidget() { MyEditableText = SNew(SEditableText) .Style(&WidgetStyle) .Font(Font) .MinDesiredWidth(MinimumDesiredWidth) .IsCaretMovedWhenGainFocus(IsCaretMovedWhenGainFocus) .SelectAllTextWhenFocused(SelectAllTextWhenFocused) .RevertTextOnEscape(RevertTextOnEscape) .ClearKeyboardFocusOnCommit(ClearKeyboardFocusOnCommit) .SelectAllTextOnCommit(SelectAllTextOnCommit) .OnTextChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, HandleOnTextChanged)) .OnTextCommitted(BIND_UOBJECT_DELEGATE(FOnTextCommitted, HandleOnTextCommitted)) ; return BuildDesignTimeWidget( MyEditableText.ToSharedRef() ); }
void UButton::SynchronizeProperties() { Super::SynchronizeProperties(); MyButton->SetColorAndOpacity( ColorAndOpacity ); MyButton->SetBorderBackgroundColor( BackgroundColor ); MyButton->SetOnClicked(BIND_UOBJECT_DELEGATE(FOnClicked, SlateHandleClicked)); }
TSharedRef<SWidget> UButton::RebuildWidget() { MyButton = SNew(SButton) .OnClicked(BIND_UOBJECT_DELEGATE(FOnClicked, SlateHandleClicked)) .OnPressed(BIND_UOBJECT_DELEGATE(FSimpleDelegate, SlateHandlePressed)) .OnReleased(BIND_UOBJECT_DELEGATE(FSimpleDelegate, SlateHandleReleased)) .ButtonStyle(&WidgetStyle) .ClickMethod(ClickMethod) .TouchMethod(TouchMethod) .IsFocusable(IsFocusable) ; if ( GetChildrenCount() > 0 ) { Cast<UButtonSlot>(GetContentSlot())->BuildSlot(MyButton.ToSharedRef()); } return MyButton.ToSharedRef(); }
TSharedRef<SWidget> UMultiLineEditableTextBox::RebuildWidget() { MyEditableTextBlock = SNew(SMultiLineEditableTextBox) .Style(&WidgetStyle) .TextStyle(&TextStyle) .AllowContextMenu(AllowContextMenu) // .MinDesiredWidth(MinimumDesiredWidth) // .Padding(Padding) // .IsCaretMovedWhenGainFocus(IsCaretMovedWhenGainFocus) // .SelectAllTextWhenFocused(SelectAllTextWhenFocused) // .RevertTextOnEscape(RevertTextOnEscape) // .ClearKeyboardFocusOnCommit(ClearKeyboardFocusOnCommit) // .SelectAllTextOnCommit(SelectAllTextOnCommit) .OnTextChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, HandleOnTextChanged)) .OnTextCommitted(BIND_UOBJECT_DELEGATE(FOnTextCommitted, HandleOnTextCommitted)) ; return MyEditableTextBlock.ToSharedRef(); }
void UImage::SynchronizeProperties() { Super::SynchronizeProperties(); TAttribute<FSlateColor> ColorAndOpacityBinding = OPTIONAL_BINDING(FSlateColor, ColorAndOpacity); TAttribute<const FSlateBrush*> ImageBinding = OPTIONAL_BINDING_CONVERT(FSlateBrush, Brush, const FSlateBrush*, ConvertImage); MyImage->SetImage(ImageBinding); MyImage->SetColorAndOpacity(ColorAndOpacityBinding); MyImage->SetOnMouseButtonDown(BIND_UOBJECT_DELEGATE(FPointerEventHandler, HandleMouseButtonDown)); }
void UBorder::SynchronizeProperties() { Super::SynchronizeProperties(); TAttribute<FLinearColor> ContentColorAndOpacityBinding = OPTIONAL_BINDING(FLinearColor, ContentColorAndOpacity); TAttribute<FSlateColor> BrushColorBinding = OPTIONAL_BINDING_CONVERT(FLinearColor, BrushColor, FSlateColor, ConvertLinearColorToSlateColor); TAttribute<const FSlateBrush*> ImageBinding = OPTIONAL_BINDING_CONVERT(FSlateBrush, Background, const FSlateBrush*, ConvertImage); MyBorder->SetBorderBackgroundColor(BrushColorBinding); MyBorder->SetColorAndOpacity(ContentColorAndOpacityBinding); MyBorder->SetBorderImage(ImageBinding); MyBorder->SetShowEffectWhenDisabled(bShowEffectWhenDisabled); MyBorder->SetOnMouseButtonDown(BIND_UOBJECT_DELEGATE(FPointerEventHandler, HandleMouseButtonDown)); MyBorder->SetOnMouseButtonUp(BIND_UOBJECT_DELEGATE(FPointerEventHandler, HandleMouseButtonUp)); MyBorder->SetOnMouseMove(BIND_UOBJECT_DELEGATE(FPointerEventHandler, HandleMouseMove)); MyBorder->SetOnMouseDoubleClick(BIND_UOBJECT_DELEGATE(FPointerEventHandler, HandleMouseDoubleClick)); }
TSharedRef<SWidget> UEditableTextBox::RebuildWidget() { MyEditableTextBlock = SNew(SEditableTextBox) .Style(&WidgetStyle) .Font(Font) .ForegroundColor(ForegroundColor) .BackgroundColor(BackgroundColor) .ReadOnlyForegroundColor(ReadOnlyForegroundColor) .MinDesiredWidth(MinimumDesiredWidth) .Padding(Padding) .IsCaretMovedWhenGainFocus(IsCaretMovedWhenGainFocus) .SelectAllTextWhenFocused(SelectAllTextWhenFocused) .RevertTextOnEscape(RevertTextOnEscape) .ClearKeyboardFocusOnCommit(ClearKeyboardFocusOnCommit) .SelectAllTextOnCommit(SelectAllTextOnCommit) .OnTextChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, HandleOnTextChanged)) .OnTextCommitted(BIND_UOBJECT_DELEGATE(FOnTextCommitted, HandleOnTextCommitted)) ; return MyEditableTextBlock.ToSharedRef(); }
TSharedRef<SWidget> UMultiLineEditableText::RebuildWidget() { MyMultiLineEditableText = SNew(SMultiLineEditableText) .TextStyle(&WidgetStyle) .AllowContextMenu(AllowContextMenu) // .MinDesiredWidth(MinimumDesiredWidth) // .IsCaretMovedWhenGainFocus(IsCaretMovedWhenGainFocus) // .SelectAllTextWhenFocused(SelectAllTextWhenFocused) // .RevertTextOnEscape(RevertTextOnEscape) // .ClearKeyboardFocusOnCommit(ClearKeyboardFocusOnCommit) // .SelectAllTextOnCommit(SelectAllTextOnCommit) // .BackgroundImageSelected(BackgroundImageSelected ? TAttribute<const FSlateBrush*>(&BackgroundImageSelected->Brush) : TAttribute<const FSlateBrush*>()) // .BackgroundImageSelectionTarget(BackgroundImageSelectionTarget ? TAttribute<const FSlateBrush*>(&BackgroundImageSelectionTarget->Brush) : TAttribute<const FSlateBrush*>()) // .BackgroundImageComposing(BackgroundImageComposing ? TAttribute<const FSlateBrush*>(&BackgroundImageComposing->Brush) : TAttribute<const FSlateBrush*>()) // .CaretImage(CaretImage ? TAttribute<const FSlateBrush*>(&CaretImage->Brush) : TAttribute<const FSlateBrush*>()) .OnTextChanged(BIND_UOBJECT_DELEGATE(FOnTextChanged, HandleOnTextChanged)) .OnTextCommitted(BIND_UOBJECT_DELEGATE(FOnTextCommitted, HandleOnTextCommitted)) ; return BuildDesignTimeWidget( MyMultiLineEditableText.ToSharedRef() ); }
TSharedRef<SWidget> UMenuAnchor::RebuildWidget() { MyMenuAnchor = SNew(SMenuAnchor) .Method(SMenuAnchor::UseCurrentWindow) .Placement(Placement) .OnGetMenuContent(BIND_UOBJECT_DELEGATE(FOnGetContent, HandleGetMenuContent)); if ( GetChildrenCount() > 0 ) { MyMenuAnchor->SetContent(GetContentSlot()->Content ? GetContentSlot()->Content->TakeWidget() : SNullWidget::NullWidget); } return BuildDesignTimeWidget( MyMenuAnchor.ToSharedRef() ); }
TSharedRef<SWidget> UCheckBox::RebuildWidget() { MyCheckbox = SNew(SCheckBox) .OnCheckStateChanged( BIND_UOBJECT_DELEGATE(FOnCheckStateChanged, SlateOnCheckStateChangedCallback) ) .Style(&WidgetStyle) .HAlign( HorizontalAlignment ) ; if ( GetChildrenCount() > 0 ) { MyCheckbox->SetContent(GetContentSlot()->Content ? GetContentSlot()->Content->TakeWidget() : SNullWidget::NullWidget); } return MyCheckbox.ToSharedRef(); }