public/IMenuManager.h
changeset 790 9b1474d03470
parent 787 52283fe61d42
child 819 a2f2353049b9
     1.1 --- a/public/IMenuManager.h	Sun May 13 22:36:22 2007 +0000
     1.2 +++ b/public/IMenuManager.h	Mon May 14 04:46:06 2007 +0000
     1.3 @@ -20,6 +20,7 @@
     1.4  #define _INCLUDE_SOURCEMOD_MENU_SYSTEM_H_
     1.5  
     1.6  #include <IShareSys.h>
     1.7 +#include <IHandleSys.h>
     1.8  
     1.9  #define SMINTERFACE_MENUMANAGER_NAME		"IMenuManager"
    1.10  #define SMINTERFACE_MENUMANAGER_VERSION		1
    1.11 @@ -263,9 +264,12 @@
    1.12  		 *
    1.13  		 * Note: the object should be freed using IBaseMenu::Destroy.
    1.14  		 *
    1.15 +		 * @param handler		IMenuHandler pointer.
    1.16 +		 * @param pOwner		Optional IdentityToken_t owner for handle 
    1.17 +		 *						creation.
    1.18  		 * @return				An IBaseMenu pointer.
    1.19  		 */
    1.20 -		virtual IBaseMenu *CreateMenu() =0;
    1.21 +		virtual IBaseMenu *CreateMenu(IMenuHandler *handler, IdentityToken_t *pOwner=NULL) =0;
    1.22  
    1.23  		/**
    1.24  		 * @brief Returns the maximum number of items per page.
    1.25 @@ -293,6 +297,13 @@
    1.26  		 * @return				True if a menu was cancelled, false otherwise.
    1.27  		 */
    1.28  		virtual bool CancelClientMenu(int client, bool autoIgnore=false) =0;
    1.29 +
    1.30 +		/**
    1.31 +		 * @brief Returns a Handle the IMenuStyle object.
    1.32 +		 *
    1.33 +		 * @return				Handle_t pointing to this object.
    1.34 +		 */
    1.35 +		virtual Handle_t GetHandle() =0;
    1.36  	};
    1.37  
    1.38  	/**
    1.39 @@ -428,16 +439,20 @@
    1.40  		 * @brief Sends the menu to a client.
    1.41  		 *
    1.42  		 * @param client		Client index to display to.
    1.43 -		 * @param handler		Menu handler to use.
    1.44  		 * @param time			Time to hold menu for.
    1.45  		 * @return				True on success, false otherwise.
    1.46  		 */
    1.47 -		virtual bool Display(int client, IMenuHandler *handler, unsigned int time) =0;
    1.48 +		virtual bool Display(int client, unsigned int time) =0;
    1.49  
    1.50  		/**
    1.51 -		 * @brief Destroys the menu and frees all associated resources.1
    1.52 +		 * @brief Destroys the menu and frees all associated resources.
    1.53 +		 *
    1.54 +		 * @param releaseHandle	If true, the Handle will be released
    1.55 +		 *						in the destructor.  This should be set
    1.56 +		 *						to true except for IHandleTypeDispatch
    1.57 +		 *						destructors.
    1.58  		 */
    1.59 -		virtual void Destroy() =0;
    1.60 +		virtual void Destroy(bool releaseHandle=true) =0;
    1.61  
    1.62  		/**
    1.63  		 * @brief Cancels the menu on all client's displays.  While the menu is
    1.64 @@ -446,6 +461,14 @@
    1.65  		 * @return				Number of menus cancelled.
    1.66  		 */
    1.67  		virtual void Cancel() =0;
    1.68 +
    1.69 +		/**
    1.70 +		 * @brief Returns the menu's Handle.  The Handle is automatically
    1.71 +		 * removed when the menu is destroyed.
    1.72 +		 *
    1.73 +		 * @return				Handle_t handle value.
    1.74 +		 */
    1.75 +		virtual Handle_t GetHandle() =0;
    1.76  	};
    1.77  
    1.78  	/** 
    1.79 @@ -517,6 +540,15 @@
    1.80  		}
    1.81  
    1.82  		/**
    1.83 +		 * @brief Called when the menu object is destroyed.
    1.84 +		 *
    1.85 +		 * @param menu			Menu pointer.
    1.86 +		 */
    1.87 +		virtual void OnMenuDestroy(IBaseMenu *menu)
    1.88 +		{
    1.89 +		}
    1.90 +
    1.91 +		/**
    1.92  		 * @brief Called when requesting how to render an item.
    1.93  		 *
    1.94  		 * @param menu			Menu pointer.
    1.95 @@ -579,11 +611,11 @@
    1.96  		 */
    1.97  		virtual IMenuStyle *FindStyleByName(const char *name) =0;
    1.98  
    1.99 +#if 0
   1.100  		/**
   1.101  		 * @brief Broadcasts a menu to a number of clients.
   1.102  		 *
   1.103  		 * @param menu			Menu pointer.
   1.104 -		 * @param handler		IMenuHandler pointer.
   1.105  		 * @param clients		Array of client indexes.
   1.106  		 * @param numClients	Number of clients in the array.
   1.107  		 * @param time			Time to hold the menu.
   1.108 @@ -610,6 +642,7 @@
   1.109  									int clients[], 
   1.110  									unsigned int numClients,
   1.111  									unsigned int time) =0;
   1.112 +#endif
   1.113  
   1.114  		/**
   1.115  		 * @brief Returns the default draw style Core is using.