From b70243f469c7e1eae4241961c55a0fb060fb3996 Mon Sep 17 00:00:00 2001 From: Ilusion9 <40362576+Ilusion9@users.noreply.github.com> Date: Sat, 4 Mar 2023 20:21:36 +0200 Subject: [PATCH] Add function to find a TopMenu Item --- plugins/include/topmenus.inc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/include/topmenus.inc b/plugins/include/topmenus.inc index abdddc334..e6b986fbc 100644 --- a/plugins/include/topmenus.inc +++ b/plugins/include/topmenus.inc @@ -244,7 +244,14 @@ methodmap TopMenu < Handle // @return TopMenuObject ID on success, or // INVALID_TOPMENUOBJECT on failure. public native TopMenuObject FindCategory(const char[] name); - + + // Finds an item's topobj ID in a TopMenu. + // + // @param name Object's unique name. + // @return TopMenuObject ID on success, or + // INVALID_TOPMENUOBJECT on failure. + public native TopMenuObject FindItem(const char[] name); + // Set the menu title caching behavior of the TopMenu. By default titles // are cached to reduce overhead. If you need dynamic menu titles which // change each time the menu is displayed to a user, set this to false. @@ -441,6 +448,7 @@ public void __ext_topmenus_SetNTVOptional() MarkNativeAsOptional("TopMenu.Display"); MarkNativeAsOptional("TopMenu.DisplayCategory"); MarkNativeAsOptional("TopMenu.FindCategory"); + MarkNativeAsOptional("TopMenu.FindItem"); MarkNativeAsOptional("TopMenu.CacheTitles.set"); } #endif