Blender  V3.3
GHOST_ImeWin32.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * The Original Code is Copyright 2010 The Chromium Authors. All rights reserved. */
3 
8 #pragma once
9 
10 #ifdef WITH_INPUT_IME
11 
12 # define WIN32_LEAN_AND_MEAN
13 # include <windows.h>
14 
15 # include <string>
16 
17 # include "GHOST_Event.h"
18 # include "GHOST_Rect.h"
19 # include <vector>
20 
21 /* MSDN LOCALE_SISO639LANGNAME states maximum length of 9, including terminating null. */
22 # define W32_ISO639_LEN 9
23 
24 class GHOST_EventIME : public GHOST_Event {
25  public:
32  GHOST_EventIME(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window, void *customdata)
33  : GHOST_Event(msec, type, window)
34  {
35  this->m_data = customdata;
36  }
37 };
38 
80 /* This struct represents the status of an ongoing composition. */
81 struct ImeComposition {
82  /* Represents the cursor position in the IME composition. */
83  int cursor_position;
84 
85  /* Represents the position of the beginning of the selection */
86  int target_start;
87 
88  /* Represents the position of the end of the selection */
89  int target_end;
90 
99  int string_type;
100 
101  /* Represents the string retrieved from IME (Input Method Editor) */
102  std::wstring ime_string;
103  std::vector<char> utf8_buf;
104  std::vector<unsigned char> format;
105 };
106 
123 class GHOST_ImeWin32 {
124  public:
125  GHOST_ImeWin32();
126  ~GHOST_ImeWin32();
127 
128  /* Retrieves whether or not there is an ongoing composition. */
129  bool is_composing() const
130  {
131  return is_composing_;
132  }
133 
134  /* Retrieve the input language from Windows and store it. */
135  void UpdateInputLanguage();
136 
137  BOOL IsLanguage(const char name[W32_ISO639_LEN]);
138 
139  /* Saves the current conversion status. */
140  void UpdateConversionStatus(HWND window_handle);
141 
142  /* Is the IME currently in conversion mode? */
143  bool IsEnglishMode();
144 
145  /* Checks a key whether IME has to do handling. */
146  bool IsImeKeyEvent(char ascii, GHOST_TKey key);
147 
154  void CreateImeWindow(HWND window_handle);
155 
176  void SetImeWindowStyle(
177  HWND window_handle, UINT message, WPARAM wparam, LPARAM lparam, BOOL *handled);
178 
185  void DestroyImeWindow(HWND window_handle);
186 
193  void UpdateImeWindow(HWND window_handle);
194 
202  void CleanupComposition(HWND window_handle);
203 
212  void ResetComposition(HWND window_handle);
213 
235  bool GetResult(HWND window_handle, LPARAM lparam, ImeComposition *composition);
236 
258  bool GetComposition(HWND window_handle, LPARAM lparam, ImeComposition *composition);
259 
282  void BeginIME(HWND window_handle, const GHOST_Rect &caret_rect, bool complete);
283 
293  void EndIME(HWND window_handle);
294 
296  void UpdateInfo(HWND window_handle);
297 
299  void CheckFirst(HWND window_handle);
300 
301  ImeComposition resultInfo, compInfo;
302  GHOST_TEventImeData eventImeData;
303 
304  protected:
305  /* Determines whether or not the given attribute represents a target (a.k.a. a selection). */
306  bool IsTargetAttribute(char attribute) const
307  {
308  return (attribute == ATTR_TARGET_CONVERTED || attribute == ATTR_TARGET_NOTCONVERTED);
309  }
310 
311  /* Retrieve the target area. */
312  void GetCaret(HIMC imm_context, LPARAM lparam, ImeComposition *composition);
313 
314  /* Update the position of the IME windows. */
315  void MoveImeWindow(HWND window_handle, HIMC imm_context);
316 
317  /* Complete the ongoing composition if it exists. */
318  void CompleteComposition(HWND window_handle, HIMC imm_context);
319 
320  /* Retrieve a string from the IMM. */
321  bool GetString(HIMC imm_context, WPARAM lparam, int type, ImeComposition *composition);
322 
323  private:
328  bool is_composing_;
329 
330  /* Abbreviated ISO 639-1 name of the input language, such as "en" for English. */
331  char language_[W32_ISO639_LEN];
332 
333  /* Current Conversion Mode Values. Retrieved with ImmGetConversionStatus. */
334  DWORD conversion_modes_;
335 
336  /* Current Sentence Mode. Retrieved with ImmGetConversionStatus. */
337  DWORD sentence_mode_;
338 
345  bool system_caret_;
346 
347  /* The rectangle of the input caret retrieved from a renderer process. */
348  GHOST_Rect caret_rect_;
349 
350  /* used for disable ime when start up */
351  bool is_first, is_enable;
352 };
353 
354 #endif // WITH_INPUT_IME
GHOST_TEventType
Definition: GHOST_Types.h:169
GHOST_TKey
Definition: GHOST_Types.h:259
typedef UINT(API *GHOST_WIN32_GetDpiForWindow)(HWND)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
btAlignedObjectArray< btScalar > m_data
format
Definition: logImageCore.h:38
unsigned __int64 uint64_t
Definition: stdint.h:90