AronaSlate/Source/Arona/UI/Widget/PlayList/SPlayListTimeLine.h
2024-01-25 11:21:15 +08:00

40 lines
1.3 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "SLeafWidget.h"
#include "Midi/MidiType.h"
#include "Midi/Time/TimePos.h"
/**
*
*/
class ARONA_API SPlayListTimeLine : public SLeafWidget
{
public:
SLATE_BEGIN_ARGS(SPlayListTimeLine)
{}
SLATE_ATTRIBUTE(TRange<AudioFrame>, FrameRange)
SLATE_END_ARGS()
/** Constructs this widget with InArgs */
void Construct(const FArguments& InArgs);
virtual FVector2D ComputeDesiredSize(float LayoutScaleMultiplier) const override { return FVector2D(0, 18); }
virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
virtual FReply OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
virtual FReply OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) override;
FLinearColor MainStepColor;
FLinearColor SubStepColor;
private:
void SetTimePos(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent);
TAttribute<TRange<AudioFrame>> FrameRange;
AudioFrame LastFrame = 0;
};