ReactOS 0.4.17-dev-486-gae50d74
CFolderItemVerbs.cpp
Go to the documentation of this file.
1/*
2 * FolderItemVerb(s) implementation
3 *
4 * Copyright 2015 Mark Jansen
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include "precomp.h"
22
24
25
27{
28}
29
31{
32}
33
35{
38}
39
40// *** FolderItemVerb methods ***
41
43{
44 TRACE("(%p, %p)\n", this, ppid);
45
46 if (ppid)
47 *ppid = NULL;
48
49 return E_NOTIMPL;
50}
51
53{
54 TRACE("(%p, %p)\n", this, ppid);
55
56 if (ppid)
57 *ppid = NULL;
58
59 return E_NOTIMPL;
60}
61
63{
64 if (!pbs)
65 return E_POINTER;
66 *pbs = SysAllocString(m_name);
67 return S_OK;
68}
69
71{
72 TRACE("(%p, %p)\n", this);
73 return E_NOTIMPL;
74}
75
76
77
78
79
80
82 :m_menu(NULL)
83 ,m_count(0)
84{
85}
86
88{
90}
91
93{
94 m_contextmenu = &cm;
96 HRESULT hr = m_contextmenu->QueryContextMenu(m_menu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
97 if (FAILED(hr))
98 return hr;
99
101 return hr;
102}
103
105{
109 return hr;
110 return Init(*static_cast<IContextMenu*>(pCM));
111}
112
113
114// *** FolderItemVerbs methods ***
116{
117 if (!plCount)
118 return E_INVALIDARG;
119 *plCount = m_count;
120 return S_OK;
121}
122
124{
125 TRACE("(%p, %p)\n", this, ppid);
126
127 if (ppid)
128 *ppid = NULL;
129
130 return E_NOTIMPL;
131}
132
134{
135 TRACE("(%p, %p)\n", this, ppid);
136
137 if (ppid)
138 *ppid = NULL;
139
140 return E_NOTIMPL;
141}
142
144{
145 if (!ppid)
146 return E_POINTER;
147
149
150 HRESULT hr = VariantChangeType(&var, &indexVar, 0, VT_I4);
152 return E_INVALIDARG;
153
154 int index = V_I4(&var);
155 if (index > m_count)
156 return S_FALSE;
157
158 BSTR name = NULL;
159 if (index == m_count)
160 {
162 }
163 else
164 {
165 MENUITEMINFOW info = { sizeof(info), 0 };
166 info.fMask = MIIM_STRING;
168 return E_FAIL;
170 if (name)
171 {
172 info.dwTypeData = name;
173 info.cch++;
175 }
176 }
177
178 if (!name)
179 return E_OUTOFMEMORY;
180
182 verb->Init(m_contextmenu, name);
183 verb->AddRef();
184 *ppid = verb;
185
186 return S_OK;
187}
188
190{
191 TRACE("(%p, %p)\n", this, ppunk);
192 return E_NOTIMPL;
193}
194
195
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define STDMETHODCALLTYPE
Definition: bdasup.h:9
STDMETHOD() get_Parent(IDispatch **ppid) override
CComPtr< IContextMenu > m_contextmenu
STDMETHOD() get_Name(BSTR *pbs) override
STDMETHOD() get_Application(IDispatch **ppid) override
STDMETHOD() DoIt() override
void Init(IContextMenu *menu, BSTR name)
STDMETHOD() Item(VARIANT index, FolderItemVerb **ppid) override
STDMETHOD() _NewEnum(IUnknown **ppunk) override
STDMETHOD() get_Count(LONG *plCount) override
HRESULT Init(IContextMenu &cm)
STDMETHOD() get_Parent(IDispatch **ppid) override
CComPtr< IContextMenu > m_contextmenu
virtual ~CFolderItemVerbs()
STDMETHOD() get_Application(IDispatch **ppid) override
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
OLECHAR * BSTR
Definition: compat.h:2293
@ VT_I4
Definition: compat.h:2298
EXTERN_C HRESULT SHELL_GetUIObjectOfAbsoluteItem(_In_opt_ HWND hWnd, _In_ PCIDLIST_ABSOLUTE pidl, _In_ REFIID riid, _Out_ void **ppvObj)
Definition: utils.cpp:428
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:33
GLuint index
Definition: glext.h:6031
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
const char * var
Definition: shader.c:5666
#define menu
Definition: input.c:3282
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define V_I4(A)
Definition: oleauto.h:247
long LONG
Definition: pedump.c:60
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:590
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:621
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define TRACE(s)
Definition: solgame.cpp:4
Definition: name.c:39
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
#define S_FALSE
Definition: winerror.h:3451
#define E_POINTER
Definition: winerror.h:3480
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define MIIM_STRING
Definition: winuser.h:738
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define IID_PPV_ARG(Itype, ppType)