Files
Unreal-CommonTime/Source/CommonTime/Public/DetailCustomizations/MyDateTimeDetailCustomization.h

59 lines
1.7 KiB
C
Raw Permalink Normal View History

2023-10-28 02:46:42 +02:00
// Copyright 2023 MrRobin. All Rights Reserved.
#pragma once
#include "IPropertyTypeCustomization.h"
#include "Internationalization/Text.h"
#include "Styling/SlateColor.h"
#include "Templates/SharedPointer.h"
#include "Types/SlateEnums.h"
class IPropertyHandle;
class SEditableTextBox;
/**
2023-10-28 20:43:30 +02:00
* Implements a details view customization for the FDateTime structure.
2023-10-28 02:46:42 +02:00
*/
class FMyDateTimeDetailCustomization
: public IPropertyTypeCustomization
{
public:
public:
/**
* Creates an instance of this class.
*
* @return The new instance.
*/
static TSharedRef<IPropertyTypeCustomization> MakeInstance()
{
return MakeShareable(new FMyDateTimeDetailCustomization());
}
public:
// IPropertyTypeCustomization interface
void CustomizeChildren(TSharedRef<class IPropertyHandle> StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
void CustomizeHeader(TSharedRef<class IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
private:
2023-10-28 23:18:17 +02:00
TOptional<double> OnGetValue(int32 Index) const;
void OnValueCommitted(double NewValue, ETextCommit::Type CommitType, int32 Index);
void OnValueChanged(double NewValue, int32 Index);
2023-10-28 02:46:42 +02:00
void OnBeginSliderMovement();
2023-10-28 23:18:17 +02:00
void OnEndSliderMovement(double NewValue);
2023-10-28 02:46:42 +02:00
private:
/** Holds a handle to the property being edited. */
TSharedPtr<IPropertyHandle> PropertyHandle;
/** True if a value is being changed by dragging a slider */
bool bIsUsingSlider;
2023-10-28 20:43:30 +02:00
TSharedPtr<SWidget> YearEntryBox;
TSharedPtr<SWidget> MonthEntryBox;
TSharedPtr<SWidget> DayEntryBox;
TSharedPtr<SWidget> HourEntryBox;
TSharedPtr<SWidget> MinuteEntryBox;
TSharedPtr<SWidget> SecondEntryBox;
2023-10-28 02:46:42 +02:00
};