plugins/include/topmenus.inc
changeset 1496 4145ca042242
parent 1495 5e85546abc33
child 1514 3fa3eea32eba
     1.1 --- a/plugins/include/topmenus.inc	Wed Sep 26 20:34:50 2007 +0000
     1.2 +++ b/plugins/include/topmenus.inc	Wed Sep 26 21:44:12 2007 +0000
     1.3 @@ -45,7 +45,7 @@
     1.4  	/**
     1.5  	 * An option is being drawn for a menu (or for sorting purposes).
     1.6  	 *
     1.7 -	 * INPUT : TopMenu Handle, (param1) Client index, (param2) object ID.
     1.8 +	 * INPUT : TopMenu Handle, object ID, client index in extra parameter.
     1.9  	 * OUTPUT: Buffer for rendering, maxlength of buffer.
    1.10  	 * OUTPUT: Must return an ITEMDRAW constant.
    1.11  	 */
    1.12 @@ -54,9 +54,10 @@
    1.13  	/**
    1.14  	 * The title of a menu is being drawn for a given object.
    1.15  	 *
    1.16 -	 * Note: The Object ID will be 0 if drawing the root title.
    1.17 +	 * Note: The Object ID will be INVALID_TOPMENUOBJECT if drawing the 
    1.18 +	 * root title.  Otherwise, the Object ID is a category.
    1.19  	 *
    1.20 -	 * INPUT : TopMenu Handle, (param1) Client index, (param2) object ID.
    1.21 +	 * INPUT : TopMenu Handle, object ID, client index in extra parameter.
    1.22  	 * OUTPUT: Buffer for rendering, maxlength of buffer.
    1.23  	 */
    1.24  	TopMenuAction_DrawTitle = 1,
    1.25 @@ -64,7 +65,9 @@
    1.26  	/**
    1.27  	 * A menu option has been selected.
    1.28  	 *
    1.29 -	 * INPUT : TopMenu Handle, (param1) Client index, (param2) object ID.
    1.30 +	 * The Object ID will always be an item (not a category).
    1.31 +	 *
    1.32 +	 * INPUT : TopMenu Handle, object ID, client index in extra parameter.
    1.33  	 */
    1.34  	TopMenuAction_SelectOption = 2,
    1.35  };
    1.36 @@ -79,6 +82,16 @@
    1.37  };
    1.38  
    1.39  /**
    1.40 + * Top menu starting positions for display.
    1.41 + */
    1.42 +enum TopMenuPosition
    1.43 +{
    1.44 +	TopMenuPosition_Start = 0,			/**< Start/root of the menu */
    1.45 +	TopMenuPosition_LastRoot = 1,		/**< Last position in the root menu */
    1.46 +	TopMenuPosition_LastCategory = 3,	/**< Last position in their last category */
    1.47 +};
    1.48 +
    1.49 +/**
    1.50   * Top menu object tag for type checking.
    1.51   */
    1.52  enum TopMenuObject
    1.53 @@ -91,16 +104,16 @@
    1.54   *
    1.55   * @param topmenu			Handle to the TopMenu.
    1.56   * @param action			TopMenuAction being performed.
    1.57 - * @param param1			First parameter (dependent on action).
    1.58 - * @param param2			Second parameter (dependent on action).
    1.59 - * @param buffer			Output buffer (not always used).
    1.60 - * @param maxlength			Output buffer (not always used).
    1.61 + * @param object_id			The object ID (if used).
    1.62 + * @param param				Extra parameter (if used).
    1.63 + * @param buffer			Output buffer (if used).
    1.64 + * @param maxlength			Output buffer (if used).
    1.65   * @noreturn
    1.66   */
    1.67  functag TopMenuHandler public(Handle:topmenu, 
    1.68  							  TopMenuAction:action,
    1.69 -							  param1,
    1.70 -							  param2,
    1.71 +							  TopMenuObject:object_id,
    1.72 +							  param,
    1.73  							  String:buffer[],
    1.74  							  maxlength);
    1.75  
    1.76 @@ -161,9 +174,9 @@
    1.77  								  const String:name[],
    1.78  								  TopMenuObjectType:type,
    1.79  								  TopMenuHandler:handler,
    1.80 -								  const String:cmdname[],
    1.81 -								  flags,
    1.82 -								  TopMenuObject:parent);
    1.83 +								  TopMenuObject:parent,
    1.84 +								  const String:cmdname[]="",
    1.85 +								  flags=0);
    1.86  
    1.87  /**
    1.88   * Removes an object from a TopMenu.
    1.89 @@ -179,6 +192,17 @@
    1.90  native RemoveFromTopMenu(Handle:topmenu, TopMenuObject:object);
    1.91  
    1.92  /**
    1.93 + * Displays a TopMenu to a client.
    1.94 + *
    1.95 + * @param topmenu			TopMenu Handle.
    1.96 + * @param client			Client index.
    1.97 + * @param position			Position to display from.
    1.98 + * @return					True on success, false on failure.
    1.99 + * @error					Invalid TopMenu Handle or client not in game.
   1.100 + */
   1.101 +native DisplayTopMenu(Handle:topmenu, client, TopMenuPosition:position);
   1.102 +
   1.103 +/**
   1.104   * Finds a category's object ID in a TopMenu.
   1.105   *
   1.106   * @param topmenu			TopMenu Handle.
   1.107 @@ -188,3 +212,23 @@
   1.108   * @error					Invalid TopMenu Handle.
   1.109   */
   1.110  native TopMenuObject:FindTopMenuCategory(Handle:topmenu, const String:name[]);
   1.111 +
   1.112 +/**
   1.113 + * Do not edit below this line!
   1.114 + */
   1.115 +public Extension:__ext_cstrike = 
   1.116 +{
   1.117 +	name = "TopMenus",
   1.118 +	file = "topmenus.ext",
   1.119 +#if defined AUTOLOAD_EXTENSIONS
   1.120 +	autoload = 1,
   1.121 +#else
   1.122 +	autoload = 0,
   1.123 +#endif
   1.124 +#if defined REQUIRE_EXTENSIONS
   1.125 +	required = 1,
   1.126 +#else
   1.127 +	required = 0,
   1.128 +#endif
   1.129 +};
   1.130 +