UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SColorSpectrum.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Misc/Attribute.h"
7#include "Input/Reply.h"
11
12class FPaintArgs;
14struct FSlateBrush;
15
20 : public SLeafWidget
21{
22public:
23
31
33 SLATE_ATTRIBUTE(FLinearColor, SelectedColor)
34
35
36 SLATE_EVENT(FSimpleDelegate, OnMouseCaptureBegin)
37
38
39 SLATE_EVENT(FSimpleDelegate, OnMouseCaptureEnd)
40
41
43
44
45 SLATE_ATTRIBUTE(float, CtrlMultiplier)
46
48
49public:
52
58 SLATE_API void Construct( const FArguments& InArgs );
59
60public:
61
62 // SWidget overrides
63
69 SLATE_API virtual int32 OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const override;
71
73
80
85
87
88 // The color spectrum image to show.
89 const FSlateBrush* Image;
90
91 // The current color selected by the user.
93
94 // Mouse sensitivity multiplier to use when dragging the selector on the color spectrum, applied when the ctrl modifier key is pressed
95 TAttribute<float> CtrlMultiplier;
96
97 // The color selector image to show.
98 const FSlateBrush* SelectorImage;
99
100 // Whether the user is dragging the slider
101 bool bDragging = false;
102
103 // Cached mouse position to restore after dragging.
104 FVector2f LastSpectrumPosition;
105
106private:
107
108 // Holds a delegate that is executed when the mouse is pressed and a capture begins.
109 FSimpleDelegate OnMouseCaptureBegin;
110
111 // Holds a delegate that is executed when the mouse is let up and a capture ends.
112 FSimpleDelegate OnMouseCaptureEnd;
113
114 // Holds a delegate that is executed when a new value is selected on the color spectrum.
115 FOnLinearColorValueChanged OnValueChanged;
116};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SLATE_ATTRIBUTE(AttrType, AttrName)
Definition DeclarativeSyntaxSupport.h:192
#define SLATE_EVENT(DelegateName, EventName)
Definition DeclarativeSyntaxSupport.h:458
#define SLATE_END_ARGS()
Definition DeclarativeSyntaxSupport.h:116
EInvalidateWidgetReason
Definition InvalidateWidgetReason.h:14
Definition CursorReply.h:16
Definition PaintArgs.h:23
Definition Reply.h:24
Definition SlateRect.h:26
Definition DrawElements.h:220
Definition WidgetStyle.h:15
Definition SColorSpectrum.h:21
SLATE_BEGIN_ARGS(SColorSpectrum)
Definition SColorSpectrum.h:24
virtual SLATE_API int32 OnPaint(const FPaintArgs &Args, const FGeometry &AllottedGeometry, const FSlateRect &MyCullingRect, FSlateWindowElementList &OutDrawElements, int32 LayerId, const FWidgetStyle &InWidgetStyle, bool bParentEnabled) const override
Definition SColorSpectrum.cpp:98
virtual SLATE_API FCursorReply OnCursorQuery(const FGeometry &MyGeometry, const FPointerEvent &CursorEvent) const override
Definition SColorSpectrum.cpp:196
virtual SLATE_API FReply OnMouseMove(const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
Definition SColorSpectrum.cpp:79
virtual SLATE_API FReply OnMouseButtonDown(const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
Definition SColorSpectrum.cpp:47
virtual SLATE_API FReply OnMouseButtonUp(const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) override
Definition SColorSpectrum.cpp:61
SLATE_API void Construct(const FArguments &InArgs)
Definition SColorSpectrum.cpp:18
SLATE_API void ProcessMouseAction(const FGeometry &MyGeometry, const FPointerEvent &MouseEvent)
Definition SColorSpectrum.cpp:149
virtual SLATE_API FReply OnMouseButtonDoubleClick(const FGeometry &InMyGeometry, const FPointerEvent &InMouseEvent) override
Definition SColorSpectrum.cpp:41
SLATE_API FVector2D CalcRelativeSelectedPosition() const
Definition SColorSpectrum.cpp:136
virtual SLATE_API FVector2D ComputeDesiredSize(float) const override
Definition SColorSpectrum.cpp:35
Definition SLeafWidget.h:29
Definition Attribute.h:17
@ false
Definition radaudio_common.h:23
Definition Geometry.h:40
Definition Color.h:48
Definition Events.h:695
Definition SlateBrush.h:239
Definition SWidget.h:189