UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TileView.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "ListView.h"
7#include "TileView.generated.h"
8
14UCLASS(MinimalAPI)
16{
18
19public:
21
22 UMG_API virtual void ReleaseSlateResources(bool bReleaseChildren) override;
23
25 UFUNCTION(BlueprintCallable, Category = TileView)
26 UMG_API void SetEntryHeight(float NewHeight);
27
29 UFUNCTION(BlueprintCallable, Category = TileView)
30 UMG_API void SetEntryWidth(float NewWidth);
31
33 UFUNCTION(BlueprintPure, Category = TileView)
34 float GetEntryHeight() const { return EntryHeight; }
35
37 UFUNCTION(BlueprintPure, Category = TileView)
38 float GetEntryWidth() const { return EntryWidth; }
39
40protected:
41 UMG_API virtual TSharedRef<STableViewBase> RebuildListWidget() override;
42 UMG_API virtual FMargin GetDesiredEntryPadding(UObject* Item) const override;
43
44 UMG_API float GetTotalEntryHeight() const;
45 UMG_API float GetTotalEntryWidth() const;
46
48 template <template<typename> class TileViewT = STileView>
50 {
51 FTileViewConstructArgs Args;
52 Args.bAllowFocus = bIsFocusable;
53 Args.SelectionMode = SelectionMode;
54 Args.bClearSelectionOnClick = bClearSelectionOnClick;
55 Args.ConsumeMouseWheel = ConsumeMouseWheel;
56 Args.bReturnFocusToSelection = bReturnFocusToSelection;
57 Args.TileAlignment = TileAlignment;
58 Args.bWrapDirectionalNavigation = bWrapHorizontalNavigation;
59 Args.Orientation = Orientation;
60 Args.ScrollBarStyle = &ScrollBarStyle;
61 Args.ScrollbarDisabledVisibility = UWidget::ConvertSerializedVisibilityToRuntime(ScrollbarDisabledVisibility);
62
63 if (IsAligned() && !bEntrySizeIncludesEntrySpacing)
64 {
65 // This tells the underlying ListView to expect entries with the final width/height equal to EntryWidth/EntryHeight + spacing
66 // It allows the entry widget to always occupy the entire EntryWidth/EntryHeight.
67 Args.EntryWidth = GetTotalEntryWidth();
68 Args.EntryHeight = GetTotalEntryHeight();
69 }
70 else
71 {
72 // This tells the underlying ListView to expect entries with the final width/height equal to EntryWidth/EntryHeight.
73 // It forces the entry widget size to adjust so that the summation of entry widget width/height and spacing does not exceed EntryWidth/EntryHeight.
74 Args.EntryWidth = EntryWidth;
75 Args.EntryHeight = EntryHeight;
76 }
77
78 MyListView = MyTileView = ITypedUMGListView<UObject*>::ConstructTileView<TileViewT>(this, ListItems, Args);
80 return StaticCastSharedRef<TileViewT<UObject*>>(MyTileView.ToSharedRef());
81 }
82
83private:
85 UFUNCTION()
86 UMG_API bool IsAligned() const;
87
90 UPROPERTY(EditAnywhere, Category = ListEntries)
91 float EntryHeight = 128.f;
92
94 UPROPERTY(EditAnywhere, Category = ListEntries)
95 float EntryWidth = 128.f;
96
98 UPROPERTY(EditAnywhere, Category = ListEntries)
99 EListItemAlignment TileAlignment;
100
102 UPROPERTY(EditAnywhere, Category = Navigation)
103 bool bWrapHorizontalNavigation = false;
104
106 UPROPERTY(EditAnywhere, Category = ListView, meta=(ValidEnumValues="Collapsed, Hidden, Visible"))
107 ESlateVisibility ScrollbarDisabledVisibility = ESlateVisibility::Collapsed;
108
110
111private:
116 UPROPERTY(EditAnywhere, Category = ListEntries, meta = (EditCondition = "IsAligned"))
117 bool bEntrySizeIncludesEntrySpacing = true;
118};
constexpr bool IsAligned(T Val, uint64 Alignment)
Definition AlignmentTemplates.h:50
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#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
EListItemAlignment
Definition STableViewBase.h:34
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
ESlateVisibility
Definition SlateWrapperTypes.h:22
Definition UObjectGlobals.h:1292
Definition ListViewBase.h:40
Definition SListView.h:66
Definition STileView.h:24
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition ListView.h:39
UMG_API void HandleOnEntryInitializedInternal(UObject *Item, const TSharedRef< ITableRow > &TableRow)
Definition ListView.cpp:154
Definition Object.h:95
Definition TileView.h:16
TSharedRef< TileViewT< UObject * > > ConstructTileView()
Definition TileView.h:49
static UMG_API EVisibility ConvertSerializedVisibilityToRuntime(ESlateVisibility Input)
Definition Widget.cpp:1688
@ false
Definition radaudio_common.h:23
Definition Margin.h:17