Changeset 720
- Timestamp:
- 12/6/2008 1:04:51 AM (4 years ago)
- Location:
- branches/eraser6/ShellExt
- Files:
-
- 2 edited
-
CtxMenu.cpp (modified) (15 diffs)
-
CtxMenu.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/ShellExt/CtxMenu.cpp
r719 r720 84 84 85 85 namespace Eraser { 86 const wchar_t* CCtxMenu:: m_szMenuTitle = L"Eraser";86 const wchar_t* CCtxMenu::MenuTitle = L"Eraser"; 87 87 88 88 HRESULT CCtxMenu::Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, … … 90 90 { 91 91 //Initialise member variables. 92 m_itemID = 0;92 MenuID = 0; 93 93 94 94 //Determine where the shell extension was invoked from. … … 113 113 return E_FAIL; 114 114 115 m_szDestinationDirectory = dropTargetPath;115 DragDropDestinationDirectory = dropTargetPath; 116 116 } 117 117 … … 154 154 } 155 155 156 m_szSelectedFiles.push_back(std::wstring(buffer, charsWritten));156 SelectedFiles.push_back(std::wstring(buffer, charsWritten)); 157 157 } 158 158 … … 199 199 { 200 200 std::auto_ptr<MENUITEMINFO> separator(GetSeparator()); 201 InsertMenuItem(hSubmenu, 0, FALSE, separator );201 InsertMenuItem(hSubmenu, 0, FALSE, separator.get()); 202 202 } 203 203 … … 212 212 mii.fMask = MIIM_SUBMENU | MIIM_STRING | MIIM_ID; 213 213 mii.hSubMenu = hSubmenu; 214 mii.dwTypeData = const_cast<wchar_t*>( m_szMenuTitle);214 mii.dwTypeData = const_cast<wchar_t*>(MenuTitle); 215 215 216 216 //Set the bitmap for the registered item. Vista machines will be set using a DIB, … … 226 226 mii.hbmpUnchecked = GetMenuBitmap(); 227 227 } 228 else 228 else if (InvokeReason != INVOKEREASON_DRAGDROP) 229 229 { 230 230 mii.fMask |= MIIM_FTYPE; … … 232 232 } 233 233 234 m_itemID = uMenuIndex++;235 InsertMenuItem(hmenu, m_itemID, TRUE, &mii);234 MenuID = uMenuIndex++; 235 InsertMenuItem(hmenu, MenuID, TRUE, &mii); 236 236 } 237 237 … … 254 254 { 255 255 MEASUREITEMSTRUCT* mis = reinterpret_cast<MEASUREITEMSTRUCT*>(lParam); 256 if (mis->CtlID == m_itemID)256 if (mis->CtlID == MenuID) 257 257 handleResult = OnMeasureItem(mis->itemWidth, mis->itemHeight); 258 258 else … … 264 264 { 265 265 DRAWITEMSTRUCT* dis = reinterpret_cast<DRAWITEMSTRUCT*>(lParam); 266 if (dis->CtlID == m_itemID)266 if (dis->CtlID == MenuID) 267 267 handleResult = OnDrawItem(dis->hDC, dis->rcItem, dis->itemAction, dis->itemState); 268 268 else … … 287 287 SelectObject(screenDC, font); 288 288 SIZE textSize; 289 if (!GetTextExtentPoint32(screenDC, m_szMenuTitle, static_cast<DWORD>(wcslen(m_szMenuTitle)), &textSize))289 if (!GetTextExtentPoint32(screenDC, MenuTitle, static_cast<DWORD>(wcslen(MenuTitle)), &textSize)) 290 290 return false; 291 291 … … 334 334 335 335 SIZE textSize; 336 if (!GetTextExtentPoint32(hdc, m_szMenuTitle, static_cast<DWORD>(wcslen(m_szMenuTitle)), &textSize))336 if (!GetTextExtentPoint32(hdc, MenuTitle, static_cast<DWORD>(wcslen(MenuTitle)), &textSize)) 337 337 return false; 338 338 … … 342 342 if (state & ODS_NOACCEL) 343 343 flags |= DSS_HIDEPREFIX; 344 ::DrawState(hdc, NULL, NULL, reinterpret_cast<LPARAM>( m_szMenuTitle), wcslen(m_szMenuTitle),344 ::DrawState(hdc, NULL, NULL, reinterpret_cast<LPARAM>(MenuTitle), wcslen(MenuTitle), 345 345 rect.left, rect.top + (rect.bottom - rect.top - textSize.cy) / 2, textSize.cx, textSize.cy, flags); 346 346 SetTextColor(hdc, oldColour); … … 431 431 432 432 //Add every item selected onto the command line. 433 for (string_list::const_iterator i = m_szSelectedFiles.begin();434 i != m_szSelectedFiles.end(); ++i)433 for (string_list::const_iterator i = SelectedFiles.begin(); 434 i != SelectedFiles.end(); ++i) 435 435 { 436 436 //Check if the current item is a file or folder. … … 564 564 565 565 //Remove actions that don't apply to the current invocation reason. 566 for (std::list<std::wstring>::const_iterator i = m_szSelectedFiles.begin();567 i != m_szSelectedFiles.end(); ++i)566 for (std::list<std::wstring>::const_iterator i = SelectedFiles.begin(); 567 i != SelectedFiles.end(); ++i) 568 568 { 569 569 //Remove trailing slashes if they are directories. -
branches/eraser6/ShellExt/CtxMenu.h
r716 r720 90 90 91 91 protected: 92 InvokeReasons InvokeReason;92 static const wchar_t* MenuTitle; 93 93 94 UINT m_itemID; 95 string_list m_szSelectedFiles; 96 string_type m_szDestinationDirectory; 97 std::vector<Actions> VerbMenuIndices; 98 99 static const wchar_t* m_szMenuTitle; 94 InvokeReasons InvokeReason; 95 UINT MenuID; 96 std::wstring DragDropDestinationDirectory; 97 std::list<std::wstring> SelectedFiles; 98 std::vector<Actions> VerbMenuIndices; 100 99 101 100 public:
Note: See TracChangeset
for help on using the changeset viewer.
