2 * ITfThreadMgr implementation
4 * Copyright 2008 Aric Stewart, CodeWeavers
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/debug.h"
36 #include "wine/unicode.h"
39 #include "msctf_internal.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(msctf);
43 typedef struct tagACLMulti {
44 const ITfThreadMgrVtbl *ThreadMgrVtbl;
47 ITfDocumentMgr *focus;
50 static void ThreadMgr_Destructor(ThreadMgr *This)
52 TRACE("destroying %p\n", This);
54 ITfDocumentMgr_Release(This->focus);
55 HeapFree(GetProcessHeap(),0,This);
58 static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut)
60 ThreadMgr *This = (ThreadMgr *)iface;
63 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr))
70 IUnknown_AddRef(iface);
74 WARN("unsupported interface: %s\n", debugstr_guid(iid));
78 static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface)
80 ThreadMgr *This = (ThreadMgr *)iface;
81 return InterlockedIncrement(&This->refCount);
84 static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface)
86 ThreadMgr *This = (ThreadMgr *)iface;
89 ret = InterlockedDecrement(&This->refCount);
91 ThreadMgr_Destructor(This);
95 /*****************************************************
96 * ITfThreadMgr functions
97 *****************************************************/
99 static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *ptid)
101 ThreadMgr *This = (ThreadMgr *)iface;
102 FIXME("STUB:(%p)\n",This);
106 static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface)
108 ThreadMgr *This = (ThreadMgr *)iface;
109 FIXME("STUB:(%p)\n",This);
113 static HRESULT WINAPI ThreadMgr_CreateDocumentMgr( ITfThreadMgr* iface, ITfDocumentMgr
116 TRACE("(%p)\n",iface);
117 return DocumentMgr_Constructor(ppdim);
120 static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs
123 ThreadMgr *This = (ThreadMgr *)iface;
124 FIXME("STUB:(%p)\n",This);
128 static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr
131 ThreadMgr *This = (ThreadMgr *)iface;
132 TRACE("(%p)\n",This);
137 *ppdimFocus = This->focus;
139 TRACE("->%p\n",This->focus);
141 if (This->focus == NULL)
144 ITfDocumentMgr_AddRef(This->focus);
149 static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus)
151 ITfDocumentMgr *check;
152 ThreadMgr *This = (ThreadMgr *)iface;
154 TRACE("(%p) %p\n",This,pdimFocus);
156 if (!pdimFocus || FAILED(IUnknown_QueryInterface(pdimFocus,&IID_ITfDocumentMgr,(LPVOID*) &check)))
160 ITfDocumentMgr_Release(This->focus);
166 static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd,
167 ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev)
169 ThreadMgr *This = (ThreadMgr *)iface;
170 FIXME("STUB:(%p)\n",This);
174 static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThreadFocus)
176 ThreadMgr *This = (ThreadMgr *)iface;
177 FIXME("STUB:(%p)\n",This);
181 static HRESULT WINAPI ThreadMgr_GetFunctionProvider( ITfThreadMgr* iface, REFCLSID clsid,
182 ITfFunctionProvider **ppFuncProv)
184 ThreadMgr *This = (ThreadMgr *)iface;
185 FIXME("STUB:(%p)\n",This);
189 static HRESULT WINAPI ThreadMgr_EnumFunctionProviders( ITfThreadMgr* iface,
190 IEnumTfFunctionProviders **ppEnum)
192 ThreadMgr *This = (ThreadMgr *)iface;
193 FIXME("STUB:(%p)\n",This);
197 static HRESULT WINAPI ThreadMgr_GetGlobalCompartment( ITfThreadMgr* iface,
198 ITfCompartmentMgr **ppCompMgr)
200 ThreadMgr *This = (ThreadMgr *)iface;
201 FIXME("STUB:(%p)\n",This);
205 static const ITfThreadMgrVtbl ThreadMgr_ThreadMgrVtbl =
207 ThreadMgr_QueryInterface,
211 ThreadMgr_fnActivate,
212 ThreadMgr_fnDeactivate,
213 ThreadMgr_CreateDocumentMgr,
214 ThreadMgr_EnumDocumentMgrs,
217 ThreadMgr_AssociateFocus,
218 ThreadMgr_IsThreadFocus,
219 ThreadMgr_GetFunctionProvider,
220 ThreadMgr_EnumFunctionProviders,
221 ThreadMgr_GetGlobalCompartment
224 HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
228 return CLASS_E_NOAGGREGATION;
230 This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ThreadMgr));
232 return E_OUTOFMEMORY;
234 This->ThreadMgrVtbl= &ThreadMgr_ThreadMgrVtbl;
237 TRACE("returning %p\n", This);
238 *ppOut = (IUnknown *)This;