mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-22 21:34:58 +02:00
[BUG_FIXED] Fix context menu does not "check" items that should be "checked".
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1178 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
63626f65c1
commit
53b81b3186
@ -1243,15 +1243,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
::GetCursorPos(&p);
|
::GetCursorPos(&p);
|
||||||
ContextMenu scintillaContextmenu;
|
ContextMenu scintillaContextmenu;
|
||||||
vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems();
|
vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems();
|
||||||
vector<bool> isEnable;
|
scintillaContextmenu.create(_pPublicInterface->getHSelf(), tmp, _mainMenuHandle);
|
||||||
for (size_t i = 0, len = tmp.size(); i < len ; ++i)
|
|
||||||
{
|
|
||||||
isEnable.push_back((::GetMenuState(_mainMenuHandle, tmp[i]._cmdID, MF_BYCOMMAND)&MF_DISABLED) == 0);
|
|
||||||
}
|
|
||||||
scintillaContextmenu.create(_pPublicInterface->getHSelf(), tmp);
|
|
||||||
for (size_t i = 0, len = isEnable.size(); i < len ; ++i)
|
|
||||||
scintillaContextmenu.enableItem(tmp[i]._cmdID, isEnable[i]);
|
|
||||||
|
|
||||||
scintillaContextmenu.display(p);
|
scintillaContextmenu.display(p);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
vector<MenuItemUnit> itemUnitArray;
|
vector<MenuItemUnit> itemUnitArray;
|
||||||
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, goToView));
|
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, goToView));
|
||||||
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, cloneToView));
|
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, cloneToView));
|
||||||
_tabPopupDropMenu.create(_pPublicInterface->getHSelf(), itemUnitArray);
|
_tabPopupDropMenu.create(_pPublicInterface->getHSelf(), itemUnitArray, _mainMenuHandle);
|
||||||
_nativeLangSpeaker.changeLangTabDrapContextMenu(_tabPopupDropMenu.getMenuHandle());
|
_nativeLangSpeaker.changeLangTabDrapContextMenu(_tabPopupDropMenu.getMenuHandle());
|
||||||
}
|
}
|
||||||
_tabPopupDropMenu.display(p);
|
_tabPopupDropMenu.display(p);
|
||||||
|
@ -52,7 +52,7 @@ ContextMenu::~ContextMenu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextMenu::create(HWND hParent, const vector<MenuItemUnit> & menuItemArray)
|
void ContextMenu::create(HWND hParent, const vector<MenuItemUnit> & menuItemArray, const HMENU mainMenuHandle)
|
||||||
{
|
{
|
||||||
_hParent = hParent;
|
_hParent = hParent;
|
||||||
_hMenu = ::CreatePopupMenu();
|
_hMenu = ::CreatePopupMenu();
|
||||||
@ -107,6 +107,18 @@ void ContextMenu::create(HWND hParent, const vector<MenuItemUnit> & menuItemArra
|
|||||||
{
|
{
|
||||||
lastIsSep = true;
|
lastIsSep = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (mainMenuHandle)
|
||||||
|
{
|
||||||
|
bool isEnabled = (::GetMenuState(mainMenuHandle, item._cmdID, MF_BYCOMMAND)&(MF_DISABLED|MF_GRAYED)) == 0;
|
||||||
|
bool isChecked = (::GetMenuState(mainMenuHandle, item._cmdID, MF_BYCOMMAND)&(MF_CHECKED)) != 0;
|
||||||
|
if (!isEnabled)
|
||||||
|
enableItem(item._cmdID, isEnabled);
|
||||||
|
if (isChecked)
|
||||||
|
checkItem(item._cmdID, isChecked);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ public:
|
|||||||
ContextMenu() : _hParent(NULL), _hMenu(NULL) {};
|
ContextMenu() : _hParent(NULL), _hMenu(NULL) {};
|
||||||
~ContextMenu();
|
~ContextMenu();
|
||||||
|
|
||||||
void create(HWND hParent, const vector<MenuItemUnit> & menuItemArray);
|
void create(HWND hParent, const vector<MenuItemUnit> & menuItemArray, const HMENU mainMenuHandle = NULL);
|
||||||
bool isCreated() const {return _hMenu != NULL;};
|
bool isCreated() const {return _hMenu != NULL;};
|
||||||
|
|
||||||
void display(const POINT & p) const {
|
void display(const POINT & p) const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user