You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Improved text layout support when inserting runs/text or splitting lines on runs that were non-text (images or widgets). The text layout now inserts an extra text run when splitting a non-text run, which avoids issues where text was either being inserted into a non-text run (and vanishing), or an image run was being cloned (and appearing twice). This also fixes the cursor movement in the multiline editable text when selecting over images or widgets (the cursor would jump to the start of the document as GetTextIndexAt hadn't been implemented. Additionally, it also fixes an issue where Measure was always trying to place the cursor at the end of an image run (ignoring the values of BeginIndex and EndIndex) which made the cursor offset draw in the wrong place. These changes required the text layout to be able to create a default text run, which involved refactoring the text marshallers as the Slate text run now knows about the default text style, taking that responsibility away from the marshallers Added tutorial-specific image decorator that accepts a content-relative or engine relative image path. Added button to tutorial rich text editor to add new images. All previously-imported images should still 'work'. reviewed by Jamie.Dale,Nick.Atamas,Justin.Sargent [CL 2302278 by Thomas Sarkanen in Main branch]
104 lines
2.8 KiB
C++
104 lines
2.8 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
class STutorialEditableText : public SCompoundWidget
|
|
{
|
|
public:
|
|
SLATE_BEGIN_ARGS( STutorialEditableText ){}
|
|
|
|
SLATE_ATTRIBUTE(FText, Text)
|
|
|
|
SLATE_ARGUMENT(FOnTextCommitted, OnTextCommitted)
|
|
|
|
SLATE_ARGUMENT(FOnTextChanged, OnTextChanged)
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
/**
|
|
* Construct the widget
|
|
*
|
|
* @param InArgs Declaration from which to construct the widget
|
|
*/
|
|
void Construct(const FArguments& InArgs);
|
|
|
|
virtual bool SupportsKeyboardFocus() const override { return true; }
|
|
|
|
protected:
|
|
|
|
TSharedPtr<const IRun> GetCurrentRun() const;
|
|
|
|
void HandleRichEditableTextChanged(const FText& Text);
|
|
|
|
void HandleRichEditableTextCommitted(const FText& Text, ETextCommit::Type Type);
|
|
|
|
void HandleRichEditableTextCursorMoved(const FTextLocation& NewCursorPosition );
|
|
|
|
FText GetActiveStyleName() const;
|
|
|
|
void OnActiveStyleChanged(TSharedPtr<struct FTextStyleAndName> NewValue, ESelectInfo::Type);
|
|
|
|
TSharedRef<SWidget> GenerateStyleComboEntry(TSharedPtr<struct FTextStyleAndName> SourceEntry);
|
|
|
|
void StyleSelectedText();
|
|
|
|
void HandleHyperlinkComboOpened();
|
|
|
|
bool IsHyperlinkComboEnabled() const;
|
|
|
|
FReply HandleInsertHyperLinkClicked();
|
|
|
|
EVisibility GetToolbarVisibility() const;
|
|
|
|
FText GetHyperlinkButtonText() const;
|
|
|
|
void OnActiveHyperlinkChanged(TSharedPtr<struct FHyperlinkTypeDesc> NewValue, ESelectInfo::Type SelectionType);
|
|
|
|
TSharedRef<SWidget> GenerateHyperlinkComboEntry(TSharedPtr<struct FHyperlinkTypeDesc> SourceEntry);
|
|
|
|
FText GetActiveHyperlinkName() const;
|
|
|
|
FText GetActiveHyperlinkTooltip() const;
|
|
|
|
TSharedPtr<FHyperlinkTypeDesc> GetHyperlinkTypeFromId(const FString& InId) const;
|
|
|
|
EVisibility GetOpenAssetVisibility() const;
|
|
|
|
void HandleOpenAssetCheckStateChanged(ESlateCheckBoxState::Type InCheckState);
|
|
|
|
ESlateCheckBoxState::Type IsOpenAssetChecked() const;
|
|
|
|
EVisibility GetExcerptVisibility() const;
|
|
|
|
FReply HandleImageButtonClicked();
|
|
|
|
protected:
|
|
TSharedPtr<SMultiLineEditableTextBox> RichEditableTextBox;
|
|
|
|
FSlateHyperlinkRun::FOnClick OnBrowserLinkClicked;
|
|
FSlateHyperlinkRun::FOnClick OnDocLinkClicked;
|
|
FSlateHyperlinkRun::FOnClick OnTutorialLinkClicked;
|
|
FSlateHyperlinkRun::FOnClick OnCodeLinkClicked;
|
|
FSlateHyperlinkRun::FOnClick OnAssetLinkClicked;
|
|
|
|
TSharedPtr<SComboButton> HyperlinkComboButton;
|
|
TSharedPtr<SComboBox<TSharedPtr<struct FTextStyleAndName>>> FontComboBox;
|
|
TSharedPtr<STextBlock> HyperlinkNameTextBlock;
|
|
TSharedPtr<SEditableTextBox> HyperlinkURLTextBox;
|
|
TSharedPtr<SEditableTextBox> UDNExcerptTextBox;
|
|
|
|
TSharedPtr<struct FTextStyleAndName> ActiveStyle;
|
|
TSharedPtr<struct FTextStyleAndName> HyperlinkStyle;
|
|
|
|
TArray<TSharedPtr<struct FTextStyleAndName>> StylesAndNames;
|
|
|
|
FOnTextCommitted OnTextCommitted;
|
|
FOnTextChanged OnTextChanged;
|
|
|
|
TSharedPtr<struct FHyperlinkTypeDesc> CurrentHyperlinkType;
|
|
|
|
bool bOpenAsset;
|
|
|
|
bool bNewHyperlink;
|
|
};
|