Changeset 1558 for trunk/src/shell32/shv_bg_cmenu.cpp
- Timestamp:
- Nov 2, 1999, 9:38:48 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/shell32/shv_bg_cmenu.cpp
r1214 r1558 1 /* $Id: shv_bg_cmenu.cpp,v 1. 1 1999-10-09 11:13:25 sandervlExp $ */1 /* $Id: shv_bg_cmenu.cpp,v 1.2 1999-11-02 20:38:48 phaller Exp $ */ 2 2 3 3 /* … … 8 8 9 9 /* 10 * 11 * 10 * IContextMenu 11 * ShellView Background Context Menu (shv_bg_cm) 12 12 * 13 * Copyright 1999Juergen Schmied <juergen.schmied@metronet.de>13 * Copyright 1999 Juergen Schmied <juergen.schmied@metronet.de> 14 14 */ 15 15 … … 45 45 */ 46 46 typedef struct 47 { 48 DWORDref;47 { ICOM_VTABLE(IContextMenu)* lpvtbl; 48 DWORD ref; 49 49 } BgCmImpl; 50 50 … … 57 57 static HRESULT WINAPI ISVBgCm_fnQueryInterface(IContextMenu *iface, REFIID riid, LPVOID *ppvObj) 58 58 { 59 60 61 62 59 ICOM_THIS(BgCmImpl, iface); 60 61 char xriid[50]; 62 WINE_StringFromCLSID((LPCLSID)riid,xriid); 63 63 64 64 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnQueryInterface(%08xh,%s,%08xh)\n", … … 67 67 ppvObj)); 68 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 69 *ppvObj = NULL; 70 71 if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/ 72 { 73 *ppvObj = This; 74 } 75 else if(IsEqualIID(riid, &IID_IContextMenu)) /*IContextMenu*/ 76 { 77 *ppvObj = This; 78 } 79 else if(IsEqualIID(riid, &IID_IShellExtInit)) /*IShellExtInit*/ 80 { 81 FIXME("-- LPSHELLEXTINIT pointer requested\n"); 82 } 83 84 if(*ppvObj) 85 { 86 IUnknown_AddRef((IUnknown*)*ppvObj); 87 TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj); 88 return S_OK; 89 } 90 TRACE("-- Interface: E_NOINTERFACE\n"); 91 return E_NOINTERFACE; 92 92 } 93 93 … … 97 97 static ULONG WINAPI ISVBgCm_fnAddRef(IContextMenu *iface) 98 98 { 99 99 ICOM_THIS(BgCmImpl, iface); 100 100 101 101 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnAddRef(%08xh,%u)\n", … … 103 103 This->ref)); 104 104 105 106 105 shell32_ObjCount++; 106 return ++(This->ref); 107 107 } 108 108 … … 112 112 static ULONG WINAPI ISVBgCm_fnRelease(IContextMenu *iface) 113 113 { 114 114 ICOM_THIS(BgCmImpl, iface); 115 115 116 116 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnRelease(%08xh)\n", 117 117 This)); 118 118 119 120 121 122 123 124 125 126 127 119 shell32_ObjCount--; 120 121 if (!--(This->ref)) 122 { TRACE(" destroying IContextMenu(%p)\n",This); 123 124 HeapFree(GetProcessHeap(),0,This); 125 return 0; 126 } 127 return This->ref; 128 128 } 129 129 … … 133 133 134 134 static HRESULT WINAPI ISVBgCm_fnQueryContextMenu( 135 136 137 138 139 140 141 { 142 HMENUhMyMenu;143 UINTidMax;144 145 135 IContextMenu *iface, 136 HMENU hMenu, 137 UINT indexMenu, 138 UINT idCmdFirst, 139 UINT idCmdLast, 140 UINT uFlags) 141 { 142 HMENU hMyMenu; 143 UINT idMax; 144 145 ICOM_THIS(BgCmImpl, iface); 146 146 147 147 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnQueryContextMenu(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n", … … 153 153 uFlags)); 154 154 155 156 157 158 159 160 161 155 hMyMenu = LoadMenuA(shell32_hInstance, "MENU_002"); 156 157 idMax = Shell_MergeMenus (hMenu, GetSubMenu(hMyMenu,0), indexMenu, idCmdFirst, idCmdLast, MM_SUBMENUSHAVEIDS); 158 159 DestroyMenu(hMyMenu); 160 161 return ResultFromShort(idMax - idCmdFirst); 162 162 } 163 163 … … 166 166 */ 167 167 static HRESULT WINAPI ISVBgCm_fnInvokeCommand( 168 169 170 { 171 172 173 LPSHELLBROWSERlpSB;174 LPSHELLVIEWlpSV;175 HWNDhWndSV;168 IContextMenu *iface, 169 LPCMINVOKECOMMANDINFO lpcmi) 170 { 171 ICOM_THIS(BgCmImpl, iface); 172 173 LPSHELLBROWSER lpSB; 174 LPSHELLVIEW lpSV; 175 HWND hWndSV; 176 176 177 177 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnInvokeCommand((%p)->(invcom=%p verb=%p wnd=%x)\n", … … 181 181 lpcmi->hwnd)); 182 182 183 /* get the active IShellView */ 184 lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0); 185 IShellBrowser_QueryActiveShellView(lpSB, &lpSV); 186 IShellView_GetWindow(lpSV, &hWndSV); 187 188 if(HIWORD(lpcmi->lpVerb)) 189 { 190 TRACE("%s\n",lpcmi->lpVerb); 191 192 if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA)) 193 { 194 FIXME("%s not implemented\n",lpcmi->lpVerb); 195 } 196 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA)) 197 { 198 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 199 } 200 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA)) 201 { 202 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 203 } 204 else 205 { 206 FIXME("please report: unknown verb %s\n",lpcmi->lpVerb); 207 } 208 } 209 else 210 { 211 switch(LOWORD(lpcmi->lpVerb)) 212 { 213 case FCIDM_SHVIEW_BIGICON: 214 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_BIGICON,0),0 ); 215 break; 216 217 case FCIDM_SHVIEW_SMALLICON: 218 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_SMALLICON,0),0 ); 219 220 case FCIDM_SHVIEW_LISTVIEW: 221 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 222 break; 223 224 case FCIDM_SHVIEW_REPORTVIEW: 225 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 226 break; 227 } 228 } 229 230 IShellView_Release(lpSV); /* QueryActiveShellView does AddRef*/ 231 return NOERROR; 183 /* get the active IShellView */ 184 lpSB = (LPSHELLBROWSER)SendMessageA(lpcmi->hwnd, CWM_GETISHELLBROWSER,0,0); 185 IShellBrowser_QueryActiveShellView(lpSB, &lpSV); 186 IShellView_GetWindow(lpSV, &hWndSV); 187 188 if(HIWORD(lpcmi->lpVerb)) 189 { 190 TRACE("%s\n",lpcmi->lpVerb); 191 192 if (! strcmp(lpcmi->lpVerb,CMDSTR_NEWFOLDERA)) 193 { 194 FIXME("%s not implemented\n",lpcmi->lpVerb); 195 } 196 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWLISTA)) 197 { 198 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_LISTVIEW,0),0 ); 199 } 200 else if (! strcmp(lpcmi->lpVerb,CMDSTR_VIEWDETAILSA)) 201 { 202 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(FCIDM_SHVIEW_REPORTVIEW,0),0 ); 203 } 204 else 205 { 206 FIXME("please report: unknown verb %s\n",lpcmi->lpVerb); 207 } 208 } 209 else 210 { 211 /* if it's a id just pass it to the parent shv */ 212 SendMessageA(hWndSV, WM_COMMAND, MAKEWPARAM(LOWORD(lpcmi->lpVerb), 0),0 ); 213 } 214 215 IShellView_Release(lpSV); /* QueryActiveShellView does AddRef*/ 216 return NOERROR; 232 217 } 233 218 … … 237 222 */ 238 223 static HRESULT WINAPI ISVBgCm_fnGetCommandString( 239 240 241 242 243 244 245 { 246 224 IContextMenu *iface, 225 UINT idCommand, 226 UINT uFlags, 227 LPUINT lpReserved, 228 LPSTR lpszName, 229 UINT uMaxNameLen) 230 { 231 ICOM_THIS(BgCmImpl, iface); 247 232 248 233 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnGetCommandString((%p)->(idcom=%x flags=%x %p name=%p len=%x)\n", … … 254 239 uMaxNameLen)); 255 240 256 257 258 259 260 261 262 263 264 265 { 266 267 268 269 270 271 272 241 /* test the existance of the menu items, the file dialog enables 242 the buttons according to this */ 243 if (uFlags == GCS_VALIDATEA) 244 { 245 if(HIWORD(idCommand)) 246 { 247 if (!strcmp((LPSTR)idCommand, CMDSTR_VIEWLISTA) || 248 !strcmp((LPSTR)idCommand, CMDSTR_VIEWDETAILSA) || 249 !strcmp((LPSTR)idCommand, CMDSTR_NEWFOLDERA)) 250 { 251 return NOERROR; 252 } 253 } 254 } 255 256 FIXME("unknown command string\n"); 257 return E_FAIL; 273 258 } 274 259 … … 277 262 */ 278 263 static HRESULT WINAPI ISVBgCm_fnHandleMenuMsg( 279 280 281 282 283 { 284 264 IContextMenu *iface, 265 UINT uMsg, 266 WPARAM wParam, 267 LPARAM lParam) 268 { 269 ICOM_THIS(BgCmImpl, iface); 285 270 286 271 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_fnHandleMenuMsg((%p)->(msg=%x wp=%x lp=%lx)\n", … … 290 275 lParam)); 291 276 292 277 return E_NOTIMPL; 293 278 } 294 279 … … 298 283 */ 299 284 static struct ICOM_VTABLE(IContextMenu) cmvt = 300 { 301 302 303 304 305 306 307 308 309 (void *) 0xdeadbabe/* just paranoia (IContextMenu3) */285 { 286 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 287 ISVBgCm_fnQueryInterface, 288 ISVBgCm_fnAddRef, 289 ISVBgCm_fnRelease, 290 ISVBgCm_fnQueryContextMenu, 291 ISVBgCm_fnInvokeCommand, 292 ISVBgCm_fnGetCommandString, 293 ISVBgCm_fnHandleMenuMsg, 294 (void *) 0xdeadbabe /* just paranoia (IContextMenu3) */ 310 295 }; 311 296 … … 315 300 IContextMenu *ISvBgCm_Constructor(void) 316 301 { 317 318 319 320 321 302 BgCmImpl* cm; 303 304 cm = (BgCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl)); 305 cm->lpvtbl=&cmvt; 306 cm->ref = 1; 322 307 323 308 dprintf(("SHELL32:shv_bg_cmenu: ISVBgCm_Constructor(%p)\n", 324 309 cm)); 325 310 326 327 328 } 329 330 311 shell32_ObjCount++; 312 return (IContextMenu*)cm; 313 } 314 315
Note:
See TracChangeset
for help on using the changeset viewer.