makefiles: Don't use standard libs for programs that specify -nodefaultlibs.
[wine/zf.git] / dlls / msctf / langbarmgr.c
blobf56c130caaade7f8146faceb8b3f800aabae7bfa
1 /*
2 * ITfLangBarMgr implementation
4 * Copyright 2010 Justin Chevrier
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
21 #define COBJMACROS
23 #include "wine/debug.h"
24 #include "winbase.h"
25 #include "winreg.h"
26 #include "shlwapi.h"
28 #include "msctf.h"
29 #include "msctf_internal.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(msctf);
33 typedef struct tagLangBarMgr {
34 ITfLangBarMgr ITfLangBarMgr_iface;
36 LONG refCount;
38 } LangBarMgr;
40 static inline LangBarMgr *impl_from_ITfLangBarMgr(ITfLangBarMgr *iface)
42 return CONTAINING_RECORD(iface, LangBarMgr, ITfLangBarMgr_iface);
45 static void LangBarMgr_Destructor(LangBarMgr *This)
47 TRACE("destroying %p\n", This);
49 HeapFree(GetProcessHeap(),0,This);
52 static HRESULT WINAPI LangBarMgr_QueryInterface(ITfLangBarMgr *iface, REFIID iid, LPVOID *ppvOut)
54 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
55 *ppvOut = NULL;
57 if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfLangBarMgr))
59 *ppvOut = &This->ITfLangBarMgr_iface;
62 if (*ppvOut)
64 ITfLangBarMgr_AddRef(iface);
65 return S_OK;
68 WARN("unsupported interface: %s\n", debugstr_guid(iid));
69 return E_NOINTERFACE;
72 static ULONG WINAPI LangBarMgr_AddRef(ITfLangBarMgr *iface)
74 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
75 return InterlockedIncrement(&This->refCount);
78 static ULONG WINAPI LangBarMgr_Release(ITfLangBarMgr *iface)
80 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
81 ULONG ret;
83 ret = InterlockedDecrement(&This->refCount);
84 if (ret == 0)
85 LangBarMgr_Destructor(This);
86 return ret;
89 /*****************************************************
90 * ITfLangBarMgr functions
91 *****************************************************/
93 static HRESULT WINAPI LangBarMgr_AdviseEventSink( ITfLangBarMgr* iface, ITfLangBarEventSink *pSink, HWND hwnd, DWORD dwflags, DWORD *pdwCookie)
95 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
97 FIXME("STUB:(%p)\n",This);
98 return E_NOTIMPL;
101 static HRESULT WINAPI LangBarMgr_UnAdviseEventSink( ITfLangBarMgr* iface, DWORD dwCookie)
103 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
105 FIXME("STUB:(%p)\n",This);
106 return E_NOTIMPL;
109 static HRESULT WINAPI LangBarMgr_GetThreadMarshalInterface( ITfLangBarMgr* iface, DWORD dwThreadId, DWORD dwType, REFIID riid, IUnknown **ppunk)
111 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
113 FIXME("STUB:(%p)\n",This);
114 return E_NOTIMPL;
117 static HRESULT WINAPI LangBarMgr_GetThreadLangBarItemMgr( ITfLangBarMgr* iface, DWORD dwThreadId, ITfLangBarItemMgr **pplbi, DWORD *pdwThreadid)
119 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
121 FIXME("STUB:(%p)\n",This);
122 return E_NOTIMPL;
125 static HRESULT WINAPI LangBarMgr_GetInputProcessorProfiles( ITfLangBarMgr* iface, DWORD dwThreadId, ITfInputProcessorProfiles **ppaip, DWORD *pdwThreadid)
127 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
129 FIXME("STUB:(%p)\n",This);
130 return E_NOTIMPL;
133 static HRESULT WINAPI LangBarMgr_RestoreLastFocus( ITfLangBarMgr* iface, DWORD *dwThreadId, BOOL fPrev)
135 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
137 FIXME("STUB:(%p)\n",This);
138 return E_NOTIMPL;
141 static HRESULT WINAPI LangBarMgr_SetModalInput( ITfLangBarMgr* iface, ITfLangBarEventSink *pSink, DWORD dwThreadId, DWORD dwFlags)
143 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
145 FIXME("STUB:(%p)\n",This);
146 return E_NOTIMPL;
149 static HRESULT WINAPI LangBarMgr_ShowFloating( ITfLangBarMgr* iface, DWORD dwFlags)
151 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
153 FIXME("STUB:(%p)\n",This);
154 return E_NOTIMPL;
157 static HRESULT WINAPI LangBarMgr_GetShowFloatingStatus( ITfLangBarMgr* iface, DWORD *pdwFlags)
159 LangBarMgr *This = impl_from_ITfLangBarMgr(iface);
161 FIXME("STUB:(%p)\n",This);
162 return E_NOTIMPL;
165 static const ITfLangBarMgrVtbl LangBarMgr_LangBarMgrVtbl =
167 LangBarMgr_QueryInterface,
168 LangBarMgr_AddRef,
169 LangBarMgr_Release,
171 LangBarMgr_AdviseEventSink,
172 LangBarMgr_UnAdviseEventSink,
173 LangBarMgr_GetThreadMarshalInterface,
174 LangBarMgr_GetThreadLangBarItemMgr,
175 LangBarMgr_GetInputProcessorProfiles,
176 LangBarMgr_RestoreLastFocus,
177 LangBarMgr_SetModalInput,
178 LangBarMgr_ShowFloating,
179 LangBarMgr_GetShowFloatingStatus
182 HRESULT LangBarMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
184 LangBarMgr *This;
185 if (pUnkOuter)
186 return CLASS_E_NOAGGREGATION;
188 This = HeapAlloc(GetProcessHeap(),0,sizeof(LangBarMgr));
189 if (This == NULL)
190 return E_OUTOFMEMORY;
192 This->ITfLangBarMgr_iface.lpVtbl = &LangBarMgr_LangBarMgrVtbl;
193 This->refCount = 1;
195 *ppOut = (IUnknown *)&This->ITfLangBarMgr_iface;
196 TRACE("returning %p\n", *ppOut);
197 return S_OK;