You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
#pragma once
|
|
|
|
#define LOCTEXT_NAMESPACE "WidgetCarousel"
|
|
|
|
/**
|
|
* A horizontal bar of buttons for navigating to a specific item in the widget carousel.
|
|
*/
|
|
class WIDGETCAROUSEL_API SCarouselNavigationBar : public SCompoundWidget
|
|
{
|
|
DECLARE_DELEGATE_OneParam(FOnSelectedIndexChanged, int32)
|
|
|
|
public:
|
|
SLATE_BEGIN_ARGS(SCarouselNavigationBar)
|
|
: _Style(&FWidgetCarouselModuleStyle::Get().GetWidgetStyle<FWidgetCarouselNavigationBarStyle>("CarouselNavigationBar"))
|
|
, _OnSelectedIndexChanged()
|
|
, _ItemCount(0)
|
|
, _CurrentItemIndex(0)
|
|
, _CurrentSlideAmount(0.0f)
|
|
|
|
{}
|
|
|
|
SLATE_STYLE_ARGUMENT(FWidgetCarouselNavigationBarStyle, Style)
|
|
|
|
/** Called when the selected index changes. */
|
|
SLATE_EVENT(FOnSelectedIndexChanged, OnSelectedIndexChanged)
|
|
|
|
/** The number of items to generate navigation buttons for. */
|
|
SLATE_ARGUMENT(int32, ItemCount)
|
|
|
|
/** The index of the currently selected item. */
|
|
SLATE_ATTRIBUTE(int32, CurrentItemIndex)
|
|
|
|
/** The amount of offset which should be applied to the selected item indicator. */
|
|
SLATE_ATTRIBUTE(float, CurrentSlideAmount)
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
int32 GetItemCount();
|
|
|
|
void SetItemCount(int32 InItemCount);
|
|
|
|
void Construct(const FArguments& InArgs);
|
|
|
|
private:
|
|
void BuildScrollBar();
|
|
|
|
FReply HandleItemButtonClicked(int32 ItemIndex);
|
|
|
|
FVector2D GetPlaceHolderPosition() const;
|
|
|
|
private:
|
|
const FWidgetCarouselNavigationBarStyle* Style;
|
|
TSharedPtr<SHorizontalBox> WidgetScrollBox;
|
|
FOnSelectedIndexChanged OnSelectedIndexChanged;
|
|
int32 ItemCount;
|
|
TAttribute<int32> CurrentItemIndex;
|
|
TAttribute<float> CurrentSlideAmount;
|
|
};
|
|
|
|
#undef LOCTEXT_NAMESPACE
|