MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
SErrorDisplay.h
Go to the documentation of this file.
1/** @noop License Comment
2 * @file
3 * @copyright
4 * This Source Code is subject to the terms of the Mozilla Public License, v2.0.
5 * If a copy of the MPL was not distributed with this file You can obtain one at
6 * https://mozilla.org/MPL/2.0/
7 *
8 * @author David Mórász
9 * @date 2025
10 */
11
12#pragma once
13
14#include "CoreMinimal.h"
15#include "Widgets/SCompoundWidget.h"
16#include "Mcro/Error.h"
17#include "Mcro/Slate.h"
18
19namespace Mcro::Error
20{
21 /**
22 * Base class for displaying Mcro::Error::IError objects to the user
23 */
24 class MCRO_API SErrorDisplay : public SCompoundWidget
25 {
26 public:
27
31 SLATE_NAMED_SLOT(FArguments, PostSeverity);
32 SLATE_NAMED_SLOT(FArguments, PostMessage);
33 SLATE_NAMED_SLOT(FArguments, PostDetails);
34 SLATE_NAMED_SLOT(FArguments, PostCodeContext);
35 SLATE_NAMED_SLOT(FArguments, PostErrorPropagation);
36 SLATE_NAMED_SLOT(FArguments, PostInnerErrors);
37 SLATE_END_ARGS()
38
39 /** Constructs this widget with InArgs */
40 void Construct(const FArguments& inArgs);
41
42 static auto Text(const FString& text) -> Slate::TAttributeBlock<SEditableTextBox>;
43 static auto Text(const FStringView& text) -> Slate::TAttributeBlock<SEditableTextBox>;
44 static auto OptionalText(const FString& text) -> Slate::TAttributeBlock<SEditableTextBox>;
45 static auto OptionalTextWidget(const FString& text) -> TSharedRef<SEditableTextBox>;
46
47 static auto ExpandableText(const FText& title, const FString& text) -> Slate::TAttributeBlock<SExpandableArea>;
48 static auto ExpandableText(
49 const FText& title,
50 const FString& text,
51 const Slate::TAttributeBlock<SEditableTextBox>& textAttributes
52 ) -> Slate::TAttributeBlock<SExpandableArea>;
53 static auto ExpandableTextWidget(const FText& title, const FString& text) -> TSharedRef<SExpandableArea>;
54
55 static auto Severity(const IErrorRef& error) -> Slate::TAttributeBlock<STextBlock>;
56 static auto SeverityWidget(const IErrorRef& error) -> TSharedRef<STextBlock>;
57
58 static auto Row() -> SVerticalBox::FSlot::FSlotArguments;
59 };
60}
SLATE_ARGUMENT(IErrorRef, Error)
SLATE_NAMED_SLOT(FArguments, PostErrorPropagation)
SLATE_NAMED_SLOT(FArguments, PostMessage)
SLATE_NAMED_SLOT(FArguments, PostDetails)
SLATE_BEGIN_ARGS(SErrorDisplay)
SLATE_NAMED_SLOT(FArguments, PostSeverity)
SLATE_NAMED_SLOT(FArguments, PostInnerErrors)
SLATE_NAMED_SLOT(FArguments, PostCodeContext)
TSharedRef< IError > IErrorRef
Definition Error.Fwd.h:25