diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-11-29 23:03:02 +0800 |
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-11-29 23:03:02 +0800 |
| commit | 7d20efa165289db22c7ff620f1c59f422a025820 (patch) | |
| tree | 13ac01b68878f83eade98937ffb462f9394d23c5 /include/cru/platform/gui/sdl/InputMethod.h | |
| parent | c9a461c52b37156f14944caa085bb794c184e5e3 (diff) | |
| download | cru-7d20efa165289db22c7ff620f1c59f422a025820.tar.gz cru-7d20efa165289db22c7ff620f1c59f422a025820.tar.bz2 cru-7d20efa165289db22c7ff620f1c59f422a025820.zip | |
Impl sdl input method context.
Diffstat (limited to 'include/cru/platform/gui/sdl/InputMethod.h')
| -rw-r--r-- | include/cru/platform/gui/sdl/InputMethod.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/cru/platform/gui/sdl/InputMethod.h b/include/cru/platform/gui/sdl/InputMethod.h new file mode 100644 index 00000000..77a78999 --- /dev/null +++ b/include/cru/platform/gui/sdl/InputMethod.h @@ -0,0 +1,42 @@ +#pragma once + +#include "Base.h" + +#include <cru/platform/gui/InputMethod.h> + +#include <SDL3/SDL_events.h> +#include <SDL3/SDL_video.h> + +namespace cru::platform::gui::sdl { +class SdlWindow; + +class SdlInputMethodContext : public SdlResource, + public virtual IInputMethodContext { + friend SdlWindow; + + public: + explicit SdlInputMethodContext(SdlWindow* window); + + bool ShouldManuallyDrawCompositionText() override; + void EnableIME() override; + void DisableIME() override; + + /** + * Note: SDL doesn't support this. So it actually calls CancelComposition(). + */ + void CompleteComposition() override; + void CancelComposition() override; + + CompositionText GetCompositionText() override; + + void SetCandidateWindowPosition(const Point& point) override; + + CRU_DEFINE_CRU_PLATFORM_GUI_I_INPUT_METHOD_OVERRIDE_EVENTS() + + private: + bool HandleEvent(const SDL_Event* event); + + private: + SdlWindow* window_; +}; +} // namespace cru::platform::gui::sdl |
