MCPcopy Create free account
hub / github.com/WinMerge/winmerge / ShowMenu

Method ShowMenu

Src/PropertySystemMenu.cpp:89–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89std::optional<String> CPropertySystemMenu::ShowMenu(CWnd* pParentWnd, UINT idFirst, const String& format)
90{
91 std::optional<String> result;
92 CMenu menu;
93 menu.CreatePopupMenu();
94 PropertySystem ps(PropertySystem::VIEWABLE);
95 CreatePropertyMenu(menu.m_hMenu, ps.GetCanonicalNames(), idFirst, format);
96
97 CPoint pt;
98 GetCursorPos(&pt);
99 const int command = menu.TrackPopupMenu(
100 TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, pParentWnd);
101 if (command == 0)
102 {
103 // User cancelled the menu
104 }
105 else
106 {
107 result = ps.GetCanonicalNames()[command - idFirst];
108 }
109
110 DestroyMenu();
111
112 return result;
113}

Callers

nothing calls this directly

Calls 2

CreatePropertyMenuFunction · 0.85
GetCursorPosFunction · 0.85

Tested by

no test coverage detected