plugins/include/menus.inc
author Michael McKoy <ferret99gt@gmail.com>
Thu Aug 09 00:31:45 2007 +0000 (2007-08-09)
changeset 1285 a83f449ab2f8
parent 1271 22f1534f2a61
child 1289 1b9c8a609447
permissions -rw-r--r--
Basevote changes based on testing and BAILOFEEDBACK
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ===============================================================
     6  *
     7  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used 
     8  * or modified under the Terms and Conditions of its License Agreement, which is found 
     9  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins 
    10  * may change at any time.  To view the latest information, see:
    11  *   http://www.sourcemod.net/license.php
    12  *
    13  * Version: $Id$
    14  */
    15  
    16 #if defined _menus_included
    17  #endinput
    18 #endif
    19 #define _menus_included
    20 
    21 /**
    22  * Low-level drawing style of the menu.
    23  */
    24 enum MenuStyle
    25 {
    26 	MenuStyle_Default = 0,		/**< The "default" menu style for the mod */
    27 	MenuStyle_Valve = 1,		/**< The Valve provided menu style (Used on HL2DM) */
    28 	MenuStyle_Radio = 2,		/**< The simpler menu style commonly used on CS:S */
    29 };
    30 
    31 /**
    32  * Different actions for the menu "pump" callback
    33  */
    34 enum MenuAction
    35 {
    36 	MenuAction_Start = (1<<0),		/**< A menu has been started (nothing passed) */
    37 	MenuAction_Display = (1<<1),	/**< A menu is about to be displayed (param1=client, param2=MenuPanel Handle) */
    38 	MenuAction_Select = (1<<2),		/**< An item was selected (param1=client, param2=item) */
    39 	MenuAction_Cancel = (1<<3),		/**< The menu was cancelled (param1=client, param2=reason) */
    40 	MenuAction_End = (1<<4),		/**< A menu display has fully ended (param1=reason, param2=cancel reason) */
    41 	MenuAction_VoteEnd = (1<<5),	/**< (VOTE ONLY): A vote sequence has succeeded (param1=chosen item) 
    42 										 This is not called if SetVoteResultCallback has been used on the menu. */
    43 	MenuAction_VoteStart = (1<<6), 	/**< (VOTE ONLY): A vote sequence has started (nothing passed) */
    44 	MenuAction_VoteCancel = (1<<7),	/**< (VOTE ONLY): A vote sequence has been cancelled (nothing passed) */
    45 	MenuAction_DrawItem = (1<<8),	/**< An item is being drawn; return the new style (param1=client, param2=item) */
    46 	MenuAction_DisplayItem = (1<<9) /**< Item text is being drawn to the display (param1=client, param2=item)
    47 										  To change the text, use RedrawMenuItem().
    48 										  If you do so, return its return value.  Otherwise, return 0.
    49 										  */
    50 };
    51 
    52 /** Default menu actions */
    53 #define MENU_ACTIONS_DEFAULT	MenuAction_Select|MenuAction_Cancel|MenuAction_End
    54 /** All menu actions */
    55 #define MENU_ACTIONS_ALL		-1
    56 
    57 #define MENU_NO_PAGINATION		0		/**< Menu should not be paginated (10 items max) */
    58 #define MENU_TIME_FOREVER		0		/**< Menu should be displayed as long as possible */
    59 
    60 #define ITEMDRAW_DEFAULT		(0)		/**< Item should be drawn normally */
    61 #define ITEMDRAW_DISABLED		(1<<0)	/**< Item is drawn but not selectable */
    62 #define ITEMDRAW_RAWLINE		(1<<1)	/**< Item should be a raw line, without a slot */
    63 #define ITEMDRAW_NOTEXT			(1<<2)	/**< No text should be drawn */
    64 #define ITEMDRAW_SPACER			(1<<3)	/**< Item should be drawn as a spacer, if possible */
    65 #define ITEMDRAW_IGNORE	((1<<1)|(1<<2))	/**< Item should be completely ignored (rawline + notext) */
    66 #define ITEMDRAW_CONTROL		(1<<4)	/**< Item is control text (back/next/exit) */
    67 
    68 #define MENUFLAG_BUTTON_EXIT		(1<<0)	/**< Menu has an "exit" button */
    69 #define MENUFLAG_BUTTON_EXITBACK	(1<<1)	/**< Menu has an "exit back" button */
    70 #define MENUFLAG_NO_SOUND			(1<<2)	/**< Menu will not have any select sounds */
    71 
    72 #define VOTEINFO_CLIENT_INDEX		0		/**< Client index */
    73 #define VOTEINFO_CLIENT_ITEM		1		/**< Item the client selected, or -1 for none */
    74 #define VOTEINFO_ITEM_INDEX			0		/**< Item index */
    75 #define VOTEINFO_ITEM_VOTES			1		/**< Number of votes for the item */
    76 
    77 /**
    78  * Reasons a menu can be cancelled.
    79  */
    80 enum
    81 {
    82 	MenuCancel_Disconnected = -1,	/**< Client dropped from the server */
    83 	MenuCancel_Interrupted = -2,	/**< Client was interrupted with another menu */
    84 	MenuCancel_Exit = -3,			/**< Client exited via "exit" */
    85 	MenuCancel_NoDisplay = -4,		/**< Menu could not be displayed to the client */
    86 	MenuCancel_Timeout = -5,		/**< Menu timed out */
    87 	MenuCancel_ExitBack = -6,		/**< Client selected "exit back" on a paginated menu */
    88 };
    89 
    90 /**
    91  * Reasons a menu ended.
    92  */
    93 enum
    94 {
    95 	MenuEnd_Selected = 0,			/**< Menu item was selected */
    96 	MenuEnd_VotingDone = -1,		/**< Voting finished */
    97 	MenuEnd_VotingCancelled = -2,	/**< Voting was cancelled */
    98 	MenuEnd_Cancelled = -3,			/**< Menu was cancelled (reason in param2) */
    99 	MenuEnd_Exit = -4,				/**< Menu was cleanly exited via "exit" */
   100 	MenuEnd_ExitBack = -5,			/**< Menu was cleanly exited via "back" */
   101 	MenuEnd_NoVotes = -6,			/**< A menu received no votes */
   102 };
   103 
   104 /**
   105  * Describes a menu's source
   106  */
   107 enum MenuSource
   108 {
   109 	MenuSource_None = 0,			/**< No menu is being displayed */	
   110 	MenuSource_External = 1,		/**< External menu */
   111 	MenuSource_Normal = 2,			/**< A basic menu is being displayed */
   112 	MenuSource_RawPanel = 3,		/**< A display is active, but it is not tied to a menu */
   113 };
   114 
   115 /**
   116  * Called when a menu action is completed.
   117  *
   118  * @param menu				The menu being acted upon.
   119  * @param action			The action of the menu.
   120  * @param param1			First action parameter (usually the client).
   121  * @param param2			Second action parameter (usually the item).
   122  * @noreturn
   123  */
   124 functag MenuHandler public(Handle:menu, MenuAction:action, param1, param2);
   125 
   126 /**
   127  * Creates a new, empty menu using the default style.
   128  * 
   129  * @param handler			Function which will receive menu actions.
   130  * @param actions			Optionally set which actions to receive.  Select, 
   131  *							Cancel, and End will always be received regardless
   132  *							of whether they are set or not.  They are also
   133  *							the only default actions.
   134  * @return					A new menu Handle.
   135  */
   136 native Handle:CreateMenu(MenuHandler:handler, MenuAction:actions=MENU_ACTIONS_DEFAULT);
   137 
   138 /**
   139  * Displays a menu to a client.
   140  *
   141  * @param menu				Menu Handle.
   142  * @param client			Client index.
   143  * @param time				Maximum time to leave menu on the screen.
   144  * @return					True on success, false on failure.
   145  * @error					Invalid Handle or client not in game.
   146  */
   147 native bool:DisplayMenu(Handle:menu, client, time);
   148 
   149 /**
   150  * Appends a new item to the end of a menu.
   151  *
   152  * @param menu				Menu Handle.
   153  * @param info				Item information string.
   154  * @param display			Default item display string.
   155  * @param style				Drawing style flags.  Anything other than DEFAULT or 
   156  *							DISABLED will be completely ignored when paginating.
   157  * @return					True on success, false on failure.
   158  * @error					Invalid Handle or item limit reached.
   159  */
   160 native AddMenuItem(Handle:menu, 
   161 					const String:info[], 
   162 					const String:display[], 
   163 					style=ITEMDRAW_DEFAULT);
   164 
   165 /**
   166  * Inserts an item into the menu before a certain position; the new item will
   167  * be at the given position and all next items pushed forward.
   168  *
   169  * @param menu				Menu Handle.
   170  * @param position			Position, starting from 0.
   171  * @param info				Item information string.
   172  * @param display			Default item display string.
   173  * @param style				Drawing style flags.  Anything other than DEFAULT or 
   174  *							DISABLED will be completely ignored when paginating.
   175  * @return					True on success, false on failure.
   176  * @error					Invalid Handle or menu position.
   177  */
   178 native bool:InsertMenuItem(Handle:menu,
   179 						position, 
   180 						const String:info[], 
   181 						const String:display[], 
   182 						style=ITEMDRAW_DEFAULT);
   183 
   184 /**
   185  * Removes an item from the menu.
   186  *
   187  * @param menu				Menu Handle.
   188  * @param position			Position, starting from 0.
   189  * @return					True on success, false on failure.
   190  * @error					Invalid Handle or menu position.
   191  */
   192 native bool:RemoveMenuItem(Handle:menu, position);
   193 
   194 /**
   195  * Removes all items from a menu.
   196  *
   197  * @param menu				Menu Handle.
   198  * @noreturn
   199  * @error					Invalid Handle or menu position.
   200  */
   201 native RemoveAllMenuItems(Handle:menu);
   202 
   203 /**
   204  * Retrieves information about a menu item.
   205  *
   206  * @param menu				Menu Handle.
   207  * @param position			Position, starting from 0.
   208  * @param infoBuf			Info buffer.
   209  * @param infoBufLen		Maximum length of the info buffer.
   210  * @param style				By-reference variable to store drawing flags.
   211  * @param dispBuf			Display buffer.
   212  * @param dispBufLen		Maximum length of the display buffer.
   213  * @return					True on success, false if position is invalid.
   214  * @error					Invalid Handle.
   215  */
   216 native bool:GetMenuItem(Handle:menu, position, String:infoBuf[], infoBufLen, &style=0, String:dispBuf[]="", dispBufLen=0);
   217 
   218 /**
   219  * Returns the number of items in a menu.
   220  *
   221  * @param menu				Menu Handle.
   222  * @return					Number of items in the menu.
   223  * @error					Invalid Handle.
   224  */
   225 native GetMenuItemCount(Handle:menu);
   226 
   227 /**
   228  * Sets whether the menu should be paginated or not.
   229  *
   230  * @param menu				Handle to the menu.
   231  * @param itemsPerPage		Number of items per page, or MENU_NO_PAGINATION.
   232  * @return					True on success, false if pagination is too high or low.
   233  * @error					Invalid Handle.
   234  */
   235 native bool:SetMenuPagination(Handle:menu, itemsPerPage);
   236 
   237 /**
   238  * Returns a menu's pagination setting.
   239  *
   240  * @param menu				Handle to the menu.
   241  * @return					Pagination setting.
   242  * @error					Invalid Handle.
   243  */
   244 native GetMenuPagination(Handle:menu);
   245 
   246 /**
   247  * Returns a menu's MenuStyle Handle.  The Handle
   248  * is global and cannot be freed.
   249  *
   250  * @param menu				Handle to the menu.
   251  * @return 					Handle to the menu's draw style.
   252  * @error					Invalid Handle.
   253  */
   254 native Handle:GetMenuStyle(Handle:menu);
   255 
   256 /**
   257  * Sets the menu's default title/instruction message.
   258  *
   259  * @param menu				Menu Handle.
   260  * @param fmt				Message string format
   261  * @param ...				Message string arguments.
   262  * @noreturn
   263  * @error					Invalid Handle.
   264  */
   265 native SetMenuTitle(Handle:menu, const String:fmt[], any:...);
   266 
   267 /**
   268  * Creates a raw MenuPanel based off the menu's style.
   269  * The Handle must be freed with CloseHandle().
   270  *
   271  * @return					A new MenuPanel Handle.
   272  * @error					Invalid Handle.
   273  */
   274 native Handle:CreatePanelFromMenu(Handle:menu);
   275 
   276 /**
   277  * Returns whether or not the menu has an exit button.
   278  * By default, menus have an exit button.
   279  *
   280  * @param menu				Menu Handle.
   281  * @return 					True if the menu has an exit button; false otherwise.
   282  * @error					Invalid Handle.
   283  */
   284 native bool:GetMenuExitButton(Handle:menu);
   285 
   286 /**
   287  * Sets whether or not the menu has an exit button.
   288  * By default, menus have an exit button.
   289  *
   290  * @param menu				Menu Handle.
   291  * @param button			True to enable the button, false to remove it.
   292  * @return 					True if allowed; false on failure.
   293  * @error					Invalid Handle.
   294  */
   295 native bool:SetMenuExitButton(Handle:menu, bool:button);
   296 
   297 /**
   298  * Returns whether or not the menu has an "exit back" button.
   299  * By default, menus do not have an exit back button.
   300  * Exit Back buttons appear as "Back" on page 1 of paginated menus and
   301  * have functionality defined by the user in MenuEnd_ExitBack.
   302  *
   303  * @param menu				Menu Handle.
   304  * @return 					True if the menu has an exit back button; false otherwise.
   305  * @error					Invalid Handle.
   306  */
   307 native bool:GetMenuExitBackButton(Handle:menu);
   308 
   309 /**
   310  * Sets whether or not the menu has an "exit back" button.
   311  * By default, menus do not have an exit back button.
   312  * Exit Back buttons appear as "Back" on page 1 of paginated menus and
   313  * have functionality defined by the user in MenuEnd_ExitBack.
   314  *
   315  * @param menu				Menu Handle.
   316  * @param button			True to enable the button, false to remove it.
   317  * @error					Invalid Handle.
   318  */
   319 native SetMenuExitBackButton(Handle:menu, bool:button);
   320 
   321 
   322 /**
   323  * Cancels a menu from displaying on all clients.  While the
   324  * cancellation is in progress, this menu cannot be re-displayed
   325  * to any clients.
   326  *
   327  * The menu may still exist on the client's screen after this command.
   328  * This simply verifies that the menu is not being used anywhere.
   329  *
   330  * If any vote is in progress on a menu, it will be cancelled.
   331  *
   332  * @param menu				Menu Handle.
   333  * @noreturn
   334  * @error					Invalid Handle.
   335  */
   336 native CancelMenu(Handle:menu);
   337 
   338 /**
   339  * Retrieves a menu's option flags.
   340  *
   341  * @param menu				Menu Handle.
   342  * @return					A bitstring of MENUFLAG bits.
   343  * @error					Invalid Handle.
   344  */
   345 native GetMenuOptionFlags(Handle:menu);
   346 
   347 /**
   348  * Sets a menu's option flags.
   349  *
   350  * If a certain bit is not supported, it will be stripped before
   351  * being set.
   352  *
   353  * @param menu				Menu Handle.
   354  * @param flags				A new bitstring of MENUFLAG bits.
   355  * @noreturn
   356  * @error					Invalid Handle.
   357  */
   358 native SetMenuOptionFlags(Handle:menu, flags);
   359 
   360 /**
   361  * Returns whether a vote is in progress.
   362  *
   363  * @param menu				Deprecated; no longer used.
   364  * @return					True if a vote is in progress, false otherwise.
   365  */
   366 native bool:IsVoteInProgress(Handle:menu=INVALID_HANDLE);
   367 
   368 /**
   369  * Cancels the vote in progress.
   370  *
   371  * @noreturn
   372  * @error					If no vote is in progress.
   373  */
   374 native CancelVote();
   375 
   376 /**
   377  * Broadcasts a menu to a list of clients.  The most selected item will be 
   378  * returned through MenuAction_End.  On a tie, a random item will be returned 
   379  * from a list of the tied items.
   380  *
   381  * Note that MenuAction_VoteEnd and MenuAction_VoteStart are both
   382  * default callbacks and do not need to be enabled.
   383  *
   384  * @param menu				Menu Handle.
   385  * @param clients			Array of clients to broadcast to.
   386  * @param numClients		Number of clients in the array.
   387  * @param time				Maximum time to leave menu on the screen.
   388  * @return					True on success, false if this menu already has a vote session
   389  *							in progress.
   390  * @error					Invalid Handle, or a vote is already in progress.
   391  */
   392 native bool:VoteMenu(Handle:menu, clients[], numClients, time);
   393 
   394 /**
   395  * Sends a vote menu to all clients.  See VoteMenu() for more information.
   396  *
   397  * @param menu				Menu Handle.
   398  * @param time				Maximum time to leave menu on the screen.
   399  * @return					True on success, false if this menu already has a vote session
   400  *							in progress.
   401  * @error					Invalid Handle.
   402  */
   403 stock VoteMenuToAll(Handle:menu, time)
   404 {
   405 	new num = GetMaxClients();
   406 	new total;
   407 	decl players[num];
   408 	
   409 	for (new i=1; i<=num; i++)
   410 	{
   411 		if (!IsClientInGame(i))
   412 		{
   413 			continue;
   414 		}
   415 		players[total++] = i;
   416 	}
   417 	
   418 	return VoteMenu(menu, players, total, time);
   419 }
   420 /**
   421  * Callback for when a vote has ended and results are available.
   422  *
   423  * @param menu				The menu being voted on.
   424  * @param num_votes			Number of votes tallied in total.
   425  * @param num_clients		Number of clients who could vote.
   426  * @param client_info		Array of clients.  Use VOTEINFO_CLIENT_ defines.
   427  * @param num_items			Number of unique items that were selected.
   428  * @param item_info			Array of items, sorted by count.  Use VOTEINFO_ITEM
   429  *							defines.
   430  * @noreturn
   431  */
   432 functag VoteHandler public(Handle:menu,
   433 						   num_votes, 
   434 						   num_clients,
   435 						   const client_info[][2], 
   436 						   num_items,
   437 						   const item_info[][2]);	   
   438 
   439 /**
   440  * Sets an advanced vote handling callback.  If this callback is set,
   441  * MenuAction_VoteEnd will not be called.
   442  *
   443  * @param menu				Menu Handle.
   444  * @param callback			Callback function.
   445  * @noreturn
   446  * @error					Invalid Handle or callback.
   447  */
   448 native SetVoteResultCallback(Handle:menu, VoteHandler:callback);
   449 
   450 /**
   451  * Returns a style's global Handle.
   452  *
   453  * @param style			Menu Style.
   454  * @return				A Handle, or INVALID_HANDLE if not found or unusable.
   455  */
   456 native Handle:GetMenuStyleHandle(MenuStyle:style);
   457 
   458 /**
   459  * Creates a MenuPanel from a MenuStyle.  Panels are used for drawing raw 
   460  * menus without any extra helper functions.  The Handle must be closed
   461  * with CloseHandle().
   462  *
   463  * @param hStyle		MenuStyle Handle, or INVALID_HANDLE to use the default style.
   464  * @return				A new MenuPanel Handle.
   465  * @error				Invalid Handle other than INVALID_HANDLE.
   466  */
   467 native Handle:CreatePanel(Handle:hStyle=INVALID_HANDLE);
   468 
   469 /** 
   470  * Creates a Menu from a MenuStyle.  The Handle must be closed with 
   471  * CloseHandle().
   472  *
   473  * @parma hStyle		MenuStyle Handle, or INVALID_HANDLE to use the default style.
   474  * @param handler		Function which will receive menu actions.
   475  * @param actions		Optionally set which actions to receive.  Select, 
   476  *						Cancel, and End will always be received regardless
   477  *						of whether they are set or not.  They are also
   478  *						the only default actions.
   479  * @return				A new menu Handle.
   480  * @error				Invalid Handle other than INVALID_HANDLE.
   481  */
   482 native Handle:CreateMenuEx(Handle:hStyle=INVALID_HANDLE, MenuHandler:handler, MenuAction:actions=MENU_ACTIONS_DEFAULT);
   483 
   484 /**
   485  * Returns whether a client is viewing a menu.  If the menu source 
   486  * is MenuSource_Normal, a menu Handle will also be returned.
   487  *
   488  * @param client		Client index.
   489  * @param hStyle		MenuStyle Handle, or INVALID_HANDLE to use the default style.
   490  * @return				A MenuSource value.
   491  * @error				Invalid Handle other than INVALID_HANDLE.
   492  */
   493 native MenuSource:GetClientMenu(client, Handle:hStyle=INVALID_HANDLE);
   494 
   495 /** 
   496  * Cancels a menu on a client.  This will only affect non-external menus.
   497  *
   498  * @param hstyle		MenuStyle Handle, or INVALID_HANDLE to use the default style.
   499  * @param client		Client index.
   500  * @param autoIgnore	If true, no menus can be re-drawn on the client during
   501  *						the cancellation process.
   502  * @return				True if a menu was cancelled, false otherwise.
   503  */
   504 native bool:CancelClientMenu(client, bool:autoIgnore=false, Handle:hStyle=INVALID_HANDLE);
   505 
   506 /**
   507  * Returns a style's maximum items per page.
   508  *
   509  * @param hStyle		MenuStyle Handle, or INVALID_HANDLE to use the default style.
   510  * @return				Maximum items per page.
   511  * @error				Invalid Handle other than INVALID_HANDLE.
   512  */
   513 native GetMaxPageItems(Handle:hStyle=INVALID_HANDLE);
   514 
   515 /**
   516  * Returns a MenuPanel's parent style.
   517  *
   518  * @param panel			A MenuPanel Handle.
   519  * @return				The MenuStyle Handle that created the panel.
   520  * @error				Invalid Handle.
   521  */
   522 native Handle:GetPanelStyle(Handle:panel);
   523 
   524 /**
   525  * Sets the panel's title.
   526  *
   527  * @param panel			A MenuPanel Handle.
   528  * @param title			Text to set as the title.
   529  * @param onlyIfEmpty	If true, the title will only be set if no title is set.
   530  * @noreturn
   531  * @error				Invalid Handle.
   532  */
   533 native Handle:SetPanelTitle(Handle:panel, const String:text[], bool:onlyIfEmpty=false);
   534 
   535 /**
   536  * Draws an item on a panel.  If the item takes up a slot, the position
   537  * is returned.
   538  *
   539  * @param panel			A MenuPanel Handle.
   540  * @param text			Display text to use.  If not a raw line, 
   541  *						the style may automatically add color markup.
   542  *						No numbering or newlines are needed.
   543  * @param style			ITEMDRAW style flags.
   544  * @return				A slot position, or 0 if item was a rawline or could not be drawn.
   545  * @error				Invalid Handle.
   546  */
   547 native DrawPanelItem(Handle:panel, const String:text[], style=ITEMDRAW_DEFAULT);
   548 
   549 /**
   550  * Draws a raw line of text on a panel, without any markup other than a newline.
   551  *
   552  * @param panel			A MenuPanel Handle, or INVALID_HANDLE if inside a 
   553  *						MenuAction_DisplayItem callback.
   554  * @param text			Display text to use.
   555  * @return				True on success, false if raw lines are not supported.
   556  * @error				Invalid Handle.
   557  */
   558 native DrawPanelText(Handle:panel, const String:text[]);
   559 
   560 /**
   561  * Returns whether or not the given drawing flags are supported by
   562  * the menu style.
   563  *
   564  * @param panel			A MenuPanel Handle.
   565  * @param style			ITEMDRAW style flags.
   566  * @return				True if item is drawable, false otherwise.
   567  * @error				Invalid Handle.
   568  */
   569 native CanPanelDrawFlags(Handle:panel, style);
   570 
   571 /**
   572  * Sets the selectable key map of a panel.  This is not supported by
   573  * all styles (only by Radio, as of this writing).  
   574  *
   575  * @param keys			An integer where each bit N allows key
   576  *						N+1 to be selected.  If no keys are selectable,
   577  *						then key 0 (bit 9) is automatically set.
   578  * @return 				True if supported, false otherwise.
   579  */
   580 native bool:SetPanelKeys(Handle:panel, keys);
   581 
   582 /**
   583  * Sends a panel to a client.  Unlike full menus, the handler
   584  * function will only receive the following actions, both of 
   585  * which will have INVALID_HANDLE for a menu, and the client
   586  * as param1.
   587  *
   588  * MenuAction_Select (param2 will be the key pressed)
   589  * MenuAction_Cancel (param2 will be the reason)
   590  *
   591  * Also, if the menu fails to display, no callbacks will be called.
   592  *
   593  * @param panel			A MenuPanel Handle.
   594  * @param client		A client to draw to.
   595  * @param handler		The MenuHandler function to catch actions with.
   596  * @param time			Time to hold the menu for.
   597  * @return				True on success, false on failure.
   598  * @error				Invalid Handle.
   599  */
   600 native bool:SendPanelToClient(Handle:panel, client, MenuHandler:handler, time);
   601 
   602 /**
   603  * @brief Returns the current key position.
   604  *
   605  * @param panel			A MenuPanel Handle.
   606  * @return				Current key position starting at 1.
   607  * @error				Invalid Handle.
   608  */
   609 native GetPanelCurrentKey(Handle:panel);
   610 
   611 /**
   612  * @brief Sets the next key position.  This cannot be used
   613  * to traverse backwards.
   614  *
   615  * @param panel			A MenuPanel Handle.
   616  * @param key			Key that is greater or equal to
   617  *						GetPanelCurrentKey().
   618  * @return				True on success, false otherwise.
   619  * @error				Invalid Handle.
   620  */
   621 native bool:SetPanelCurrentKey(Handle:panel, key);
   622 
   623 /**
   624  * @brief Redraws menu text from inside a MenuAction_DisplayItem callback.
   625  * 
   626  * @param text			Menu text to draw.
   627  * @return				Item position; must be returned via the callback.
   628  */
   629 native RedrawMenuItem(const String:text[]);
   630 
   631 /**
   632  * Retrieves voting information from MenuAction_VoteEnd.
   633  *
   634  * @param param2		Second parameter of MenuAction_VoteEnd.
   635  * @param winningVotes	Number of votes received by the winning option.
   636  * @param totalVotes	Number of total votes received.
   637  * @noreturn
   638  */
   639 stock GetMenuVoteInfo(param2, &winningVotes, &totalVotes)
   640 {
   641 	winningVotes = param2 & 0xFFFF;
   642 	totalVotes = param2 >> 16;
   643 }