public/IRootConsoleMenu.h
author David Anderson <dvander@alliedmods.net>
Mon May 26 07:52:27 2008 +0000 (2008-05-26)
changeset 2088 c84cd855ca10
parent 1952 b7aa2b626807
child 2289 44045ead61cd
permissions -rw-r--r--
committed two forgotten files and updated the linux makefile
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod
     5  * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
     6  * =============================================================================
     7  *
     8  * This program is free software; you can redistribute it and/or modify it under
     9  * the terms of the GNU General Public License, version 3.0, as published by the
    10  * Free Software Foundation.
    11  * 
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program.  If not, see <http://www.gnu.org/licenses/>.
    19  *
    20  * As a special exception, AlliedModders LLC gives you permission to link the
    21  * code of this program (as well as its derivative works) to "Half-Life 2," the
    22  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    23  * by the Valve Corporation.  You must obey the GNU General Public License in
    24  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    25  * this exception to all derivative works.  AlliedModders LLC defines further
    26  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    27  * or <http://www.sourcemod.net/license.php>.
    28  *
    29  * Version: $Id$
    30  */
    31 
    32 #ifndef _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
    33 #define _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
    34 
    35 /**
    36  * @file IRootConsoleMenu.h
    37  * @brief Defines the interface for adding options to the "sm" console command.
    38  *
    39  * You must be using the compat_wrappers.h header file to use this on 
    40  * Original/Episode1 builds.  
    41  */
    42 
    43 #define SMINTERFACE_ROOTCONSOLE_NAME			"IRootConsole"
    44 #define SMINTERFACE_ROOTCONSOLE_VERSION			1
    45 
    46 class CCommand;
    47 
    48 namespace SourceMod
    49 {
    50 	/**
    51 	 * @brief Handles a root console menu action.
    52 	 */
    53 	class IRootConsoleCommand
    54 	{
    55 	public:
    56 		virtual void OnRootConsoleCommand(const char *cmdname, const CCommand &command) =0;
    57 	};
    58 
    59 	/**
    60 	 * @brief Manages the root console menu - the "sm" command for servers.
    61 	 */
    62 	class IRootConsole : public SMInterface
    63 	{
    64 	public:
    65 		/**
    66 		 * @brief Adds a root console command handler.  The command must be unique.
    67 		 *
    68 		 * @param cmd			String containing the console command.
    69 		 * @param text			Description text.
    70 		 * @param pHandler		An IRootConsoleCommand pointer to handle the command.
    71 		 * @return				True on success, false on too many commands or duplicate command.
    72 		 */
    73 		virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0;
    74 
    75 		/**
    76 		 * @brief Removes a root console command handler.
    77 		 *
    78 		 * @param cmd			String containing the console command.
    79 		 * @param pHandler		An IRootConsoleCommand pointer for verification.
    80 		 * @return				True on success, false otherwise.
    81 		 */
    82 		virtual bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) =0;
    83 
    84 		/**
    85 		 * @brief Prints text back to the console.
    86 		 *
    87 		 * @param fmt			Format of string.
    88 		 * @param ...			Format arguments.
    89 		 */
    90 		virtual void ConsolePrint(const char *fmt, ...) =0;
    91 
    92 		/**
    93 		 * @brief Draws a generic command/description pair.
    94 		 * NOTE: The pair is currently four spaces indented and 16-N spaces of separation,
    95 		 * N being the length of the command name.  This is subject to change in case we
    96 		 * account for Valve's font choices.
    97 		 *
    98 		 * @param cmd		String containing the command option.
    99 		 * @param text		String containing the command description.
   100 		 */
   101 		virtual void DrawGenericOption(const char *cmd, const char *text) =0;
   102 	};
   103 }
   104 
   105 #endif //_INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_