ReactOS 0.4.16-dev-457-g087979e
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{
36 m_contextmenu = menu;
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{
96 return hr;
97
99 hr = m_contextmenu->QueryContextMenu(m_menu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
100 if (!SUCCEEDED(hr))
101 return hr;
102
104 return hr;
105}
106
107
108// *** FolderItemVerbs methods ***
110{
111 if (!plCount)
112 return E_INVALIDARG;
113 *plCount = m_count;
114 return S_OK;
115}
116
118{
119 TRACE("(%p, %p)\n", this, ppid);
120
121 if (ppid)
122 *ppid = NULL;
123
124 return E_NOTIMPL;
125}
126
128{
129 TRACE("(%p, %p)\n", this, ppid);
130
131 if (ppid)
132 *ppid = NULL;
133
134 return E_NOTIMPL;
135}
136
138{
139 if (!ppid)
140 return E_POINTER;
141
143
144 HRESULT hr = VariantChangeType(&var, &indexVar, 0, VT_I4);
146 return E_INVALIDARG;
147
148 int index = V_I4(&var);
149
150 if (index > m_count)
151 return S_OK;
152
153 BSTR name = NULL;
154
155 if(index == m_count)
156 {
158 }
159 else
160 {
161 MENUITEMINFOW info = { sizeof(info), 0 };
162 info.fMask = MIIM_STRING;
164 return E_FAIL;
166 if (name)
167 {
168 info.dwTypeData = name;
169 info.cch++;
171 }
172 }
173
174 if (!name)
175 return E_OUTOFMEMORY;
176
178 verb->Init(m_contextmenu, name);
179 verb->AddRef();
180 *ppid = verb;
181
182 return S_OK;
183}
184
186{
187 TRACE("(%p, %p)\n", this, ppunk);
188 return E_NOTIMPL;
189}
190
191
#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
HRESULT Init(LPITEMIDLIST idlist)
STDMETHOD() _NewEnum(IUnknown **ppunk) override
STDMETHOD() get_Count(LONG *plCount) override
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
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
OLECHAR * BSTR
Definition: compat.h:2293
@ VT_I4
Definition: compat.h:2298
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
EXTERN_C HRESULT SHELL_GetUIObjectOfAbsoluteItem(_In_opt_ HWND hWnd, _In_ PCIDLIST_ABSOLUTE pidl, _In_ REFIID riid, _Out_ void **ppvObj)
Definition: utils.cpp:263
GLuint index
Definition: glext.h:6031
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
const char * var
Definition: shader.c:5666
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
HRESULT hr
Definition: shlfolder.c:183
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:580
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:614
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#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 E_POINTER
Definition: winerror.h:2365
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838
#define MIIM_STRING
Definition: winuser.h:730
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)