MCPcopy Create free account
hub / github.com/KDE/kdiff3 / insertMenuItemHelper

Function insertMenuItemHelper

diff_ext_for_kdiff3/diff_ext.cpp:134–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134static int insertMenuItemHelper(HMENU menu, UINT id, UINT position, const tstring& text,
135 UINT fState = MFS_ENABLED, HMENU hSubMenu = nullptr)
136{
137 MENUITEMINFO item_info;
138 ZeroMemory(&item_info, sizeof(item_info));
139 item_info.cbSize = sizeof(MENUITEMINFO);
140 item_info.wID = id;
141 if(text.empty())
142 { // Separator
143 item_info.fMask = MIIM_TYPE;
144 item_info.fType = MFT_SEPARATOR;
145 item_info.dwTypeData = nullptr;
146 }
147 else
148 {
149 item_info.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE | (hSubMenu != nullptr ? MIIM_SUBMENU : 0);
150 item_info.fType = MFT_STRING;
151 item_info.fState = fState;
152 item_info.dwTypeData = (LPTSTR)text.c_str();
153 item_info.hSubMenu = hSubMenu;
154 }
155 if(0 == InsertMenuItem(menu, position, TRUE, &item_info))
156 SYSERRORLOG(TEXT("InsertMenuItem"));
157 return id;
158}
159
160STDMETHODIMP
161DIFF_EXT::QueryContextMenu(HMENU menu, UINT position, UINT first_cmd, UINT /*last_cmd not used*/, UINT flags)

Callers 1

QueryContextMenuMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected