CEFInterfaceTextInputMethodContext.h
3.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Engine/Source/Runtime/WebBrowser/Private/CEF/CEFTextInputMethodContext.h
#pragma once
#include "CoreMinimal.h"
#if WITH_CEF3 && !PLATFORM_LINUX
#include "Layout/Geometry.h"
#include "Widgets/SWindow.h"
#if PLATFORM_WINDOWS
#include "Windows/WindowsHWrapper.h"
#include "Windows/AllowWindowsPlatformTypes.h"
#include "Windows/AllowWindowsPlatformAtomics.h"
#endif
#pragma push_macro("OVERRIDE")
#undef OVERRIDE // cef headers provide their own OVERRIDE macro
THIRD_PARTY_INCLUDES_START
#if PLATFORM_APPLE
PRAGMA_DISABLE_DEPRECATION_WARNINGS
#endif
#include "include/cef_client.h"
#if PLATFORM_APPLE
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#endif
THIRD_PARTY_INCLUDES_END
#pragma pop_macro("OVERRIDE")
#if PLATFORM_WINDOWS
#include "Windows/HideWindowsPlatformAtomics.h"
#include "Windows/HideWindowsPlatformTypes.h"
#endif
#include "GenericPlatform/ITextInputMethodSystem.h"
#include "Layout/Geometry.h"
class FCEFWebInterfaceBrowserWindow;
class FCEFInterfaceImeHandler;
class SWindow;
class FCEFInterfaceTextInputMethodContext : public ITextInputMethodContext
{
public:
virtual ~FCEFInterfaceTextInputMethodContext() {}
static TSharedRef<FCEFInterfaceTextInputMethodContext> Create(const TSharedRef<FCEFInterfaceImeHandler>& InOwner);
void AbortComposition();
bool UpdateCachedGeometry(const FGeometry& AllottedGeometry);
bool CEFCompositionRangeChanged(const CefRange& SelectionRange, const CefRenderHandler::RectList& CharacterBounds);
private:
void ResetComposition();
public:
// ITextInputMethodContext Interface
virtual bool IsComposing() override;
private:
virtual bool IsReadOnly() override;
virtual uint32 GetTextLength() override;
virtual void GetSelectionRange(uint32& BeginIndex, uint32& Length, ECaretPosition& CaretPosition) override;
virtual void SetSelectionRange(const uint32 BeginIndex, const uint32 Length, const ECaretPosition CaretPosition) override;
virtual void GetTextInRange(const uint32 BeginIndex, const uint32 Length, FString& OutString) override;
virtual void SetTextInRange(const uint32 BeginIndex, const uint32 Length, const FString& InString) override;
virtual int32 GetCharacterIndexFromPoint(const FVector2D& Point) override;
virtual bool GetTextBounds(const uint32 BeginIndex, const uint32 Length, FVector2D& Position, FVector2D& Size) override;
virtual void GetScreenBounds(FVector2D& Position, FVector2D& Size) override;
virtual TSharedPtr<FGenericWindow> GetWindow() override;
virtual void BeginComposition() override;
virtual void UpdateCompositionRange(const int32 InBeginIndex, const uint32 InLength) override;
virtual void EndComposition() override;
private:
FCEFInterfaceTextInputMethodContext(const TSharedRef<FCEFInterfaceImeHandler>& InOwner);
TSharedRef<FCEFInterfaceImeHandler> Owner;
TWeakPtr<SWindow> CachedSlateWindow;
FGeometry CachedGeometry;
bool bIsComposing;
int32 CompositionBeginIndex;
uint32 CompositionLength;
uint32 SelectionRangeBeginIndex;
uint32 SelectionRangeLength;
ECaretPosition SelectionCaretPosition;
std::vector<CefRect> CefCompositionBounds;
FString CompositionString;
};
#endif