Implemented the TB_REPLACEBITMAP message.
[wine] / dlls / imm32 / imm_private.h
1 /*
2  *      private header for implementing IMM.
3  *
4  *      Copyright 2000 Hidenori Takeshima
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 typedef struct IMM32_tagTHREADDATA      IMM32_THREADDATA;
22
23 struct IMM32_tagTHREADDATA
24 {
25         HWND            hwndIME;
26         HIMC            hIMC;
27 };
28
29 typedef struct IMM32_tagMOVEABLEMEM     IMM32_MOVEABLEMEM;
30
31 /* IME APIs */
32
33 typedef BOOL (WINAPI *IMM32_pImeInquireA)(LPIMEINFO, LPSTR, LPCSTR);
34 typedef BOOL (WINAPI *IMM32_pImeInquireW)(LPIMEINFO, LPWSTR, LPCWSTR);
35
36 typedef  BOOL (WINAPI *IMM32_pImeConfigureA)(HKL, HWND, DWORD, LPVOID);
37 typedef  BOOL (WINAPI *IMM32_pImeConfigureW)(HKL, HWND, DWORD, LPVOID);
38 typedef  DWORD (WINAPI *IMM32_pImeConversionListA)
39         (HIMC, LPCSTR, LPCANDIDATELIST, DWORD, UINT);
40 typedef  DWORD (WINAPI *IMM32_pImeConversionListW)
41         (HIMC, LPCWSTR, LPCANDIDATELIST, DWORD, UINT);
42 typedef  BOOL (WINAPI *IMM32_pImeDestroy)(UINT);
43 typedef  UINT (WINAPI *IMM32_pImeEnumRegisterWordA)
44         (REGISTERWORDENUMPROCA, LPCSTR, DWORD, LPCSTR, LPVOID);
45 typedef  UINT (WINAPI *IMM32_pImeEnumRegisterWordW)
46         (REGISTERWORDENUMPROCW, LPCWSTR, DWORD, LPCWSTR, LPVOID);
47 typedef UINT (WINAPI *IMM32_pImeGetRegisterWordStyleA)(UINT, LPSTYLEBUFA);
48 typedef UINT (WINAPI *IMM32_pImeGetRegisterWordStyleW)(UINT, LPSTYLEBUFW);
49 typedef LRESULT (WINAPI *IMM32_pImeEscapeA)(HIMC, UINT, LPVOID);
50 typedef LRESULT (WINAPI *IMM32_pImeEscapeW)(HIMC, UINT, LPVOID);
51 typedef BOOL (WINAPI *IMM32_pImeProcessKey)(HIMC, UINT, LPARAM, CONST LPBYTE);
52 typedef BOOL (WINAPI *IMM32_pImeRegisterWordA)(LPCSTR, DWORD, LPCSTR);
53 typedef BOOL (WINAPI *IMM32_pImeRegisterWordW)(LPCWSTR, DWORD, LPCWSTR);
54 typedef BOOL (WINAPI *IMM32_pImeSelect)(HIMC, BOOL);
55 typedef BOOL (WINAPI *IMM32_pImeSetActiveContext)(HIMC, BOOL);
56 typedef BOOL (WINAPI *IMM32_pImeSetCompositionStringA)
57         (HIMC, DWORD, LPCVOID, DWORD, LPCVOID, DWORD);
58 typedef BOOL (WINAPI *IMM32_pImeSetCompositionStringW)
59         (HIMC, DWORD, LPCVOID, DWORD, LPCVOID, DWORD);
60 typedef UINT (WINAPI *IMM32_pImeToAsciiEx)
61         (UINT, UINT, CONST LPBYTE, LPDWORD, UINT, HIMC);
62 typedef BOOL (WINAPI *IMM32_pImeUnregisterWordA)(LPCSTR, DWORD, LPCSTR);
63 typedef BOOL (WINAPI *IMM32_pImeUnregisterWordW)(LPCWSTR, DWORD, LPCWSTR);
64 typedef BOOL (WINAPI *IMM32_pNotifyIME)(HIMC, DWORD, DWORD, DWORD);
65
66 /* for Win98 and later */
67 typedef DWORD (WINAPI *IMM32_pImeGetImeMenuItemsA)
68         (HIMC, DWORD, DWORD, LPIMEMENUITEMINFOA, LPIMEMENUITEMINFOA, DWORD);
69 typedef DWORD (WINAPI *IMM32_pImeGetImeMenuItemsW)
70         (HIMC, DWORD, DWORD, LPIMEMENUITEMINFOW, LPIMEMENUITEMINFOW, DWORD);
71
72 struct IMM32_IME_EXPORTED_HANDLERS
73 {
74         union
75         {
76                 IMM32_pImeInquireA              A;
77                 IMM32_pImeInquireW              W;
78         }                               pImeInquire;
79
80         union
81         {
82                 IMM32_pImeConfigureA            A;
83                 IMM32_pImeConfigureW            W;
84         }                               pImeConfigure;
85         union
86         {
87                 IMM32_pImeConversionListA       A;
88                 IMM32_pImeConversionListW       W;
89         }                               pImeConversionList;
90         IMM32_pImeDestroy               pImeDestroy;
91         union
92         {
93                 IMM32_pImeEnumRegisterWordA     A;
94                 IMM32_pImeEnumRegisterWordW     W;
95         }                               pImeEnumRegisterWord;
96         union
97         {
98                 IMM32_pImeGetRegisterWordStyleA A;
99                 IMM32_pImeGetRegisterWordStyleW W;
100         }                               pImeGetRegisterWordStyle;
101         union
102         {
103                 IMM32_pImeEscapeA               A;
104                 IMM32_pImeEscapeW               W;
105         }                               pImeEscape;
106         IMM32_pImeProcessKey            pImeProcessKey;
107         union
108         {
109                 IMM32_pImeRegisterWordA         A;
110                 IMM32_pImeRegisterWordW         W;
111         }                       pImeRegisterWord;
112         IMM32_pImeSelect                pImeSelect;
113         IMM32_pImeSetActiveContext      pImeSetActiveContext;
114         union
115         {
116                 IMM32_pImeSetCompositionStringA A;
117                 IMM32_pImeSetCompositionStringW W;
118         }                               pImeSetCompositionString;
119         IMM32_pImeToAsciiEx             pImeToAsciiEx;
120         union
121         {
122                 IMM32_pImeUnregisterWordA       A;
123                 IMM32_pImeUnregisterWordW       W;
124         }                               pImeUnregisterWord;
125         IMM32_pNotifyIME                pNotifyIME;
126
127         /* for Win98 and later */
128         union
129         {
130                 IMM32_pImeGetImeMenuItemsA      A;
131                 IMM32_pImeGetImeMenuItemsW      W;
132         }                               pImeGetImeMenuItems;
133 };
134
135 typedef struct IMM32_tagIMEKL   IMM32_IMEKL;
136 typedef struct IMM32_tagIMC     IMM32_IMC;
137
138 /* Win9x DDK says the UI class name can be up to 16 TCHARs. */
139 #define IMM32_UICLASSNAME_MAX           16
140
141 struct IMM32_tagIMEKL
142 {
143         IMM32_IMEKL*                            pNext;
144         HKL                                     hkl;
145         BOOL                                    fUnicode;
146         HINSTANCE                               hInstIME;
147         LPSTR                                   pszIMEFileName;
148         IMEINFO                                 imeinfo;
149         struct IMM32_IME_EXPORTED_HANDLERS      handlers;
150         union
151         {
152                 CHAR                            A[IMM32_UICLASSNAME_MAX];
153                 WCHAR                           W[IMM32_UICLASSNAME_MAX];
154         }                                       UIClassName;
155 };
156
157 struct IMM32_tagIMC
158 {
159         INPUTCONTEXT            context;
160         const IMM32_IMEKL*      pkl;
161         BOOL                    fSelected;
162 };
163
164
165
166
167
168 /* main.c */
169 LPVOID IMM32_HeapAlloc( DWORD dwFlags, DWORD dwSize );
170 LPVOID IMM32_HeapReAlloc( DWORD dwFlags, LPVOID lpv, DWORD dwSize );
171 void IMM32_HeapFree( LPVOID lpv );
172 IMM32_THREADDATA* IMM32_GetThreadData( void );
173 HIMC IMM32_GetDefaultContext( void );
174 HWND IMM32_GetDefaultIMEWnd( void );
175 void IMM32_Lock( void );
176 void IMM32_Unlock( void );
177
178 /* memory.c */
179 IMM32_MOVEABLEMEM* IMM32_MoveableAlloc( DWORD dwHeapFlags, DWORD dwHeapSize );
180 void IMM32_MoveableFree( IMM32_MOVEABLEMEM* lpMoveable );
181 BOOL IMM32_MoveableReAlloc( IMM32_MOVEABLEMEM* lpMoveable,
182                             DWORD dwHeapFlags, DWORD dwHeapSize );
183 LPVOID IMM32_MoveableLock( IMM32_MOVEABLEMEM* lpMoveable );
184 BOOL IMM32_MoveableUnlock( IMM32_MOVEABLEMEM* lpMoveable );
185 DWORD IMM32_MoveableGetLockCount( IMM32_MOVEABLEMEM* lpMoveable );
186 DWORD IMM32_MoveableGetSize( IMM32_MOVEABLEMEM* lpMoveable );
187
188 /* string.c */
189 INT IMM32_strlenAtoW( LPCSTR lpstr );
190 INT IMM32_strlenWtoA( LPCWSTR lpwstr );
191 LPWSTR IMM32_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen );
192 LPSTR IMM32_strncpyWtoA( LPSTR lpstr, LPCWSTR lpwstr, INT abuflen );
193 LPWSTR IMM32_strdupAtoW( LPCSTR lpstr );
194 LPSTR IMM32_strdupWtoA( LPCWSTR lpwstr );
195
196 /* imewnd.c */
197 BOOL IMM32_RegisterIMEWndClass( HINSTANCE hInstDLL );
198 void IMM32_UnregisterIMEWndClass( HINSTANCE hInstDLL );
199 HWND IMM32_CreateDefaultIMEWnd( void );
200
201 /* imekl.c */
202 const IMM32_IMEKL* IMM32_GetIME( HKL hkl );
203 void IMM32_UnloadAllIMEs( void );
204
205 /* imc.c */
206 IMM32_IMC* IMM32_LockIMC( HIMC hIMC );
207 BOOL IMM32_UnlockIMC( HIMC hIMC );
208
209