CEFInterfaceImeHandler.h
3.3 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// Engine/Source/Runtime/WebBrowser/Private/CEF/CEFImeHandler.h
#pragma once
#include "CoreMinimal.h"
#if WITH_CEF3 && !PLATFORM_LINUX
#include "Widgets/SWidget.h"
#if PLATFORM_WINDOWS
#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"
#include "include/cef_values.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 "Layout/Geometry.h"
class ITextInputMethodSystem;
class FCEFInterfaceTextInputMethodContext;
class ITextInputMethodChangeNotifier;
class SWidget;
class FCEFInterfaceImeHandler
: public TSharedFromThis<FCEFInterfaceImeHandler>
{
public:
FCEFInterfaceImeHandler(CefRefPtr<CefBrowser> Browser);
void UnbindCefBrowser();
void CacheBrowserSlateInfo(const TSharedRef<SWidget>& Widget);
void SetFocus(bool bHasFocus);
void UpdateCachedGeometry(const FGeometry& AllottedGeometry);
/**
* Called when the IME composition DOM node has changed.
*
* @param SelectionRange The range of characters that have been selected.
* @param CharacterBounds The bounds of each character in view coordinates.
*/
void CEFCompositionRangeChanged(const CefRange& SelectionRange, const CefRenderHandler::RectList& CharacterBounds);
/**
* Called when a message was received from the renderer process.
*
* @param Browser The CefBrowser for this window.
* @param SourceProcess The process id of the sender of the message. Currently always PID_RENDERER.
* @param Message The actual message.
* @return true if the message was handled, else false.
*/
bool OnProcessMessageReceived(CefRefPtr<CefBrowser> Browser, CefProcessId SourceProcess, CefRefPtr<CefProcessMessage> Message);
/**
* Sends a message to the renderer process.
* See https://bitbucket.org/chromiumembedded/cef/wiki/GeneralUsage#markdown-header-inter-process-communication-ipc for more information.
*
* @param Message the message to send to the renderer process
*/
void SendProcessMessage(CefRefPtr<CefProcessMessage> Message);
// FWebImeHandler Interface
void BindInputMethodSystem(ITextInputMethodSystem* InTextInputMethodSystem);
void UnbindInputMethodSystem();
private:
bool IsValid()
{
return InternalCefBrowser.get() != nullptr;
}
void InitContext();
void DeactivateContext();
void DestroyContext();
/** Message handling helpers */
bool HandleFocusChangedMessage(CefRefPtr<CefListValue> MessageArguments);
/** Pointer to the CEF Browser for this window. */
CefRefPtr<CefBrowser> InternalCefBrowser;
TWeakPtr<SWidget> InternalBrowserSlateWidget;
ITextInputMethodSystem* TextInputMethodSystem;
/** IME context for this browser window. This gets recreated whenever we change focus to an editable input field. */
TSharedPtr<FCEFInterfaceTextInputMethodContext> TextInputMethodContext;
/** Notification interface object for IMEs */
TSharedPtr<ITextInputMethodChangeNotifier> TextInputMethodChangeNotifier;
// Allow IME context to access functions only it needs.
friend class FCEFInterfaceTextInputMethodContext;
};
#endif