UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ListViewBase.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Components/Widget.h"
8#include "Input/DragAndDrop.h"
16
17#include "ListViewBase.generated.h"
18
22
24// ITypedUMGListView<T>
26
38template <typename ItemType>
40{
41public:
43
45 // Automatically implemented via IMPLEMENT_TYPED_UMG_LIST()
48 virtual FSimpleListItemEvent& OnItemClicked() const = 0;
50
51 // Drag and Drop
56
59
62 // End Drag and Drop
63
66
69
72
75
76 DECLARE_MULTICAST_DELEGATE_TwoParams(FOnItemScrolledIntoView, ItemType, UUserWidget&);
77 virtual FOnItemScrolledIntoView& OnItemScrolledIntoView() const = 0;
78
81
84
86
89
90protected:
91 virtual SListView<ItemType>* GetMyListView() const = 0;
92 virtual uint32 GetOwningUserIndex() const = 0;
93 virtual bool IsDesignerPreview() const = 0;
95
96public:
102 {
103 //@todo DanH: Need some way to allow the design time preview entries to match up with the various possible runtime entries without a possibility for inaccuracy
104 if (!IsDesignerPreview())
105 {
107 if (CustomClass)
108 {
109 return CustomClass;
110 }
111 }
112
113 return GetDefaultEntryClass();
114 }
115
117 // Public API to match that of SListView
119
121 {
122 if (SListView<ItemType>* MyListView = GetMyListView())
123 {
124 TArray<ItemType> SelectedItems = MyListView->GetSelectedItems();
125 if (SelectedItems.Num() > 0)
126 {
127 return SelectedItems[0];
128 }
129 }
131 }
132
134 {
135 SListView<ItemType>* MyListView = GetMyListView();
136 if (ensure(EntryWidget.Implements<UUserListEntry>()) && MyListView)
137 {
139 if (ObjectTableRow.IsValid())
140 {
141 return MyListView->ItemFromWidget(ObjectTableRow.Get());
142 }
143 }
144 return nullptr;
145 }
146
147 template <typename RowWidgetT = UUserWidget>
148 RowWidgetT* GetEntryWidgetFromItem(const ItemType& Item) const
149 {
151 if (ObjectRow.IsValid())
152 {
153 return Cast<RowWidgetT>(ObjectRow->GetWidgetObject());
154 }
155 return nullptr;
156 }
157
158 int32 GetIndexInList(const ItemType& Item) const
159 {
160 if (SListView<ItemType>* MyListView = GetMyListView())
161 {
162 if (TSharedPtr<ITableRow> RowWidget = MyListView->WidgetFromItem(Item))
163 {
164 return RowWidget->GetIndexInList();
165 }
166 }
167 return INDEX_NONE;
168 }
169
171 {
172 SListView<ItemType>* MyListView = GetMyListView();
173 return MyListView ? MyListView->GetSelectedItems(OutSelectedItems) : 0;
174 }
175
177 {
178 SListView<ItemType>* MyListView = GetMyListView();
179 return MyListView ? MyListView->GetNumItemsSelected() : 0;
180 }
181
183 {
184 if (SListView<ItemType>* MyListView = GetMyListView())
185 {
186 MyListView->SetSelection(SoleSelectedItem, SelectInfo);
187 }
188 }
189
190 void SetItemSelection(const ItemType& Item, bool bIsSelected, ESelectInfo::Type SelectInfo = ESelectInfo::Direct)
191 {
192 if (SListView<ItemType>* MyListView = GetMyListView())
193 {
194 MyListView->SetItemSelection(Item, bIsSelected, SelectInfo);
195 }
196 }
197
199 {
200 if (SListView<ItemType>* MyListView = GetMyListView())
201 {
202 MyListView->ClearSelection();
203 }
204 }
205
206 bool IsItemVisible(const ItemType& Item) const
207 {
208 SListView<ItemType>* MyListView = GetMyListView();
209 return MyListView ? MyListView->IsItemVisible(Item) : false;
210 }
211
212 bool IsItemSelected(const ItemType& Item) const
213 {
214 SListView<ItemType>* MyListView = GetMyListView();
215 return MyListView ? MyListView->IsItemSelected(Item) : false;
216 }
217
218 void RequestNavigateToItem(const ItemType& Item)
219 {
220 if (SListView<ItemType>* MyListView = GetMyListView())
221 {
222 MyListView->RequestNavigateToItem(Item, GetOwningUserIndex());
223 }
224 }
225
226 void RequestScrollItemIntoView(const ItemType& Item)
227 {
228 if (SListView<ItemType>* MyListView = GetMyListView())
229 {
230 MyListView->RequestScrollIntoView(Item, GetOwningUserIndex());
231 }
232 }
233
235 {
236 if (SListView<ItemType>* MyListView = GetMyListView())
237 {
238 MyListView->CancelScrollIntoView();
239 }
240 }
242
243protected:
266
267 template <template<typename> class ListViewT = SListView, typename UListViewBaseT>
269 const TArray<ItemType>& ListItems,
271 {
272 static_assert(TIsDerivedFrom<ListViewT<ItemType>, SListView<ItemType>>::IsDerived, "ConstructListView can only construct instances of SListView classes");
274 .HandleGamepadEvents(true)
275 .ListItemsSource(&ListItems)
276 .IsFocusable(Args.bAllowFocus)
277 .ClearSelectionOnClick(Args.bClearSelectionOnClick)
278 .ConsumeMouseWheel(Args.ConsumeMouseWheel)
279 .SelectionMode(Args.SelectionMode)
280 .ReturnFocusToSelection(Args.bReturnFocusToSelection)
281 .ClearScrollVelocityOnSelection(Args.bClearScrollVelocityOnSelection)
282 .Orientation(Args.Orientation)
283 .ScrollIntoViewAlignment(Args.ScrollIntoViewAlignment)
284 .bEnableShadowBoxStyle(Args.bEnableShadowBoxStyle)
285 .ListViewStyle(Args.ListViewStyle)
286 .ShadowBoxStyle(Args.ShadowBoxStyle)
287 .ScrollBarStyle(Args.ScrollBarStyle)
288 .ScrollBarPadding(Args.ScrollBarPadding)
289 .PreventThrottling(Args.bPreventThrottling)
290 .OnGenerateRow_UObject(Implementer, &UListViewBaseT::HandleGenerateRow)
291 .OnSelectionChanged_UObject(Implementer, &UListViewBaseT::HandleSelectionChanged)
292 .OnIsSelectableOrNavigable_UObject(Implementer, &UListViewBaseT::HandleIsSelectableOrNavigable)
293 .OnRowReleased_UObject(Implementer, &UListViewBaseT::HandleRowReleased)
294 .OnItemScrolledIntoView_UObject(Implementer, &UListViewBaseT::HandleItemScrolledIntoView)
295 .OnListViewScrolled_UObject(Implementer, &UListViewBaseT::HandleListViewScrolled)
296 .OnFinishedScrolling_UObject(Implementer, &UListViewBaseT::HandleFinishedScrolling)
297 .OnMouseButtonClick_UObject(Implementer, &UListViewBaseT::HandleItemClicked)
298 .OnMouseButtonDoubleClick_UObject(Implementer, &UListViewBaseT::HandleItemDoubleClicked);
299 ListView->BindToRefreshRow(TSlateDelegates< ItemType >::FOnRefreshRow::CreateUObject(Implementer, &UListViewBaseT::HandleRefreshRow));
300
301 return ListView;
302 }
303
313
314 template <template<typename> class TileViewT = STileView, typename UListViewBaseT>
316 const TArray<ItemType>& ListItems,
318 {
319 static_assert(TIsDerivedFrom<TileViewT<ItemType>, STileView<ItemType>>::IsDerived, "ConstructTileView can only construct instances of STileView classes");
321 .HandleGamepadEvents(true)
322 .ListItemsSource(&ListItems)
323 .IsFocusable(Args.bAllowFocus)
324 .ClearSelectionOnClick(Args.bClearSelectionOnClick)
325 .WrapHorizontalNavigation(Args.bWrapDirectionalNavigation)
326 .ConsumeMouseWheel(Args.ConsumeMouseWheel)
327 .SelectionMode(Args.SelectionMode)
328 .ItemHeight(Args.EntryHeight)
329 .ItemWidth(Args.EntryWidth)
330 .ItemAlignment(Args.TileAlignment)
331 .Orientation(Args.Orientation)
332 .ScrollBarStyle(Args.ScrollBarStyle)
333 .ScrollbarDisabledVisibility(Args.ScrollbarDisabledVisibility)
334 .OnGenerateTile_UObject(Implementer, &UListViewBaseT::HandleGenerateRow)
335 .OnTileReleased_UObject(Implementer, &UListViewBaseT::HandleRowReleased)
336 .OnSelectionChanged_UObject(Implementer, &UListViewBaseT::HandleSelectionChanged)
337 .OnIsSelectableOrNavigable_UObject(Implementer, &UListViewBaseT::HandleIsSelectableOrNavigable)
338 .OnItemScrolledIntoView_UObject(Implementer, &UListViewBaseT::HandleItemScrolledIntoView)
339 .OnTileViewScrolled_UObject(Implementer, &UListViewBaseT::HandleListViewScrolled)
340 .OnFinishedScrolling_UObject(Implementer, &UListViewBaseT::HandleFinishedScrolling)
341 .OnMouseButtonClick_UObject(Implementer, &UListViewBaseT::HandleItemClicked)
342 .OnMouseButtonDoubleClick_UObject(Implementer, &UListViewBaseT::HandleItemDoubleClicked);
343 TileView->BindToRefreshRow(TSlateDelegates< ItemType >::FOnRefreshRow::CreateUObject(Implementer, &UListViewBaseT::HandleRefreshRow));
344
345 return TileView;
346 }
347
357
358 template <template<typename> class TreeViewT = STreeView, typename UListViewBaseT>
360 const TArray<ItemType>& ListItems,
362 {
363 static_assert(TIsDerivedFrom<TreeViewT<ItemType>, STreeView<ItemType>>::IsDerived, "ConstructTreeView can only construct instances of STreeView classes");
365 .HandleGamepadEvents(true)
366 .TreeItemsSource(&ListItems)
367 .ClearSelectionOnClick(Args.bClearSelectionOnClick)
368 .ConsumeMouseWheel(Args.ConsumeMouseWheel)
369 .SelectionMode(Args.SelectionMode)
370 .ReturnFocusToSelection(Args.bReturnFocusToSelection)
371 .TreeViewStyle(Args.TreeViewStyle)
372 .ScrollBarStyle(Args.ScrollBarStyle)
373 .OnGenerateRow_UObject(Implementer, &UListViewBaseT::HandleGenerateRow)
374 .OnSelectionChanged_UObject(Implementer, &UListViewBaseT::HandleSelectionChanged)
375 .OnIsSelectableOrNavigable_UObject(Implementer, &UListViewBaseT::HandleIsSelectableOrNavigable)
376 .OnRowReleased_UObject(Implementer, &UListViewBaseT::HandleRowReleased)
377 .OnItemScrolledIntoView_UObject(Implementer, &UListViewBaseT::HandleItemScrolledIntoView)
378 .OnTreeViewScrolled_UObject(Implementer, &UListViewBaseT::HandleListViewScrolled)
379 .OnFinishedScrolling_UObject(Implementer, &UListViewBaseT::HandleFinishedScrolling)
380 .OnMouseButtonClick_UObject(Implementer, &UListViewBaseT::HandleItemClicked)
381 .OnMouseButtonDoubleClick_UObject(Implementer, &UListViewBaseT::HandleItemDoubleClicked)
382 .OnGetChildren_UObject(Implementer, &UListViewBaseT::HandleGetChildren)
383 .OnExpansionChanged_UObject(Implementer, &UListViewBaseT::HandleExpansionChanged);
384 TreeView->BindToRefreshRow(TSlateDelegates< ItemType >::FOnRefreshRow::CreateUObject(Implementer, &UListViewBaseT::HandleRefreshRow));
385
386 return TreeView;
387 }
388
389protected:
391 template <template<typename> class ObjectRowT = SObjectTableRow>
393 {
394 static_assert(TIsDerivedFrom<ObjectRowT<ItemType>, SObjectTableRow<ItemType>>::IsDerived, "All UMG table rows must be or derive from SObjectTableRow.");
395
396 if (SListView<ItemType>* MyListView = GetMyListView())
397 {
398 TSharedPtr<ITableRow> RowWidget = MyListView->WidgetFromItem(Item);
400 }
401 return nullptr;
402 }
403
409
411 virtual FMargin GetDesiredEntryPadding(ItemType Item) const { return FMargin(0.f); }
412
414 virtual void OnGetChildrenInternal(ItemType Item, TArray<ItemType>& OutChildren) const {}
415
417 virtual void OnItemClickedInternal(ItemType Item) {}
418 virtual void OnItemDoubleClickedInternal(ItemType Item) {}
421 virtual void OnItemScrolledIntoViewInternal(ItemType Item, UUserWidget& EntryWidget) {}
424 virtual void OnItemExpansionChangedInternal(ItemType Item, bool bIsExpanded) {}
425
426private:
427 TSharedRef<ITableRow> HandleGenerateRow(ItemType Item, const TSharedRef<STableViewBase>& OwnerTable)
428 {
430
431 UUserWidget& EntryWidget = OnGenerateEntryWidgetInternal(Item, DesiredEntryClass, OwnerTable);
432
433 // Combine the desired entry padding with the padding the widget wants natively on the CDO.
434 const FMargin DefaultPadding = EntryWidget.GetClass()->GetDefaultObject<UUserWidget>()->GetPadding();
436
438 CachedWidget->SetCanTick(true); // this is a hack to force ticking to true so selection works (which should NOT require ticking! but currently does)
440 }
441
442 void HandleRefreshRow(ItemType Item)
443 {
445 if (RowWidget)
446 {
447 const FMargin DefaultPadding = RowWidget->GetClass()->GetDefaultObject<UUserWidget>()->GetPadding();
449 }
450 }
451
452 void HandleItemClicked(ItemType Item)
453 {
455 OnItemClicked().Broadcast(Item);
456 }
457
458 void HandleItemDoubleClicked(ItemType Item)
459 {
461 OnItemDoubleClicked().Broadcast(Item);
462 }
463
464 void HandleSelectionChanged(NullableItemType Item, ESelectInfo::Type SelectInfo)
465 {
466 //@todo DanH ListView: This really isn't the event that many will expect it to be - is it worth having at all?
467 // It only works for single selection lists, and even then only broadcasts at the end - you don't get anything for de-selection
469 OnItemSelectionChanged().Broadcast(Item);
470 }
471
472 bool HandleIsSelectableOrNavigable(ItemType Item)
473 {
475 }
476
477 void HandleListViewScrolled(double OffsetInItems)
478 {
479 if (SListView<ItemType>* MyListView = GetMyListView())
480 {
481 const FVector2f DistanceRemaining = UE::Slate::CastToVector2f(MyListView->GetScrollDistanceRemaining());
483 OnListViewScrolled().Broadcast(static_cast<float>(OffsetInItems), DistanceRemaining.Y);
484 }
485 }
486
487 void HandleFinishedScrolling()
488 {
490 OnFinishedScrolling().Broadcast();
491 }
492
493 void HandleItemScrolledIntoView(ItemType Item, const TSharedPtr<ITableRow>& InWidget)
494 {
496 if (ensure(RowWidget))
497 {
499 OnItemScrolledIntoView().Broadcast(Item, *RowWidget);
500 }
501 }
502
503 void HandleExpansionChanged(ItemType Item, bool bIsExpanded)
504 {
505 // If this item is currently visible (i.e. has a widget representing it), notify the widget of the expansion change
506 auto ObjectRow = GetObjectRowFromItem(Item);
507 if (ObjectRow.IsValid())
508 {
509 ObjectRow->NotifyItemExpansionChanged(bIsExpanded);
510 }
511
512 OnItemExpansionChangedInternal(Item, bIsExpanded);
513 OnItemExpansionChanged().Broadcast(Item, bIsExpanded);
514 }
515
516 void HandleGetChildren(ItemType Item, TArray<ItemType>& OutChildren) const
517 {
519 }
520};
521
523// UListViewBase
525
544UCLASS(Abstract, NotBlueprintable, hidedropdown, meta = (EntryInterface = UserListEntry), MinimalAPI)
546{
548
549public:
551
552#if WITH_EDITOR
553 UMG_API virtual const FText GetPaletteCategory() override;
555#endif
556
557 TSubclassOf<UUserWidget> GetEntryWidgetClass() const { return EntryWidgetClass; }
558
560 UFUNCTION(BlueprintCallable, Category = ListViewBase)
561 UMG_API const TArray<UUserWidget*>& GetDisplayedEntryWidgets() const;
562
564 UFUNCTION(BlueprintCallable, Category = ListViewBase)
565 UMG_API float GetScrollOffset() const;
566
568 virtual UObject* GetListObjectFromEntry(UUserWidget& EntryWidget) { return nullptr; }
569
571 UFUNCTION(BlueprintCallable, Category = ListView)
572 bool GetIsDraggingListItem() const { return bIsDragging; }
573
578 UFUNCTION(BlueprintCallable, Category = ListViewBase)
579 UMG_API void RegenerateAllEntries();
580
582 UFUNCTION(BlueprintCallable, Category = ListViewBase)
583 UMG_API void ScrollToTop();
584
586 UFUNCTION(BlueprintCallable, Category = ListViewBase)
587 UMG_API void ScrollToBottom();
588
590 UFUNCTION(BlueprintCallable, Category = ListView)
591 UMG_API void SetScrollOffset(const float InScrollOffset);
592
594 UFUNCTION(BlueprintCallable, Category = ListView)
595 UMG_API void EndInertialScrolling();
596
597 UFUNCTION(BlueprintCallable, Category = ListViewBase)
598 UMG_API void SetWheelScrollMultiplier(float NewWheelScrollMultiplier);
599
600 UFUNCTION(BlueprintCallable, Category = ListViewBase)
601 UMG_API void SetScrollbarVisibility(ESlateVisibility InVisibility);
602
603 UFUNCTION(BlueprintCallable, Category = ListViewBase)
604 UMG_API void SetAllowOverScroll(bool NewAllowOverscroll);
605
607 UFUNCTION(BlueprintCallable, Category = ListViewBase)
608 UMG_API void SetIsPointerScrollingEnabled(bool bInIsPointerScrollingEnabled);
609
611 UFUNCTION(BlueprintCallable, Category = ListViewBase)
612 UMG_API void SetIsGamepadScrollingEnabled(bool bInIsGamepadScrollingEnabled);
613
615 UFUNCTION(BlueprintCallable, Category = ListViewBase)
616 UMG_API void CancelListViewDragDrop();
617
618 // Creates the drag drop operation for the list view.
619 UFUNCTION(Category = ListViewBase)
620 UDragDropOperation* CreateDragDropOperation(UObject* Item);
621
631 UFUNCTION(BlueprintCallable, Category = ListViewBase)
632 UMG_API void RequestRefresh();
633
635 FOnListEntryGenerated& OnEntryWidgetGenerated() { return OnListEntryGeneratedEvent; }
636
638 FOnEntryWidgetReleased& OnEntryWidgetReleased() { return OnEntryWidgetReleasedEvent; }
639
640protected:
641 UMG_API virtual TSharedRef<SWidget> RebuildWidget() override final;
642 UMG_API virtual void ReleaseSlateResources(bool bReleaseChildren) override;
643 UMG_API virtual void SynchronizeProperties() override;
644
646 UMG_API virtual TSharedRef<STableViewBase> RebuildListWidget();
647
648 //@todo DanH: Should probably have the events for native & BP built in up here - need to update existing binds to UListView's version
649 virtual void HandleListEntryHovered(UUserWidget& EntryWidget) {};
650 virtual void HandleListEntryUnhovered(UUserWidget& EntryWidget) {};
651 virtual UDragDropOperation* HandleListEntryDragDetected(const FGeometry& MyGeometry, const FPointerEvent& PointerEvent, UUserWidget& EntryWidget) { return nullptr; };
654 virtual void HandleListEntryDragEnter(const FDragDropEvent& DropEvent, UUserWidget& EntryWidget) {};
655 virtual void HandleListEntryDragLeave(const FDragDropEvent& DropEvent, UUserWidget& EntryWidget) {};
657
658 UMG_API virtual void FinishGeneratingEntry(UUserWidget& GeneratedEntry);
659
661 UPROPERTY(BlueprintAssignable, Category = Events, meta = (DisplayName = "On Entry Generated"))
662 FOnListEntryGeneratedDynamic BP_OnEntryGenerated;
663 virtual void NativeOnEntryGenerated(UUserWidget* EntryWidget) {};
664
666 UPROPERTY(BlueprintAssignable, Category = Events, meta = (DisplayName = "On Entries Generated"))
667 FOnListEntriesGeneratedDynamic BP_OnEntriesGenerated;
668 virtual void NativeOnEntriesGenerated() {};
669
676
677 template <typename WidgetEntryT = UUserWidget, typename ObjectTableRowT = SObjectTableRow<UObject*>>
679 {
681 "GenerateObjectTableRow can only be used to create SObjectWidget types that also inherit from ITableRow. See SObjectTableRow.");
682
683 WidgetEntryT* ListEntryWidget = EntryWidgetPool.GetOrCreateInstance<WidgetEntryT>(*WidgetClass,
684 [this, &OwnerTable] (UUserWidget* WidgetObject, TSharedRef<SWidget> Content)
685 {
686 return SNew(ObjectTableRowT, OwnerTable, *WidgetObject, this)
687 .bAllowDragging(bAllowDragging)
688 .bAllowDragDrop(bAllowDragDrop)
689 .bAllowKeepPreselectedItems(bAllowKeepPreselectedItems)
690 .OnHovered_UObject(this, &UListViewBase::HandleListEntryHovered)
691 .OnUnhovered_UObject(this, &UListViewBase::HandleListEntryUnhovered)
692 .OnRowDragDetected_UObject(this, &UListViewBase::HandleListEntryDragDetected)
693 .OnRowCanAcceptDrop_UObject(this, &UListViewBase::HandleListEntryCanAcceptDrop)
694 .OnRowAcceptDrop_UObject(this, &UListViewBase::HandleListEntryAcceptDrop)
695 .OnRowDragEnter_UObject(this, &UListViewBase::HandleListEntryDragEnter)
696 .OnRowDragLeave_UObject(this, &UListViewBase::HandleListEntryDragLeave)
697 .OnRowDragCancelled_UObject(this, &UListViewBase::HandleListEntryDragCancelled)
698 [
699 Content
700 ];
701 });
703
704 FinishGeneratingEntry(*ListEntryWidget);
705
706 return *ListEntryWidget;
707 }
708
709#if WITH_EDITOR
717 virtual void OnRefreshDesignerItems() {}
718
723 template <typename PlaceholderItemT>
725 {
727 bool bRefresh = false;
728 if (EntryWidgetClass && NumDesignerPreviewEntries > 0 && EntryWidgetClass->ImplementsInterface(UUserListEntry::StaticClass()))
729 {
730 if (ListItems.Num() < NumDesignerPreviewEntries)
731 {
732 while (ListItems.Num() < NumDesignerPreviewEntries)
733 {
734 ListItems.Add(CreateItemFunc());
735 }
736 bRefresh = true;
737 }
738 else if (ListItems.Num() > NumDesignerPreviewEntries)
739 {
740 const int32 NumExtras = ListItems.Num() - NumDesignerPreviewEntries;
741 ListItems.RemoveAtSwap(ListItems.Num() - (NumExtras + 1), NumExtras);
742 bRefresh = true;
743 }
744 }
745 else
746 {
747 ListItems.Reset();
748 bRefresh = true;
749 }
750
751 if (bRefresh)
752 {
753 RequestRefresh();
754 }
755 }
756#endif
757
759 UMG_API void HandleRowReleased(const TSharedRef<ITableRow>& Row);
760
761 // Note: Options for this property can be configured via class and property metadata. See class declaration comment above.
763 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = ListEntries, meta = (DesignerRebuild, AllowPrivateAccess = true, MustImplement = "/Script/UMG.UserListEntry"))
764 TSubclassOf<UUserWidget> EntryWidgetClass;
765
767 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Scrolling)
768 float WheelScrollMultiplier = 1.f;
769
771 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Scrolling)
772 bool bEnableScrollAnimation = false;
773
775 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Scrolling)
776 float ScrollingAnimationInterpolationSpeed = 12.f;
777
779 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Scrolling, DisplayName = "Enable Touch Animated Scrolling")
780 bool bInEnableTouchAnimatedScrolling = false;
781
783 UPROPERTY(EditAnywhere, Category = Scrolling)
784 bool AllowOverscroll = true;
785
787 UPROPERTY(EditAnywhere, Category = Scrolling)
788 bool bEnableRightClickScrolling = true;
789
791 UPROPERTY(EditAnywhere, Category = Scrolling)
792 bool bEnableTouchScrolling = true;
793
795 UPROPERTY(EditDefaultsOnly, Category = Scrolling)
796 bool bIsPointerScrollingEnabled = true;
797
799 UPROPERTY(EditDefaultsOnly, Category = Scrolling)
800 bool bIsGamepadScrollingEnabled = true;
801
802 UPROPERTY(EditAnywhere, Category = Scrolling)
803 bool bEnableFixedLineOffset = false;
804
810 UPROPERTY(EditAnywhere, Category = Scrolling, meta = (EditCondition = bEnableFixedLineOffset, ClampMin = 0.0f, ClampMax = 0.5f))
811 float FixedLineScrollOffset = 0.f;
812
814 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Scrolling")
815 bool bAllowDragging = true;
816
818 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Drag and Drop")
819 bool bAllowDragDrop = false;
820
825 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Drag and Drop")
826 EDragPivot DragDropVisualPivot = EDragPivot::CenterCenter;
827
829 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Drag and Drop")
830 FVector2D DragDropVisualOffset = FVector2D(0,0);
831
833 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Drag and Drop", meta = (AllowPrivateAccess = true, MustImplement = "/Script/UMG.UserListEntry"))
834 TSubclassOf<UUserWidget> DragDropVisualEntryClass;
835
837 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Drag and Drop", meta = (AllowPrivateAccess = true))
838 TSubclassOf<UDragDropOperation> DragDropOperationClass;
839
841 UPROPERTY(BlueprintReadWrite, Transient, Category = "Drag and Drop")
842 TObjectPtr<class UWidget> DragVisualWidget = nullptr;
843
845 UPROPERTY(BlueprintReadOnly, Transient, Category = "Drag and Drop")
846 bool bIsDragging = false;
847
849 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = ListView)
850 bool bSelectItemOnNavigation = true;
851
853 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = ListView)
854 bool bAllowKeepPreselectedItems = true;
855
857 UPROPERTY(BlueprintAssignable, Category = Events, meta = (DisplayName = "On Entry Released"))
858 FOnListEntryReleasedDynamic BP_OnEntryReleased;
859 virtual void NativeOnEntryReleased(UUserWidget* EntryWidget) {};
860
861
862private:
863 UMG_API virtual void HandleAnnounceGeneratedEntries();
864
865#if WITH_EDITORONLY_DATA
867
869 UPROPERTY(EditAnywhere, Category = ListEntries, meta = (ClampMin = 0, ClampMax = 20))
871#endif
872
874 FUserWidgetPool EntryWidgetPool;
875
876 FTSTicker::FDelegateHandle EntryGenAnnouncementDelegateHandle;
877
878 FOnListEntryGenerated OnListEntryGeneratedEvent;
879 FOnEntryWidgetReleased OnEntryWidgetReleasedEvent;
880
881 TSharedPtr<STableViewBase> MyTableViewBase;
882
883 friend class FListViewBaseDetails;
884};
885
886
887#define IMPLEMENT_TYPED_UMG_LIST(ItemType, ListPropertyName) \
888protected: \
889 virtual SListView<ItemType>* GetMyListView() const override { return ListPropertyName.Get(); } \
890 virtual uint32 GetOwningUserIndex() const override \
891 { \
892 const ULocalPlayer* LocalPlayer = GetOwningLocalPlayer(); \
893 int32 SlateUserIndex = LocalPlayer ? FSlateApplication::Get().GetUserIndexForController(LocalPlayer->GetControllerId()) : 0; \
894 return SlateUserIndex >= 0 ? SlateUserIndex : 0; \
895 } \
896 virtual bool IsDesignerPreview() const override { return IsDesignTime(); } \
897private: \
898 friend class ITypedUMGListView<ItemType>; \
899 mutable FSimpleListItemEvent OnItemClickedEvent; \
900 mutable FSimpleListItemEvent OnItemDoubleClickedEvent; \
901 mutable FSimpleListItemEvent OnItemDragDetectedEvent; \
902 mutable FSimpleListItemEvent OnItemDragEnterEvent; \
903 mutable FSimpleListItemEvent OnItemDragLeaveEvent; \
904 mutable FOnItemDragCancelled OnItemDragCancelledEvent; \
905 mutable FOnItemCanAcceptDrop OnItemCanAcceptDropEvent; \
906 mutable FSimpleListItemEvent OnItemAcceptDropEvent; \
907 mutable FOnItemSelectionChanged OnItemSelectionChangedEvent; \
908 mutable FOnItemIsHoveredChanged OnItemIsHoveredChangedEvent; \
909 mutable FOnItemScrolledIntoView OnItemScrolledIntoViewEvent; \
910 mutable FOnListViewScrolled OnListViewScrolledEvent; \
911 mutable FOnFinishedScrolling OnFinishedScrollingEvent; \
912 mutable FOnItemExpansionChanged OnItemExpansionChangedEvent; \
913 mutable FOnGetEntryClassForItem OnGetEntryClassForItemDelegate; \
914 mutable FOnIsItemSelectableOrNavigable OnIsItemSelectableOrNavigableDelegate; \
915public: \
916 virtual TSubclassOf<UUserWidget> GetDefaultEntryClass() const override { return EntryWidgetClass; } \
917 virtual FSimpleListItemEvent& OnItemClicked() const override { return OnItemClickedEvent; } \
918 virtual FSimpleListItemEvent& OnItemDoubleClicked() const override { return OnItemDoubleClickedEvent; } \
919 virtual FOnItemIsHoveredChanged& OnItemIsHoveredChanged() const override { return OnItemIsHoveredChangedEvent; } \
920 virtual FSimpleListItemEvent& OnItemDragDetected() const override { return OnItemDragDetectedEvent; } \
921 virtual FSimpleListItemEvent& OnItemDragEnter() const override { return OnItemDragEnterEvent; } \
922 virtual FSimpleListItemEvent& OnItemDragLeave() const override { return OnItemDragLeaveEvent; } \
923 virtual FOnItemDragCancelled& OnItemDragCancelled() const override { return OnItemDragCancelledEvent; } \
924 virtual FOnItemCanAcceptDrop& OnItemCanAcceptDrop() const override { return OnItemCanAcceptDropEvent; } \
925 virtual FSimpleListItemEvent& OnItemAcceptDrop() const override { return OnItemAcceptDropEvent; } \
926 virtual FOnItemSelectionChanged& OnItemSelectionChanged() const override { return OnItemSelectionChangedEvent; } \
927 virtual FOnItemScrolledIntoView& OnItemScrolledIntoView() const override { return OnItemScrolledIntoViewEvent; } \
928 virtual FOnListViewScrolled& OnListViewScrolled() const override { return OnListViewScrolledEvent; } \
929 virtual FOnFinishedScrolling& OnFinishedScrolling() const override { return OnFinishedScrollingEvent; } \
930 virtual FOnItemExpansionChanged& OnItemExpansionChanged() const override { return OnItemExpansionChangedEvent; } \
931 virtual FOnGetEntryClassForItem& OnGetEntryClassForItem() const override { return OnGetEntryClassForItemDelegate; } \
932 virtual FOnIsItemSelectableOrNavigable& OnIsItemSelectableOrNavigable() const override { return OnIsItemSelectableOrNavigableDelegate; }
#define check(expr)
Definition AssertionMacros.h:314
#define ensure( InExpression)
Definition AssertionMacros.h:464
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
constexpr FNullOpt NullOpt
Definition Optional.h:15
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SNew(WidgetType,...)
Definition DeclarativeSyntaxSupport.h:37
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:53
EDragPivot
Definition DragDropOperation.h:36
return true
Definition ExternalRpcRegistry.cpp:601
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
typename UE::Core::Private::TObjectPtrWrapTypeOf< T >::Type TObjectPtrWrapTypeOf
Definition ObjectPtr.h:1761
EItemDropZone
Definition STableRow.h:59
EScrollIntoViewAlignment
Definition STableViewBase.h:60
EListItemAlignment
Definition STableViewBase.h:34
EOrientation
Definition SlateEnums.h:261
EConsumeMouseWheel
Definition SlateTypes.h:26
ESlateVisibility
Definition SlateWrapperTypes.h:22
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition DragAndDrop.h:141
Definition UObjectGlobals.h:1292
Definition Reply.h:24
static FReply Unhandled()
Definition Reply.h:241
Definition Text.h:385
static const ISlateStyle & Get()
Definition UMGCoreStyle.h:18
const WidgetStyleType & GetWidgetStyle(FName PropertyName, const ANSICHAR *Specifier, const WidgetStyleType *DefaultValue, bool bWarnIfNotFound) const
Definition ISlateStyle.h:53
Definition ListViewBase.h:40
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnItemIsHoveredChanged, ItemType, bool)
virtual FSimpleListItemEvent & OnItemAcceptDrop() const =0
static TSharedRef< TreeViewT< ItemType > > ConstructTreeView(UListViewBaseT *Implementer, const TArray< ItemType > &ListItems, const FTreeViewConstructArgs &Args=FTreeViewConstructArgs())
Definition ListViewBase.h:359
virtual SListView< ItemType > * GetMyListView() const =0
DECLARE_MULTICAST_DELEGATE_OneParam(FSimpleListItemEvent, ItemType)
virtual FOnItemScrolledIntoView & OnItemScrolledIntoView() const =0
NullableItemType GetSelectedItem() const
Definition ListViewBase.h:120
virtual FOnIsItemSelectableOrNavigable & OnIsItemSelectableOrNavigable() const =0
virtual FOnItemExpansionChanged & OnItemExpansionChanged() const =0
virtual FSimpleListItemEvent & OnItemDragDetected() const =0
virtual void OnItemExpansionChangedInternal(ItemType Item, bool bIsExpanded)
Definition ListViewBase.h:424
virtual FSimpleListItemEvent & OnItemDragEnter() const =0
void SetSelectedItem(const ItemType &SoleSelectedItem, ESelectInfo::Type SelectInfo=ESelectInfo::Direct)
Definition ListViewBase.h:182
int32 GetNumItemsSelected() const
Definition ListViewBase.h:176
int32 GetIndexInList(const ItemType &Item) const
Definition ListViewBase.h:158
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnItemScrolledIntoView, ItemType, UUserWidget &)
static TSharedRef< ListViewT< ItemType > > ConstructListView(UListViewBaseT *Implementer, const TArray< ItemType > &ListItems, const FListViewConstructArgs &Args=FListViewConstructArgs())
Definition ListViewBase.h:268
virtual void OnGetChildrenInternal(ItemType Item, TArray< ItemType > &OutChildren) const
Definition ListViewBase.h:414
virtual bool OnIsSelectableOrNavigableInternal(ItemType FirstSelectedItem)
Definition ListViewBase.h:420
virtual uint32 GetOwningUserIndex() const =0
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnItemCanAcceptDrop, ItemType, bool)
DECLARE_DELEGATE_RetVal_OneParam(bool, FOnIsItemSelectableOrNavigable, ItemType)
virtual FSimpleListItemEvent & OnItemClicked() const =0
virtual FOnItemSelectionChanged & OnItemSelectionChanged() const =0
DECLARE_MULTICAST_DELEGATE_OneParam(FOnItemSelectionChanged, NullableItemType)
virtual bool IsDesignerPreview() const =0
DECLARE_MULTICAST_DELEGATE_OneParam(FOnItemDragCancelled, const FDragDropEvent &)
virtual FOnListViewScrolled & OnListViewScrolled() const =0
bool IsItemVisible(const ItemType &Item) const
Definition ListViewBase.h:206
const TObjectPtrWrapTypeOf< ItemType > * ItemFromEntryWidget(const UUserWidget &EntryWidget) const
Definition ListViewBase.h:133
typename SListView< ItemType >::NullableItemType NullableItemType
Definition ListViewBase.h:42
virtual TSubclassOf< UUserWidget > GetDefaultEntryClass() const =0
virtual void OnItemClickedInternal(ItemType Item)
Definition ListViewBase.h:417
virtual void OnSelectionChangedInternal(NullableItemType FirstSelectedItem)
Definition ListViewBase.h:419
virtual FOnGetEntryClassForItem & OnGetEntryClassForItem() const =0
virtual FOnItemIsHoveredChanged & OnItemIsHoveredChanged() const =0
virtual void OnListViewScrolledInternal(float ItemOffset, float DistanceRemaining)
Definition ListViewBase.h:422
void SetItemSelection(const ItemType &Item, bool bIsSelected, ESelectInfo::Type SelectInfo=ESelectInfo::Direct)
Definition ListViewBase.h:190
virtual FOnItemCanAcceptDrop & OnItemCanAcceptDrop() const =0
RowWidgetT * GetEntryWidgetFromItem(const ItemType &Item) const
Definition ListViewBase.h:148
virtual void OnListViewFinishedScrollingInternal()
Definition ListViewBase.h:423
static TSharedRef< TileViewT< ItemType > > ConstructTileView(UListViewBaseT *Implementer, const TArray< ItemType > &ListItems, const FTileViewConstructArgs &Args=FTileViewConstructArgs())
Definition ListViewBase.h:315
DECLARE_DELEGATE_RetVal_OneParam(TSubclassOf< UUserWidget >, FOnGetEntryClassForItem, ItemType)
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnListViewScrolled, float, float)
virtual UUserWidget & OnGenerateEntryWidgetInternal(ItemType Item, TSubclassOf< UUserWidget > DesiredEntryClass, const TSharedRef< STableViewBase > &OwnerTable)=0
virtual void OnItemScrolledIntoViewInternal(ItemType Item, UUserWidget &EntryWidget)
Definition ListViewBase.h:421
virtual FSimpleListItemEvent & OnItemDoubleClicked() const =0
bool IsItemSelected(const ItemType &Item) const
Definition ListViewBase.h:212
virtual FOnFinishedScrolling & OnFinishedScrolling() const =0
int32 GetSelectedItems(TArray< ItemType > &OutSelectedItems) const
Definition ListViewBase.h:170
TSharedPtr< ObjectRowT< ItemType > > GetObjectRowFromItem(const ItemType &Item) const
Definition ListViewBase.h:392
virtual void OnItemDoubleClickedInternal(ItemType Item)
Definition ListViewBase.h:418
void ClearSelection()
Definition ListViewBase.h:198
DECLARE_MULTICAST_DELEGATE_TwoParams(FOnItemExpansionChanged, ItemType, bool)
virtual FOnItemDragCancelled & OnItemDragCancelled() const =0
void CancelScrollIntoView()
Definition ListViewBase.h:234
void RequestNavigateToItem(const ItemType &Item)
Definition ListViewBase.h:218
DECLARE_MULTICAST_DELEGATE(FOnFinishedScrolling)
void RequestScrollItemIntoView(const ItemType &Item)
Definition ListViewBase.h:226
virtual FMargin GetDesiredEntryPadding(ItemType Item) const
Definition ListViewBase.h:411
virtual FSimpleListItemEvent & OnItemDragLeave() const =0
virtual TSubclassOf< UUserWidget > GetDesiredEntryClassForItem(ItemType Item) const
Definition ListViewBase.h:101
Definition SListView.h:66
bool IsItemSelected(const ItemType &InItem) const
Definition SListView.h:1819
typename TListTypeTraits< ItemType >::NullableType NullableItemType
Definition SListView.h:68
const TObjectPtrWrapTypeOf< ItemType > * ItemFromWidget(const ITableRow *WidgetToFind) const
Definition SListView.h:1807
bool IsItemVisible(ItemType Item) const
Definition SListView.h:1961
int32 GetNumItemsSelected() const
Definition SListView.h:1916
virtual TArray< ItemType > GetSelectedItems() const override
Definition SListView.h:1933
Definition SObjectTableRow.h:61
Definition STableViewBase.h:110
Definition STileView.h:24
Definition STreeView.h:90
void SetCanTick(bool bInCanTick)
Definition SWidget.h:671
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
void Reset(SizeType NewSize=0)
Definition Array.h:2246
UE_FORCEINLINE_HINT void RemoveAtSwap(SizeType Index, EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:2185
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
Definition Attribute.h:17
Definition AssetRegistryState.h:50
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition SlateDelegates.h:134
Definition SubclassOf.h:30
UObject * GetDefaultObject(bool bCreateIfNeeded=true) const
Definition Class.h:4373
Definition DragDropOperation.h:55
Definition ListViewBase.h:546
virtual UObject * GetListObjectFromEntry(UUserWidget &EntryWidget)
Definition ListViewBase.h:568
TArray< TWeakObjectPtr< UUserWidget > > GeneratedEntriesToAnnounce
Definition ListViewBase.h:675
FOnEntryWidgetReleased & OnEntryWidgetReleased()
Definition ListViewBase.h:638
virtual void HandleListEntryUnhovered(UUserWidget &EntryWidget)
Definition ListViewBase.h:650
virtual void HandleListEntryDragEnter(const FDragDropEvent &DropEvent, UUserWidget &EntryWidget)
Definition ListViewBase.h:654
virtual void HandleListEntryHovered(UUserWidget &EntryWidget)
Definition ListViewBase.h:649
DECLARE_EVENT_OneParam(UListView, FOnEntryWidgetReleased, UUserWidget &)
virtual void HandleListEntryDragLeave(const FDragDropEvent &DropEvent, UUserWidget &EntryWidget)
Definition ListViewBase.h:655
FOnListEntryGenerated & OnEntryWidgetGenerated()
Definition ListViewBase.h:635
virtual void HandleListEntryDragCancelled(const FDragDropEvent &DropEvent)
Definition ListViewBase.h:656
DECLARE_EVENT_OneParam(UListView, FOnListEntryGenerated, UUserWidget &)
TSubclassOf< UUserWidget > GetEntryWidgetClass() const
Definition ListViewBase.h:557
virtual FReply HandleListEntryAcceptDrop(const FDragDropEvent &DropEvent, EItemDropZone DropZone, UUserWidget &EntryWidget)
Definition ListViewBase.h:653
WidgetEntryT & GenerateTypedEntry(TSubclassOf< WidgetEntryT > WidgetClass, const TSharedRef< STableViewBase > &OwnerTable)
Definition ListViewBase.h:678
virtual TOptional< EItemDropZone > HandleListEntryCanAcceptDrop(const FDragDropEvent &DropEvent, EItemDropZone DropZone, UUserWidget &EntryWidget)
Definition ListViewBase.h:652
virtual UDragDropOperation * HandleListEntryDragDetected(const FGeometry &MyGeometry, const FPointerEvent &PointerEvent, UUserWidget &EntryWidget)
Definition ListViewBase.h:651
Definition ListView.h:39
Definition UMG.Build.cs:6
FORCEINLINE UClass * GetClass() const
Definition UObjectBase.h:217
Definition Object.h:95
bool Implements() const
Definition Class.h:5202
Definition IUserListEntry.h:23
Definition UserWidget.h:284
UMG_API void SetPadding(FMargin InPadding)
Definition UserWidget.cpp:459
Definition Widget.h:217
UMG_API TSharedPtr< SWidget > GetCachedWidget() const
Definition Widget.cpp:1116
Type
Definition SlateEnums.h:311
@ Direct
Definition SlateEnums.h:319
Type
Definition ITypedTableView.h:16
@ Single
Definition ITypedTableView.h:21
const FVector2f & CastToVector2f(const FVector2f &InValue)
Definition SlateVector2.h:591
@ false
Definition radaudio_common.h:23
Definition Visibility.h:12
static SLATECORE_API const EVisibility Collapsed
Definition Visibility.h:17
Definition Geometry.h:40
Definition Margin.h:17
Definition Events.h:695
Definition SlateTypes.h:932
Definition SlateTypes.h:2023
Definition SlateTypes.h:1606
Definition UserWidgetPool.h:27
Definition ListViewBase.h:250
FMargin ScrollBarPadding
Definition ListViewBase.h:263
const FTableViewStyle * ListViewStyle
Definition ListViewBase.h:259
bool bPreventThrottling
Definition ListViewBase.h:264
bool bClearSelectionOnClick
Definition ListViewBase.h:253
bool bReturnFocusToSelection
Definition ListViewBase.h:255
bool bAllowFocus
Definition ListViewBase.h:251
ESelectionMode::Type SelectionMode
Definition ListViewBase.h:252
EConsumeMouseWheel ConsumeMouseWheel
Definition ListViewBase.h:254
bool bEnableShadowBoxStyle
Definition ListViewBase.h:262
const FScrollBoxStyle * ShadowBoxStyle
Definition ListViewBase.h:261
EScrollIntoViewAlignment ScrollIntoViewAlignment
Definition ListViewBase.h:258
bool bClearScrollVelocityOnSelection
Definition ListViewBase.h:256
const FScrollBarStyle * ScrollBarStyle
Definition ListViewBase.h:260
EOrientation Orientation
Definition ListViewBase.h:257
Definition ListViewBase.h:305
const FScrollBarStyle * ScrollBarStyle
Definition ListViewBase.h:310
bool bWrapDirectionalNavigation
Definition ListViewBase.h:309
TAttribute< float > EntryHeight
Definition ListViewBase.h:307
EListItemAlignment TileAlignment
Definition ListViewBase.h:306
TAttribute< float > EntryWidth
Definition ListViewBase.h:308
EVisibility ScrollbarDisabledVisibility
Definition ListViewBase.h:311
Definition ListViewBase.h:349
bool bClearSelectionOnClick
Definition ListViewBase.h:351
EConsumeMouseWheel ConsumeMouseWheel
Definition ListViewBase.h:352
const FTableViewStyle * TreeViewStyle
Definition ListViewBase.h:354
bool bReturnFocusToSelection
Definition ListViewBase.h:353
const FScrollBarStyle * ScrollBarStyle
Definition ListViewBase.h:355
ESelectionMode::Type SelectionMode
Definition ListViewBase.h:350
Definition UnrealTypeTraits.h:40
Definition TableViewTypeTraits.h:121
Definition ObjectPtr.h:488
Definition Optional.h:131