aboutsummaryrefslogtreecommitdiff
path: root/include/cru/win/native/input_method.hpp
blob: 3ea167091881fe9ae8db6bcf38cad45ea53f1465 (plain)
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
#pragma once
#include "resource.hpp"

#include "cru/platform/native/input_method.hpp"

#include <imm.h>

namespace cru::platform::native::win {
class WinNativeWindow;

class WinInputMethodContextRef : public WinNativeResource,
                                 public IInputMethodContextRef {
 public:
  WinInputMethodContextRef(WinNativeWindow* window);

  CRU_DELETE_COPY(WinInputMethodContextRef)
  CRU_DELETE_MOVE(WinInputMethodContextRef)

  ~WinInputMethodContextRef() override;

  ::HIMC GetHandle() const { return handle_; }

  void Reset() override;

  std::string GetCompositionString() override;

  void SetCandidateWindowPosition(const Point& point) override;

  IEvent<std::string>* CompositionTextChangeEvent() override;

  IEvent<std::string>* CharEvent() override;

 private:
  WinNativeWindow* window_;

  ::HWND window_handle_;
  ::HIMC handle_;

  Event<std::string> composition_text_change_event_;
  Event<std::string> char_event_;
};
}  // namespace cru::platform::native::win