2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
/** Widget wraps an editable text box for viewing the names of objects or editing the labels of actors */
|
|
|
|
|
class SObjectNameEditableTextBox : public IObjectNameEditableTextBox
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SLATE_BEGIN_ARGS(SObjectNameEditableTextBox){}
|
|
|
|
|
|
|
|
|
|
SLATE_ARGUMENT(TArray<TWeakObjectPtr<UObject>>, Objects)
|
|
|
|
|
|
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Construct this widget
|
|
|
|
|
*
|
|
|
|
|
* @param InArgs The declaration data for this widget
|
|
|
|
|
*/
|
|
|
|
|
void Construct( const FArguments& InArgs );
|
|
|
|
|
|
|
|
|
|
protected:
|
2014-07-23 08:23:21 -04:00
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) override;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-07-23 08:23:21 -04:00
|
|
|
virtual int32 OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const override;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
private:
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
/** Updates whether the highlight spring effect is happening */
|
2014-12-19 17:44:49 -05:00
|
|
|
EActiveTimerReturnType UpdateHighlightSpringState( double InCurrentTime, float InDeltaTime );
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/** Getter for the Text attribute of the editable text inside this widget */
|
|
|
|
|
FText GetNameText() const;
|
|
|
|
|
|
|
|
|
|
/** Should the name editing text box even be visible? */
|
|
|
|
|
EVisibility GetNameVisibility() const;
|
|
|
|
|
|
|
|
|
|
/** Getter for the ToolTipText attribute of the editable text inside this widget */
|
2015-01-08 11:35:01 -05:00
|
|
|
FText GetNameTooltipText() const;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/** Getter for the HintText attribute of the editable text inside this widget */
|
|
|
|
|
FText GetNameHintText() const;
|
|
|
|
|
|
|
|
|
|
/** Getter for the OnTextCommitted event of the editable text inside this widget */
|
|
|
|
|
void OnNameTextCommitted(const FText& NewText, ETextCommit::Type InTextCommit);
|
|
|
|
|
|
|
|
|
|
/** Getter for the IsReadOnly attribute of the editable text inside this widget */
|
|
|
|
|
bool CanEditNameText() const;
|
|
|
|
|
|
|
|
|
|
/** Getter for the SelectAllTextWhenFocused attribute of the editable text inside this widget */
|
|
|
|
|
bool CannotEditNameText() const { return !CanEditNameText(); }
|
|
|
|
|
|
|
|
|
|
/** Callback to verify a text change */
|
|
|
|
|
void OnTextChanged( const FText& InLabel );
|
|
|
|
|
|
|
|
|
|
/** Helper class the get the object name or the actor label if an object is an actor */
|
|
|
|
|
static FString GetObjectDisplayName(TWeakObjectPtr<UObject> Object);
|
|
|
|
|
|
|
|
|
|
/** The list of objects whose names are edited by the widget */
|
|
|
|
|
TArray<TWeakObjectPtr<UObject>> Objects;
|
|
|
|
|
|
|
|
|
|
/** The current user-entered text for a list of more than one object */
|
|
|
|
|
FString UserSetCommonName;
|
|
|
|
|
|
|
|
|
|
/** How many pixels to extend the highlight rectangle's left side horizontally */
|
|
|
|
|
static const float HighlightRectLeftOffset;
|
|
|
|
|
|
|
|
|
|
/** How many pixels to extend the highlight rectangle's right side horizontally */
|
|
|
|
|
static const float HighlightRectRightOffset;
|
|
|
|
|
|
|
|
|
|
/** How quickly the highlight 'targeting' rectangle will slide around. Larger is faster. */
|
|
|
|
|
static const float HighlightTargetSpringConstant;
|
|
|
|
|
|
|
|
|
|
/** Duration of animation highlight target effects */
|
|
|
|
|
static const float HighlightTargetEffectDuration;
|
|
|
|
|
|
|
|
|
|
/** Opacity of the highlight target effect overlay */
|
|
|
|
|
static const float HighlightTargetOpacity;
|
|
|
|
|
|
|
|
|
|
/** How large the highlight target effect will be when highlighting, as a scalar percentage of font height */
|
|
|
|
|
static const float CommittingAnimOffsetPercent;
|
|
|
|
|
|
|
|
|
|
/** Highlight "targeting" visual effect left position */
|
|
|
|
|
FFloatSpring1D HighlightTargetLeftSpring;
|
|
|
|
|
|
|
|
|
|
/** Highlight "targeting" visual effect right position */
|
|
|
|
|
FFloatSpring1D HighlightTargetRightSpring;
|
|
|
|
|
|
|
|
|
|
/** Last time that the user had a major interaction with the highlight */
|
|
|
|
|
double LastCommittedTime;
|
|
|
|
|
|
|
|
|
|
/** The text box used to edit object names */
|
|
|
|
|
TSharedPtr< SEditableTextBox > TextBox;
|
---- Merging with SlateDev branch ----
Introduces the concept of "Active Ticking" to allow Slate to go to sleep when there is no need to update the UI.
While asleep, Slate will skip the Tick & Paint pass for that frame entirely.
- There are TWO ways to "wake" Slate and cause a Tick/Paint pass:
1. Provide some sort of input (mouse movement, clicks, and key presses). Slate will always tick when the user is active.
- Therefore, if the logic in a given widget's Tick is only relevant in response to user action, there is no need to register an active tick.
2. Register an Active Tick. Currently this is an all-or-nothing situation, so if a single active tick needs to execute, all of Slate will be ticked.
- The purpose of an Active Tick is to allow a widget to "drive" Slate and guarantee a Tick/Paint pass in the absence of any user action.
- Examples include animation, async operations that update periodically, progress updates, loading bars, etc.
- An empty active tick is registered for viewports when they are real-time, so game project widgets are unaffected by this change and should continue to work as before.
- An Active Tick is registered by creating an FWidgetActiveTickDelegate and passing it to SWidget::RegisterActiveTick()
- There are THREE ways to unregister an active tick:
1. Return EActiveTickReturnType::StopTicking from the active tick function
2. Pass the FActiveTickHandle returned by RegisterActiveTick() to SWidget::UnregisterActiveTick()
3. Destroy the widget responsible for the active tick
- Sleeping is currently disabled, can be enabled with Slate.AllowSlateToSleep cvar
- There is currently a little buffer time during which Slate continues to tick following any input. Long-term, this is planned to be removed.
- The duration of the buffer can be adjusted using Slate.SleepBufferPostInput cvar (defaults to 1.0f)
- The FCurveSequence API has been updated to work with the active tick system
- Playing a curve sequence now requires that you pass the widget being animated by the sequence
- The active tick will automatically be registered on behalf of the widget and unregister when the sequence is complete
- GetLerpLooping() has been removed. Instead, pass true as the second param to Play() to indicate that the animation will loop. This causes the active tick to be registered indefinitely until paused or jumped to the start/end.
[CL 2391669 by Dan Hertzka in Main branch]
2014-12-17 16:07:57 -05:00
|
|
|
|
|
|
|
|
// Temp flag to trigger a highlight spring update in the passive tick (because that's where the geometry is)
|
|
|
|
|
bool bUpdateHighlightSpring;
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|