MCPcopy Create free account
hub / github.com/derceg/explorerplusplus / AddMenuEntries

Method AddMenuEntries

Explorer++/Explorer++/ShellContextMenuHandler.cpp:21–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#define MENU_OPEN_IN_NEW_TAB (MAX_SHELL_MENU_ID + 1)
20
21void Explorerplusplus::AddMenuEntries(PCIDLIST_ABSOLUTE pidlParent,
22 const std::vector<PITEMID_CHILD> &pidlItems, DWORD_PTR dwData, HMENU hMenu)
23{
24 assert(dwData != NULL);
25
26 auto *pfcmi = reinterpret_cast<FileContextMenuInfo_t *>(dwData);
27
28 bool addNewTabMenuItem = false;
29
30 if (pfcmi->uFrom == FROM_LISTVIEW)
31 {
32 if (pidlItems.size() == 1)
33 {
34 SFGAOF fileAttributes = SFGAO_FOLDER;
35
36 unique_pidl_absolute pidlComplete(ILCombine(pidlParent, pidlItems.front()));
37 GetItemAttributes(pidlComplete.get(), &fileAttributes);
38
39 if (fileAttributes & SFGAO_FOLDER)
40 {
41 addNewTabMenuItem = true;
42 }
43 }
44 }
45 else if (pfcmi->uFrom == FROM_TREEVIEW)
46 {
47 /* The treeview only contains folders,
48 so the new tab menu item will always
49 be shown. */
50 addNewTabMenuItem = true;
51 }
52
53 if (addNewTabMenuItem)
54 {
55 std::wstring openInNewTabText =
56 ResourceHelper::LoadString(m_hLanguageModule, IDS_GENERAL_OPEN_IN_NEW_TAB);
57
58 MENUITEMINFO mii;
59 mii.cbSize = sizeof(mii);
60 mii.fMask = MIIM_STRING | MIIM_ID;
61 mii.wID = MENU_OPEN_IN_NEW_TAB;
62 mii.dwTypeData = openInNewTabText.data();
63 InsertMenuItem(hMenu, 1, TRUE, &mii);
64 }
65}
66
67BOOL Explorerplusplus::HandleShellMenuItem(PCIDLIST_ABSOLUTE pidlParent,
68 const std::vector<PITEMID_CHILD> &pidlItems, DWORD_PTR dwData, const TCHAR *szCmd)

Callers

nothing calls this directly

Calls 5

GetItemAttributesFunction · 0.85
LoadStringFunction · 0.85
sizeMethod · 0.45
getMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected