// CInput.h - part if Multi-Language input class // // Copyright (C) 2000-2005, Kwon-il Lee // // Kwon-il Lee // zupet@hitel.net #if !defined(_C_INPUT_H_) #define _C_INPUT_H_ #include #include #include #include /*----------------------------------------------------------------------------*/ int GetCharsetFromLang(LANGID); int GetCodePageFromLang( LANGID langid ); int ConvertString(UINT codePage, const wchar_t* wText, int wLen, char* text, int len); /*----------------------------------------------------------------------------*/ class CInput { public: CInput(); ~CInput(); void InitInput(); /* messages */ void OnInputLanguageChange(HWND hWnd, WPARAM wParam, LPARAM lParam); bool OnComposition(HWND hWnd, WPARAM wParam, LPARAM lParam); bool OnEndComposition(HWND hWnd, WPARAM wParam, LPARAM lParam); bool OnNotify(HWND hWnd, WPARAM wParam, LPARAM lParam); bool OnChar(HWND hWnd, WPARAM wParam, LPARAM lParam); void OnKeyDown(WPARAM wParam); /// 2012.02.16 - prodongi int GetInput(char* text, int len); int GetInput(wchar_t* text, int len); int GetComp(char* text, int len); int GetComp(wchar_t* text, int len); void ClearInput() { m_input.clear();} void ClearComp() { m_comp.clear();} int GetReading(char* text, int len); int GetReading(wchar_t* text, int len); int GetCandidate(DWORD index, char* text, int len); int GetCandidateCount(); int GetCandidateSelection(); int GetCandidatePageSize(); int GetCandidatePageStart(); void GetUnderLine(int* start, int* end); void SetOnlyNum(bool bOn) { m_bOnlyNum = bOn; }; bool IsOnlyNum() { return m_bOnlyNum; }; bool IsCandidate() { return !m_candidate.empty() || !m_comp.empty(); } /// 2012.02.16 - prodongi bool isEndComposing() const { return m_isEndComposing; } void SetCompositionWndPos( int nPosX, int nPosY ) { m_nCompositionPosX = nPosX; m_nCompositionPosY = nPosY; } /* property */ bool IsVerticalReading(){ return m_bVerticalReading; } bool IsVerticalCandidate(){ return m_bVerticalCandidate; } WORD GetCodePage() { return m_codePage; } LANGID GetLangId() { return m_langId; } int GetCharSet() { return GetCharsetFromLang(m_langId); } wchar_t* GetIndicator() { return m_wszCurrIndicator; } int GetImeState() { return m_ImeState; } protected: void SetupImeApi(HWND hWnd); void GetImeId(); bool GetReadingWindowOrientation(); void GetPrivateReadingString(HWND hWnd); void CheckToggleState(HWND hWnd); protected: std::wstring m_input; std::wstring m_comp; std::wstring m_reading; std::vector m_candidate; int m_ulStart; int m_ulEnd; int m_nCompositionPosX; int m_nCompositionPosY; RECT m_rectIME; HKL m_hkl; LANGID m_langId; WORD m_codePage; bool m_bUnicodeIME; bool m_bVerticalReading; bool m_bVerticalCandidate; int m_ImeState; wchar_t* m_wszCurrIndicator; DWORD m_dwId[2]; HINSTANCE m_hDllIme; UINT (WINAPI * _GetReadingString)( HIMC, UINT, LPWSTR, PINT, BOOL*, PUINT ); BOOL (WINAPI * _ShowReadingWindow)( HIMC, BOOL ); bool m_bOnlyNum; bool m_bSpaceLimit; // 2011. 11. 1 - marine /// 2012.02.15 현재 조합이 끝났는지 아닌지, 일반 엔터와 조합이 시작될 때는 false로 설정된다. - prodongi bool m_isEndComposing; public: void SetSpaceLimit(bool bFlag) { m_bSpaceLimit = bFlag; } bool IsSpaceLimit() { return m_bSpaceLimit; }; }; /*----------------------------------------------------------------------------*/ #endif //_C_INPUT_H_