void UBorder::PostLoad() { Super::PostLoad(); if ( GetLinkerUE4Version() < VER_UE4_DEPRECATE_UMG_STYLE_ASSETS && Brush_DEPRECATED != nullptr ) { Background = Brush_DEPRECATED->Brush; Brush_DEPRECATED = nullptr; } if ( GetChildrenCount() > 0 ) { //TODO UMG Pre-Release Upgrade, now have slots of their own. Convert existing slot to new slot. if ( UPanelSlot* PanelSlot = GetContentSlot() ) { UBorderSlot* BorderSlot = Cast<UBorderSlot>(PanelSlot); if ( BorderSlot == NULL ) { BorderSlot = NewObject<UBorderSlot>(this); BorderSlot->Content = GetContentSlot()->Content; BorderSlot->Content->Slot = BorderSlot; Slots[0] = BorderSlot; } } } }
void UButton::PostLoad() { Super::PostLoad(); if ( GetChildrenCount() > 0 ) { //TODO UMG Pre-Release Upgrade, now buttons have slots of their own. Convert existing slot to new slot. if ( UPanelSlot* PanelSlot = GetContentSlot() ) { UButtonSlot* ButtonSlot = Cast<UButtonSlot>(PanelSlot); if ( ButtonSlot == NULL ) { ButtonSlot = NewObject<UButtonSlot>(this); ButtonSlot->Content = GetContentSlot()->Content; ButtonSlot->Content->Slot = ButtonSlot; Slots[0] = ButtonSlot; } } } if( GetLinkerUE4Version() < VER_UE4_DEPRECATE_UMG_STYLE_ASSETS && Style_DEPRECATED != nullptr ) { const FButtonStyle* StylePtr = Style_DEPRECATED->GetStyle<FButtonStyle>(); if(StylePtr != nullptr) { WidgetStyle = *StylePtr; } Style_DEPRECATED = nullptr; } }
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(); }
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(); }
void UBorder::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) { Super::PostEditChangeProperty(PropertyChangedEvent); static bool IsReentrant = false; if ( !IsReentrant ) { IsReentrant = true; if ( PropertyChangedEvent.Property ) { FName PropertyName = PropertyChangedEvent.Property->GetFName(); if ( UBorderSlot* Slot = Cast<UBorderSlot>(GetContentSlot()) ) { if ( PropertyName == "Padding" ) { FObjectEditorUtils::MigratePropertyValue(this, "Padding", Slot, "Padding"); } else if ( PropertyName == "HorizontalAlignment" ) { FObjectEditorUtils::MigratePropertyValue(this, "HorizontalAlignment", Slot, "HorizontalAlignment"); } else if ( PropertyName == "VerticalAlignment" ) { FObjectEditorUtils::MigratePropertyValue(this, "VerticalAlignment", Slot, "VerticalAlignment"); } } } IsReentrant = false; } }
TSharedRef<SWidget> USizeBox::RebuildWidget() { MySizeBox = SNew(SBox); if ( GetChildrenCount() > 0 ) { Cast<USizeBoxSlot>(GetContentSlot())->BuildSlot(MySizeBox.ToSharedRef()); } return BuildDesignTimeWidget( MySizeBox.ToSharedRef() ); }
TSharedRef<SWidget> UBorder::RebuildWidget() { MyBorder = SNew(SBorder); if ( GetChildrenCount() > 0 ) { Cast<UBorderSlot>(GetContentSlot())->BuildSlot(MyBorder.ToSharedRef()); } return BuildDesignTimeWidget( MyBorder.ToSharedRef() ); }
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()); }
TSharedRef<SWidget> UButton::RebuildWidget() { MyButton = SNew(SButton) .ButtonStyle(&WidgetStyle) .ClickMethod(ClickMethod) .TouchMethod(TouchMethod) .IsFocusable(IsFocusable); if ( GetChildrenCount() > 0 ) { Cast<UButtonSlot>(GetContentSlot())->BuildSlot(MyButton.ToSharedRef()); } return MyButton.ToSharedRef(); }
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(); }