123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- // 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
|