1 //--------------------------------------------------------------------------------------
\r
2 // File: DXUTguiIME.h
\r
4 // Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 //--------------------------------------------------------------------------------------
\r
15 //--------------------------------------------------------------------------------------
\r
16 // Forward declarations
\r
17 //--------------------------------------------------------------------------------------
\r
18 class CDXUTIMEEditBox;
\r
21 //-----------------------------------------------------------------------------
\r
22 // IME-enabled EditBox control
\r
23 //-----------------------------------------------------------------------------
\r
24 #define MAX_COMPSTRING_SIZE 256
\r
27 class CDXUTIMEEditBox : public CDXUTEditBox
\r
31 static HRESULT CreateIMEEditBox( CDXUTDialog* pDialog, int ID, LPCWSTR strText, int x, int y, int width,
\r
32 int height, bool bIsDefault=false, CDXUTIMEEditBox** ppCreated=NULL );
\r
34 CDXUTIMEEditBox( CDXUTDialog* pDialog = NULL );
\r
35 virtual ~CDXUTIMEEditBox();
\r
37 static void InitDefaultElements( CDXUTDialog* pDialog );
\r
39 static void WINAPI Initialize( HWND hWnd );
\r
40 static void WINAPI Uninitialize();
\r
42 static HRESULT WINAPI StaticOnCreateDevice();
\r
43 static bool WINAPI StaticMsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
\r
45 static void WINAPI SetImeEnableFlag( bool bFlag );
\r
47 virtual void Render( float fElapsedTime );
\r
48 virtual bool MsgProc( UINT uMsg, WPARAM wParam, LPARAM lParam );
\r
49 virtual bool HandleMouse( UINT uMsg, POINT pt, WPARAM wParam, LPARAM lParam );
\r
50 virtual void UpdateRects();
\r
51 virtual void OnFocusIn();
\r
52 virtual void OnFocusOut();
\r
56 virtual void RenderCandidateReadingWindow( float fElapsedTime, bool bReading );
\r
57 virtual void RenderComposition( float fElapsedTime );
\r
58 virtual void RenderIndicator( float fElapsedTime );
\r
61 static void WINAPI EnableImeSystem( bool bEnable );
\r
63 static WORD WINAPI GetLanguage()
\r
65 return ImeUi_GetLanguage();
\r
67 static WORD WINAPI GetPrimaryLanguage()
\r
69 return ImeUi_GetPrimaryLanguage();
\r
71 static void WINAPI SendKey( BYTE nVirtKey );
\r
72 static DWORD WINAPI GetImeId( UINT uIndex = 0 )
\r
74 return ImeUi_GetImeId( uIndex );
\r
76 static void WINAPI CheckInputLocale();
\r
77 static void WINAPI CheckToggleState();
\r
78 static void WINAPI SetupImeApi();
\r
79 static void WINAPI ResetCompositionString();
\r
82 static void SetupImeUiCallback();
\r
96 CUniBuffer HoriCand; // Candidate list string (for horizontal candidate window)
\r
97 int nFirstSelected; // First character position of the selected string in HoriCand
\r
98 int nHoriSelectedLen; // Length of the selected string in HoriCand
\r
99 RECT rcCandidate; // Candidate rectangle computed and filled each time before rendered
\r
102 static POINT s_ptCompString; // Composition string position. Updated every frame.
\r
103 static int s_nFirstTargetConv; // Index of the first target converted char in comp string. If none, -1.
\r
104 static CUniBuffer s_CompString; // Buffer to hold the composition string (we fix its length)
\r
105 static DWORD s_adwCompStringClause[MAX_COMPSTRING_SIZE];
\r
106 static CCandList s_CandList; // Data relevant to the candidate list
\r
107 static WCHAR s_wszReadingString[32];// Used only with horizontal reading window (why?)
\r
108 static bool s_bImeFlag; // Is ime enabled
\r
110 // Color of various IME elements
\r
111 D3DCOLOR m_ReadingColor; // Reading string color
\r
112 D3DCOLOR m_ReadingWinColor; // Reading window color
\r
113 D3DCOLOR m_ReadingSelColor; // Selected character in reading string
\r
114 D3DCOLOR m_ReadingSelBkColor; // Background color for selected char in reading str
\r
115 D3DCOLOR m_CandidateColor; // Candidate string color
\r
116 D3DCOLOR m_CandidateWinColor; // Candidate window color
\r
117 D3DCOLOR m_CandidateSelColor; // Selected candidate string color
\r
118 D3DCOLOR m_CandidateSelBkColor; // Selected candidate background color
\r
119 D3DCOLOR m_CompColor; // Composition string color
\r
120 D3DCOLOR m_CompWinColor; // Composition string window color
\r
121 D3DCOLOR m_CompCaretColor; // Composition string caret color
\r
122 D3DCOLOR m_CompTargetColor; // Composition string target converted color
\r
123 D3DCOLOR m_CompTargetBkColor; // Composition string target converted background
\r
124 D3DCOLOR m_CompTargetNonColor; // Composition string target non-converted color
\r
125 D3DCOLOR m_CompTargetNonBkColor;// Composition string target non-converted background
\r
126 D3DCOLOR m_IndicatorImeColor; // Indicator text color for IME
\r
127 D3DCOLOR m_IndicatorEngColor; // Indicator text color for English
\r
128 D3DCOLOR m_IndicatorBkColor; // Indicator text background color
\r
130 // Edit-control-specific data
\r
131 int m_nIndicatorWidth; // Width of the indicator symbol
\r
132 RECT m_rcIndicator; // Rectangle for drawing the indicator button
\r
134 #if defined(DEBUG) || defined(_DEBUG)
\r
135 static bool m_bIMEStaticMsgProcCalled;
\r
141 #endif // DXUT_IME_H
\r