A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DialogueMultiLineEditableTextBox_CustomRowHelper.h
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "DetailWidgetRow.h"
5
6#include "Widgets/Input/SMultiLineEditableTextBox.h"
9
10class FDetailWidgetRow;
11
13{
15public:
17
18 void SetDefaults();
19
20public:
24 bool bAutoWrapText = true;
25
26 float WrapTextAt = 0.f;
27 EModifierKey::Type ModiferKeyForNewLine = EModifierKey::None;
28
29 // Can not be set here
30 TAttribute<FSlateFontInfo> Font;
31 TAttribute<FSlateColor> ForegroundColor;
32 TAttribute<FSlateColor> ReadOnlyForegroundColor;
33 FEditableTextBoxStyle Style;
34};
35
41 public TSharedFromThis<FDialogueMultiLineEditableTextBox_CustomRowHelper>
42{
45
46public:
47 FDialogueMultiLineEditableTextBox_CustomRowHelper(FDetailWidgetRow* InDetailWidgetRow, const TSharedPtr<IPropertyHandle>& InPropertyHandle)
48 : FDialogueBase_CustomRowHelper(InDetailWidgetRow, InPropertyHandle)
49 {
51 }
52
53#define CREATE_OPTIONS_SETTER(_NameMethod, _VariableType, _OptionVariableName) \
54 Self& _NameMethod(_VariableType InVariableValue) \
55 { \
56 Options._OptionVariableName = InVariableValue; \
57 return *this; \
58 }
59
60 CREATE_OPTIONS_SETTER(Style, const FEditableTextBoxStyle&, Style)
61 CREATE_OPTIONS_SETTER(Font, const TAttribute<FSlateFontInfo>&, Font)
62 CREATE_OPTIONS_SETTER(ForegroundColor, const TAttribute<FSlateColor>&, ForegroundColor)
64 CREATE_OPTIONS_SETTER(SelectAllTextWhenFocused, bool, bSelectAllTextWhenFocused)
65 CREATE_OPTIONS_SETTER(ClearKeyboardFocusOnCommit, bool, bClearKeyboardFocusOnCommit)
66 CREATE_OPTIONS_SETTER(SelectAllTextOnCommit, bool, bSelectAllTextOnCommit)
67 CREATE_OPTIONS_SETTER(AutoWrapText, bool, bAutoWrapText)
70
71#undef CREATE_OPTIONS_SETTER
72
74 FText GetTextValue() const;
75
76 // NOTE: only call these after Update()
77 FDialogueTextCommitedDelegate& OnTextCommittedEvent();
78 FDialogueTextChangedDelegate& OnTextChangedEvent();
79
80
81protected:
82 void UpdateInternal() override;
83
84private:
85 // Events
86 FDialogueTextCommitedDelegate TextCommittedEvent;
87
88 // The text box Widget.
89 TSharedPtr<SDialogueTextPropertyEditableTextBox> TextBoxWidget;
90
91 // Options for the widget
93
94 // Editable text property
95 TSharedPtr<IEditableTextProperty> EditableTextProperty;
96};
#define CREATE_OPTIONS_SETTER(_NameMethod, _VariableType, _OptionVariableName)
Self & ForegroundColor(const TAttribute< FSlateColor > &InVariableValue)
Self & Font(const TAttribute< FSlateFontInfo > &InVariableValue)
Self & ReadOnlyForegroundColor(const TAttribute< FSlateColor > &InVariableValue)
FDialogueMultiLineEditableTextBox_CustomRowHelper(FDetailWidgetRow *InDetailWidgetRow, const TSharedPtr< IPropertyHandle > &InPropertyHandle)