| 351 | static HMENU dspellcheck_menu_cached = nullptr; |
| 352 | |
| 353 | HMENU get_this_plugin_menu() { |
| 354 | if (dspellcheck_menu_cached) |
| 355 | return dspellcheck_menu_cached; |
| 356 | HMENU plugins_menu = npp->get_menu_handle(NPPPLUGINMENU); |
| 357 | HMENU dspellcheck_menu = nullptr; |
| 358 | int count = GetMenuItemCount(plugins_menu); |
| 359 | for (int i = 0; i < count; i++) { |
| 360 | auto str = get_menu_item_text(plugins_menu, i); |
| 361 | if (str == getName()) { |
| 362 | MENUITEMINFO mif; |
| 363 | mif.fMask = MIIM_SUBMENU; |
| 364 | mif.cbSize = sizeof(MENUITEMINFO); |
| 365 | bool res = GetMenuItemInfo(plugins_menu, i, TRUE, &mif) != FALSE; |
| 366 | |
| 367 | if (res) |
| 368 | dspellcheck_menu = mif.hSubMenu; |
| 369 | break; |
| 370 | } |
| 371 | } |
| 372 | return dspellcheck_menu_cached = dspellcheck_menu; |
| 373 | } |
| 374 | |
| 375 | HMENU get_submenu(int item_id) { |
| 376 | auto dspellcheck_menu = get_this_plugin_menu(); |
no test coverage detected