2018-07-10 16:40:57 +00:00
|
|
|
// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ImGuiInputHandler.h"
|
|
|
|
|
|
|
|
#include <Delegates/Delegate.h>
|
|
|
|
#include <UObject/Object.h>
|
|
|
|
|
2018-08-10 21:20:33 +00:00
|
|
|
// Select right soft class reference header to avoid warning.
|
|
|
|
#if ENGINE_COMPATIBILITY_LEGACY_STRING_CLASS_REF
|
2018-07-10 16:40:57 +00:00
|
|
|
#include <StringClassReference.h>
|
|
|
|
#else
|
|
|
|
#include <UObject/SoftObjectPath.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ImGuiSettings.generated.h"
|
|
|
|
|
|
|
|
|
2018-07-30 21:05:59 +00:00
|
|
|
/**
|
|
|
|
* Struct containing key information that can be used for key binding. Using 'Undetermined' value for modifier keys
|
|
|
|
* means that those keys should be ignored when testing for a match.
|
|
|
|
*/
|
|
|
|
USTRUCT()
|
|
|
|
struct FImGuiKeyInfo
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
FKey Key;
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
ECheckBoxState Shift = ECheckBoxState::Undetermined;
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
ECheckBoxState Ctrl = ECheckBoxState::Undetermined;
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
ECheckBoxState Alt = ECheckBoxState::Undetermined;
|
|
|
|
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
|
|
ECheckBoxState Cmd = ECheckBoxState::Undetermined;
|
|
|
|
};
|
|
|
|
|
2018-07-10 16:40:57 +00:00
|
|
|
// Settings for ImGui module.
|
|
|
|
UCLASS(config=ImGui, defaultconfig)
|
|
|
|
class UImGuiSettings : public UObject
|
|
|
|
{
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
UImGuiSettings();
|
|
|
|
~UImGuiSettings();
|
|
|
|
|
|
|
|
// Path to custom implementation of ImGui Input Handler.
|
|
|
|
const FStringClassReference& GetImGuiInputHandlerClass() const { return ImGuiInputHandlerClass; }
|
|
|
|
|
2018-07-30 21:05:59 +00:00
|
|
|
// Get mapping for 'ImGui.SwitchInputMode' command.
|
|
|
|
const FImGuiKeyInfo& GetSwitchInputModeKey() const { return SwitchInputModeKey; }
|
|
|
|
|
2018-10-28 21:15:02 +00:00
|
|
|
// Check whether ImGui should draw its own software cursor.
|
|
|
|
bool UseSoftwareCursor() const { return bUseSoftwareCursor; }
|
|
|
|
|
2018-07-10 16:40:57 +00:00
|
|
|
// Delegate raised when ImGuiInputHandlerClass property has changed.
|
|
|
|
FSimpleMulticastDelegate OnImGuiInputHandlerClassChanged;
|
|
|
|
|
2018-10-28 21:15:02 +00:00
|
|
|
// Delegate raised when SoftwareCursorEnabled property has changed.
|
|
|
|
FSimpleMulticastDelegate OnSoftwareCursorChanged;
|
|
|
|
|
2018-07-30 21:05:59 +00:00
|
|
|
virtual void PostInitProperties() override;
|
|
|
|
|
2018-07-10 16:40:57 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// Path to own implementation of ImGui Input Handler allowing to customize handling of keyboard and gamepad input.
|
|
|
|
// If not set then default handler is used.
|
2018-07-31 21:09:01 +00:00
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Extensions", meta = (MetaClass = "ImGuiInputHandler"))
|
2018-07-10 16:40:57 +00:00
|
|
|
FStringClassReference ImGuiInputHandlerClass;
|
|
|
|
|
2018-07-31 21:09:01 +00:00
|
|
|
// Define a custom key binding to 'ImGui.SwitchInputMode' command. Binding is only set if key is valid.
|
|
|
|
// Note that modifier key properties can be set to one of the three values: undetermined means that state of the given
|
|
|
|
// modifier is not tested, checked means that it needs to be pressed and unchecked means that it cannot be pressed.
|
|
|
|
//
|
|
|
|
// This binding is using Player Input's DebugExecBindings which only works in non-shipment builds.
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Keyboard Shortcuts")
|
2018-07-30 21:05:59 +00:00
|
|
|
FImGuiKeyInfo SwitchInputModeKey;
|
|
|
|
|
2018-10-28 21:15:02 +00:00
|
|
|
// If true, then in input mode ImGui will draw its own cursor in place of the hardware one.
|
|
|
|
// When disabled (default) there is a noticeable difference between cursor position seen by ImGui and position on
|
|
|
|
// the screen. Enabling this option removes that effect but with lower frame-rates UI becomes quickly unusable.
|
|
|
|
UPROPERTY(EditAnywhere, config, Category = "Input")
|
|
|
|
bool bUseSoftwareCursor = false;
|
|
|
|
|
2018-07-10 16:40:57 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
#if WITH_EDITOR
|
|
|
|
|
|
|
|
void RegisterPropertyChangedDelegate();
|
|
|
|
void UnregisterPropertyChangedDelegate();
|
|
|
|
|
|
|
|
void OnPropertyChanged(class UObject* ObjectBeingModified, struct FPropertyChangedEvent& PropertyChangedEvent);
|
|
|
|
|
|
|
|
#endif // WITH_EDITOR
|
|
|
|
};
|