Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_ImeWin32.h
| Show All 38 Lines | |||||
| class GHOST_EventIME : public GHOST_Event { | class GHOST_EventIME : public GHOST_Event { | ||||
| public: | public: | ||||
| /** | /** | ||||
| * Constructor. | * Constructor. | ||||
| * \param msec: The time this event was generated. | * \param msec: The time this event was generated. | ||||
| * \param type: The type of key event. | * \param type: The type of key event. | ||||
| * \param key: The key code of the key. | * \param key: The key code of the key. | ||||
| */ | */ | ||||
| GHOST_EventIME(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window, void *customdata) | GHOST_EventIME(GHOST_TUns64 msec, | ||||
| GHOST_TEventType type, | |||||
| GHOST_IWindow *window, | |||||
| GHOST_TEventImeData *ime_data) | |||||
| : GHOST_Event(msec, type, window) | : GHOST_Event(msec, type, window) | ||||
| { | { | ||||
| this->m_data = customdata; | if (ime_data) { | ||||
| size_t len = (size_t)ime_data->result_len; | |||||
| char *result = new char[len + 1]; | |||||
| memcpy(result, (char *)ime_data->result, len); | |||||
| result[len] = '\0'; | |||||
| m_ime_data = *ime_data; | |||||
| m_ime_data.result = result; | |||||
| m_data = &m_ime_data; | |||||
| } | } | ||||
| else { | |||||
| m_ime_data.result = NULL; | |||||
| } | |||||
| } | |||||
| ~GHOST_EventIME() | |||||
| { | |||||
| if (m_ime_data.result) { | |||||
| delete[] m_ime_data.result; | |||||
| } | |||||
| } | |||||
| protected: | |||||
| /** The IME event data. */ | |||||
| GHOST_TEventImeData m_ime_data; | |||||
| }; | }; | ||||
| /** | /** | ||||
| * This header file defines a struct and a class used for encapsulating IMM32 | * This header file defines a struct and a class used for encapsulating IMM32 | ||||
| * APIs, controls IMEs attached to a window, and enables the 'on-the-spot' | * APIs, controls IMEs attached to a window, and enables the 'on-the-spot' | ||||
| * input without deep knowledge about the APIs, i.e. knowledge about the | * input without deep knowledge about the APIs, i.e. knowledge about the | ||||
| * language-specific and IME-specific behaviors. | * language-specific and IME-specific behaviors. | ||||
| * The following items enumerates the simplest steps for an (window) | * The following items enumerates the simplest steps for an (window) | ||||
| ▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | public: | ||||
| ~GHOST_ImeWin32(); | ~GHOST_ImeWin32(); | ||||
| /* Retrieves whether or not there is an ongoing composition. */ | /* Retrieves whether or not there is an ongoing composition. */ | ||||
| bool is_composing() const | bool is_composing() const | ||||
| { | { | ||||
| return is_composing_; | return is_composing_; | ||||
| } | } | ||||
| /** | bool is_enabled() const | ||||
| * Retrieves the input language from Windows and update it. | { | ||||
| * Return values | return is_enable; | ||||
| * * true | } | ||||
| * The given input language has IMEs. | |||||
| * * false | /** Retrieves the input language from Windows and update it. */ | ||||
| * The given input language does not have IMEs. | void SetInputLanguage(); | ||||
| */ | |||||
| bool SetInputLanguage(); | |||||
| /** | /** | ||||
| * Create the IME windows, and allocate required resources for them. | * Create the IME windows, and allocate required resources for them. | ||||
| * Parameters | * Parameters | ||||
| * * window_handle [in] (HWND) | * * window_handle [in] (HWND) | ||||
| * Represents the window handle of the caller. | * Represents the window handle of the caller. | ||||
| */ | */ | ||||
| void CreateImeWindow(HWND window_handle); | void CreateImeWindow(HWND window_handle); | ||||
| ▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | public: | ||||
| * position. | * position. | ||||
| * + false | * + false | ||||
| * Just move the IME windows of the ongoing composition to the given | * Just move the IME windows of the ongoing composition to the given | ||||
| * position without finishing it. | * position without finishing it. | ||||
| */ | */ | ||||
| void BeginIME(HWND window_handle, const GHOST_Rect &caret_rect, bool complete); | void BeginIME(HWND window_handle, const GHOST_Rect &caret_rect, bool complete); | ||||
| /** | /** | ||||
| * Cancels an ongoing composition of the IME attached to the given window. | |||||
| * Parameters | |||||
| * * window_handle [in] (HWND) | |||||
| * Represents the window handle of the caller. | |||||
| */ | |||||
| void CancelIME(HWND window_handle); | |||||
| /** | |||||
| * Disable the IME attached to the given window, i.e. prohibits any user-input | * Disable the IME attached to the given window, i.e. prohibits any user-input | ||||
| * events from being dispatched to the IME. | * events from being dispatched to the IME. | ||||
| * In Chrome, this function is used when: | * In Chrome, this function is used when: | ||||
| * * a renderer process sets its input focus to a password input. | * * a renderer process sets its input focus to a password input. | ||||
| * Parameters | * Parameters | ||||
| * * window_handle [in] (HWND) | * * window_handle [in] (HWND) | ||||
| * Represents the window handle of the caller. | * Represents the window handle of the caller. | ||||
| */ | */ | ||||
| void EndIME(HWND window_handle); | void EndIME(HWND window_handle); | ||||
| /** Update #resultInfo and #compInfo */ | /** Update #resultInfo and #compInfo */ | ||||
| void UpdateInfo(HWND window_handle); | GHOST_TEventImeData *UpdateInfo(HWND window_handle, LPARAM lparam); | ||||
| /** Disable IME when start up. */ | /** Disable IME when start up. */ | ||||
| void CheckFirst(HWND window_handle); | void CheckFirst(HWND window_handle); | ||||
| ImeComposition resultInfo, compInfo; | ImeComposition resultInfo, compInfo; | ||||
| GHOST_TEventImeData eventImeData; | GHOST_TEventImeData eventImeData; | ||||
| protected: | protected: | ||||
| Show All 18 Lines | |||||
| private: | private: | ||||
| /** | /** | ||||
| * Represents whether or not there is an ongoing composition in a browser | * Represents whether or not there is an ongoing composition in a browser | ||||
| * process, i.e. whether or not a browser process is composing a text. | * process, i.e. whether or not a browser process is composing a text. | ||||
| */ | */ | ||||
| bool is_composing_; | bool is_composing_; | ||||
| /** | /** | ||||
| * This value represents whether or not the current input context has IMEs. | |||||
| * The following table shows the list of IME status: | |||||
| * Value Description | |||||
| * false The current input language does not have IMEs. | |||||
| * true The current input language has IMEs. | |||||
| */ | |||||
| bool ime_status_; | |||||
| /** | |||||
| * The current input Language ID retrieved from Windows, which consists of: | * The current input Language ID retrieved from Windows, which consists of: | ||||
| * * Primary Language ID (bit 0 to bit 9), which shows a natural language | * * Primary Language ID (bit 0 to bit 9), which shows a natural language | ||||
| * (English, Korean, Chinese, Japanese, etc.) and; | * (English, Korean, Chinese, Japanese, etc.) and; | ||||
| * * Sub-Language ID (bit 10 to bit 15), which shows a geometrical region | * * Sub-Language ID (bit 10 to bit 15), which shows a geometrical region | ||||
| * the language is spoken (For English, United States, United Kingdom, | * the language is spoken (For English, United States, United Kingdom, | ||||
| * Australia, Canada, etc.) | * Australia, Canada, etc.) | ||||
| * The following list enumerates some examples for the Language ID: | * The following list enumerates some examples for the Language ID: | ||||
| * * "en-US" (0x0409) | * * "en-US" (0x0409) | ||||
| Show All 31 Lines | |||||