Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Demos / DX11ClothDemo / DXUT / Optional / DXUTguiIME.h
1 //--------------------------------------------------------------------------------------\r
2 // File: DXUTguiIME.h\r
3 //\r
4 // Copyright (c) Microsoft Corporation. All rights reserved.\r
5 //--------------------------------------------------------------------------------------\r
6 #pragma once\r
7 #ifndef DXUT_IME_H\r
8 #define DXUT_IME_H\r
9 \r
10 #include <usp10.h>\r
11 #include <dimm.h>\r
12 #include <ImeUi.h>\r
13 \r
14 \r
15 //--------------------------------------------------------------------------------------\r
16 // Forward declarations\r
17 //--------------------------------------------------------------------------------------\r
18 class CDXUTIMEEditBox;\r
19 \r
20 \r
21 //-----------------------------------------------------------------------------\r
22 // IME-enabled EditBox control\r
23 //-----------------------------------------------------------------------------\r
24 #define MAX_COMPSTRING_SIZE 256\r
25 \r
26 \r
27 class CDXUTIMEEditBox : public CDXUTEditBox\r
28 {\r
29 public:\r
30 \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
33 \r
34                             CDXUTIMEEditBox( CDXUTDialog* pDialog = NULL );\r
35     virtual                 ~CDXUTIMEEditBox();\r
36 \r
37     static void             InitDefaultElements( CDXUTDialog* pDialog );\r
38 \r
39     static void WINAPI      Initialize( HWND hWnd );\r
40     static void WINAPI      Uninitialize();\r
41 \r
42     static  HRESULT WINAPI  StaticOnCreateDevice();\r
43     static  bool WINAPI     StaticMsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );\r
44 \r
45     static  void WINAPI     SetImeEnableFlag( bool bFlag );\r
46 \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
53 \r
54     void                    PumpMessage();\r
55 \r
56     virtual void            RenderCandidateReadingWindow( float fElapsedTime, bool bReading );\r
57     virtual void            RenderComposition( float fElapsedTime );\r
58     virtual void            RenderIndicator( float fElapsedTime );\r
59 \r
60 protected:\r
61     static void WINAPI      EnableImeSystem( bool bEnable );\r
62 \r
63     static WORD WINAPI      GetLanguage()\r
64     {\r
65         return ImeUi_GetLanguage();\r
66     }\r
67     static WORD WINAPI      GetPrimaryLanguage()\r
68     {\r
69         return ImeUi_GetPrimaryLanguage();\r
70     }\r
71     static void WINAPI      SendKey( BYTE nVirtKey );\r
72     static DWORD WINAPI     GetImeId( UINT uIndex = 0 )\r
73     {\r
74         return ImeUi_GetImeId( uIndex );\r
75     };\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
80 \r
81 \r
82     static void             SetupImeUiCallback();\r
83 \r
84 protected:\r
85     enum\r
86     {\r
87         INDICATOR_NON_IME,\r
88         INDICATOR_CHS,\r
89         INDICATOR_CHT,\r
90         INDICATOR_KOREAN,\r
91         INDICATOR_JAPANESE\r
92     };\r
93 \r
94     struct CCandList\r
95     {\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
100     };\r
101 \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
109         \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
129 \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
133 \r
134 #if defined(DEBUG) || defined(_DEBUG)\r
135     static bool    m_bIMEStaticMsgProcCalled;\r
136 #endif\r
137 };\r
138 \r
139 \r
140 \r
141 #endif // DXUT_IME_H\r