mshtml: Added IHTMLInputElement implementation.
[wine/gsoc_dplay.git] / dlls / mshtml / olewnd.c
blob82e3d3fe6b810fca3eaf7c38f039ce01960302c5
1 /*
2 * Copyright 2005 Jacek Caban
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
34 #include "resource.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
38 /**********************************************************
39 * IOleInPlaceActiveObject implementation
42 #define ACTOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceActiveObject, iface)
44 static HRESULT WINAPI OleInPlaceActiveObject_QueryInterface(IOleInPlaceActiveObject *iface, REFIID riid, void **ppvObject)
46 HTMLDocument *This = ACTOBJ_THIS(iface);
47 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
50 static ULONG WINAPI OleInPlaceActiveObject_AddRef(IOleInPlaceActiveObject *iface)
52 HTMLDocument *This = ACTOBJ_THIS(iface);
53 return IHTMLDocument2_AddRef(HTMLDOC(This));
56 static ULONG WINAPI OleInPlaceActiveObject_Release(IOleInPlaceActiveObject *iface)
58 HTMLDocument *This = ACTOBJ_THIS(iface);
59 return IHTMLDocument2_Release(HTMLDOC(This));
62 static HRESULT WINAPI OleInPlaceActiveObject_GetWindow(IOleInPlaceActiveObject *iface, HWND *phwnd)
64 HTMLDocument *This = ACTOBJ_THIS(iface);
66 TRACE("(%p)->(%p)\n", This, phwnd);
68 if(!phwnd)
69 return E_INVALIDARG;
71 if(!This->in_place_active) {
72 *phwnd = NULL;
73 return E_FAIL;
76 *phwnd = This->hwnd;
77 return S_OK;
80 static HRESULT WINAPI OleInPlaceActiveObject_ContextSensitiveHelp(IOleInPlaceActiveObject *iface, BOOL fEnterMode)
82 HTMLDocument *This = ACTOBJ_THIS(iface);
83 FIXME("(%p)->(%x)\n", This, fEnterMode);
84 return E_NOTIMPL;
87 static HRESULT WINAPI OleInPlaceActiveObject_TranslateAccelerator(IOleInPlaceActiveObject *iface, LPMSG lpmsg)
89 HTMLDocument *This = ACTOBJ_THIS(iface);
90 FIXME("(%p)->(%p)\n", This, lpmsg);
91 return E_NOTIMPL;
94 static HRESULT WINAPI OleInPlaceActiveObject_OnFrameWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
96 HTMLDocument *This = ACTOBJ_THIS(iface);
97 FIXME("(%p)->(%x)\n", This, fActivate);
98 return E_NOTIMPL;
101 static HRESULT WINAPI OleInPlaceActiveObject_OnDocWindowActivate(IOleInPlaceActiveObject *iface, BOOL fActivate)
103 HTMLDocument *This = ACTOBJ_THIS(iface);
104 FIXME("(%p)->(%x)\n", This, fActivate);
105 return E_NOTIMPL;
108 static HRESULT WINAPI OleInPlaceActiveObject_ResizeBorder(IOleInPlaceActiveObject *iface, LPCRECT prcBorder,
109 IOleInPlaceUIWindow *pUIWindow, BOOL fFrameWindow)
111 HTMLDocument *This = ACTOBJ_THIS(iface);
112 FIXME("(%p)->(%p %p %x)\n", This, prcBorder, pUIWindow, fFrameWindow);
113 return E_NOTIMPL;
116 static HRESULT WINAPI OleInPlaceActiveObject_EnableModeless(IOleInPlaceActiveObject *iface, BOOL fEnable)
118 HTMLDocument *This = ACTOBJ_THIS(iface);
119 FIXME("(%p)->(%x)\n", This, fEnable);
120 return E_NOTIMPL;
123 static const IOleInPlaceActiveObjectVtbl OleInPlaceActiveObjectVtbl = {
124 OleInPlaceActiveObject_QueryInterface,
125 OleInPlaceActiveObject_AddRef,
126 OleInPlaceActiveObject_Release,
127 OleInPlaceActiveObject_GetWindow,
128 OleInPlaceActiveObject_ContextSensitiveHelp,
129 OleInPlaceActiveObject_TranslateAccelerator,
130 OleInPlaceActiveObject_OnFrameWindowActivate,
131 OleInPlaceActiveObject_OnDocWindowActivate,
132 OleInPlaceActiveObject_ResizeBorder,
133 OleInPlaceActiveObject_EnableModeless
136 #undef ACTOBJ_THIS
138 /**********************************************************
139 * IOleInPlaceObjectWindowless implementation
142 #define OLEINPLACEWND_THIS(iface) DEFINE_THIS(HTMLDocument, OleInPlaceObjectWindowless, iface)
144 static HRESULT WINAPI OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless *iface,
145 REFIID riid, void **ppvObject)
147 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
148 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
151 static ULONG WINAPI OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless *iface)
153 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
154 return IHTMLDocument2_AddRef(HTMLDOC(This));
157 static ULONG WINAPI OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless *iface)
159 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
160 return IHTMLDocument2_Release(HTMLDOC(This));
163 static HRESULT WINAPI OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless *iface,
164 HWND *phwnd)
166 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
167 return IOleWindow_GetWindow(OLEWIN(This), phwnd);
170 static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface,
171 BOOL fEnterMode)
173 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
174 return IOleWindow_ContextSensitiveHelp(OLEWIN(This), fEnterMode);
177 static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface)
179 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
181 TRACE("(%p)\n", This);
183 if(This->ui_active)
184 IOleDocumentView_UIActivate(DOCVIEW(This), FALSE);
185 This->window_active = FALSE;
187 if(!This->in_place_active)
188 return S_OK;
190 if(This->frame)
191 IOleInPlaceFrame_Release(This->frame);
193 if(This->hwnd) {
194 ShowWindow(This->hwnd, SW_HIDE);
195 SetWindowPos(This->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
198 This->in_place_active = FALSE;
199 if(This->ipsite)
200 IOleInPlaceSite_OnInPlaceDeactivate(This->ipsite);
202 return S_OK;
205 static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless *iface)
207 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
208 FIXME("(%p)\n", This);
209 return E_NOTIMPL;
212 static HRESULT WINAPI OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless *iface,
213 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
215 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
216 FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect);
217 return E_NOTIMPL;
220 static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface)
222 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
223 FIXME("(%p)\n", This);
224 return E_NOTIMPL;
227 static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless *iface,
228 UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult)
230 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
231 FIXME("(%p)->(%u %u %lu %p)\n", This, msg, wParam, lParam, lpResult);
232 return E_NOTIMPL;
235 static HRESULT WINAPI OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless *iface,
236 IDropTarget **ppDropTarget)
238 HTMLDocument *This = OLEINPLACEWND_THIS(iface);
239 FIXME("(%p)->(%p)\n", This, ppDropTarget);
240 return E_NOTIMPL;
243 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
244 OleInPlaceObjectWindowless_QueryInterface,
245 OleInPlaceObjectWindowless_AddRef,
246 OleInPlaceObjectWindowless_Release,
247 OleInPlaceObjectWindowless_GetWindow,
248 OleInPlaceObjectWindowless_ContextSensitiveHelp,
249 OleInPlaceObjectWindowless_InPlaceDeactivate,
250 OleInPlaceObjectWindowless_UIDeactivate,
251 OleInPlaceObjectWindowless_SetObjectRects,
252 OleInPlaceObjectWindowless_ReactivateAndUndo,
253 OleInPlaceObjectWindowless_OnWindowMessage,
254 OleInPlaceObjectWindowless_GetDropTarget
257 #undef INPLACEWIN_THIS
259 void HTMLDocument_ShowContextMenu(HTMLDocument *This, DWORD dwID, POINT *ppt)
261 HMENU menu_res, menu;
262 HRESULT hres;
264 hres = IDocHostUIHandler_ShowContextMenu(This->hostui, dwID, ppt,
265 (IUnknown*)CMDTARGET(This), (IDispatch*)HTMLDOC(This));
266 if(hres == S_OK)
267 return;
269 menu_res = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_BROWSE_CONTEXT_MENU));
270 menu = GetSubMenu(menu_res, dwID);
272 TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD,
273 ppt->x, ppt->y, 0, This->hwnd, NULL);
275 DestroyMenu(menu_res);
278 void HTMLDocument_Window_Init(HTMLDocument *This)
280 This->lpOleInPlaceActiveObjectVtbl = &OleInPlaceActiveObjectVtbl;
281 This->lpOleInPlaceObjectWindowlessVtbl = &OleInPlaceObjectWindowlessVtbl;