ReactOS 0.4.15-dev-7918-g2a2556c
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{
98 return hr;
99
100 hr = folder->GetUIObjectOf(NULL, 1, &child, IID_IContextMenu, NULL, (PVOID*)&m_contextmenu);
102 return hr;
103
105 hr = m_contextmenu->QueryContextMenu(m_menu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
106 if (!SUCCEEDED(hr))
107 return hr;
108
110 return hr;
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
156 if (index > m_count)
157 return S_OK;
158
159 BSTR name = NULL;
160
161 if(index == m_count)
162 {
164 }
165 else
166 {
167 MENUITEMINFOW info = { sizeof(info), 0 };
168 info.fMask = MIIM_STRING;
170 return E_FAIL;
172 if (name)
173 {
174 info.dwTypeData = name;
175 info.cch++;
177 }
178 }
179
180 if (!name)
181 return E_OUTOFMEMORY;
182
184 verb->Init(m_contextmenu, name);
185 verb->AddRef();
186 *ppid = verb;
187
188 return S_OK;
189}
190
192{
193 TRACE("(%p, %p)\n", this, ppunk);
194 return E_NOTIMPL;
195}
196
197
#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
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
static HWND child
Definition: cursoricon.c:298
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 WINAPI SHBindToParent(LPCITEMIDLIST pidl, REFIID riid, LPVOID *ppv, LPCITEMIDLIST *ppidlLast)
Definition: pidl.c:1361
HRESULT hr
Definition: shlfolder.c:183
#define FCIDM_SHVIEWFIRST
Definition: shlobj.h:573
#define FCIDM_SHVIEWLAST
Definition: shlobj.h:607
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define TRACE(s)
Definition: solgame.cpp:4
Definition: fci.c:116
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:727
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)