dvander@372: /** dvander@375: * vim: set ts=4 : dvander@372: * =============================================================== dvander@376: * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC. dvander@376: * All rights reserved. dvander@372: * =============================================================== dvander@372: * dvander@379: * This file is part of the SourceMod/SourcePawn SDK. This file may only be dvander@379: * used or modified under the Terms and Conditions of its License Agreement, dvander@379: * which is found in public/licenses/LICENSE.txt. As of this notice, derivative dvander@379: * works must be licensed under the GNU General Public License (version 2 or dvander@379: * greater). A copy of the GPL is included under public/licenses/GPL.txt. dvander@379: * dvander@379: * To view the latest information, see: http://www.sourcemod.net/license.php dvander@372: * dvander@372: * Version: $Id$ dvander@372: */ dvander@372: dvander@324: #ifndef _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_ dvander@324: #define _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_ dvander@324: dvander@324: /** dvander@372: * @file IRootConsoleMenu.h dvander@372: * @brief Defines the interface for adding options to the "sm" console command. dvander@372: * dvander@372: * This interface is not yet exported. It will be eventually. The initial reason should dvander@372: * be obvious: we do not want users actually touching it. If we exposed this, every little dvander@372: * plugin would be dropping down a silly set of user commands, and exploiting/cluttering the menu. dvander@372: * Since this menu is explicitly provided for stuff that only Core itself is capable of managing, dvander@372: * we won't expose it until a legitimate reason comes up. dvander@324: */ dvander@324: dvander@324: namespace SourceMod dvander@324: { dvander@324: /** dvander@324: * @brief Handles a root console menu action. dvander@324: */ dvander@324: class IRootConsoleCommand dvander@324: { dvander@324: public: dvander@324: virtual void OnRootConsoleCommand(const char *command, unsigned int argcount) =0; dvander@324: }; dvander@324: dvander@324: /** dvander@324: * @brief Manages the root console menu - the "sm" command for servers. dvander@324: */ dvander@324: class IRootConsole dvander@324: { dvander@324: public: dvander@324: /** dvander@324: * @brief Adds a root console command handler. The command must be unique. dvander@324: * dvander@324: * @param cmd String containing the console command. dvander@324: * @param text Description text. dvander@324: * @param pHandler An IRootConsoleCommand pointer to handle the command. dvander@324: * @return True on success, false on too many commands or duplicate command. dvander@324: */ dvander@324: virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0; dvander@324: dvander@324: /** dvander@324: * @brief Removes a root console command handler. dvander@324: * dvander@324: * @param cmd String containing the console command. dvander@324: * @param pHandler An IRootConsoleCommand pointer for verification. dvander@324: * @return True on success, false otherwise. dvander@324: */ dvander@324: virtual bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) =0; dvander@324: dvander@324: /** dvander@324: * @brief Prints text back to the console. dvander@324: * dvander@324: * @param fmt Format of string. dvander@324: * @param ... Format arguments. dvander@324: */ dvander@324: virtual void ConsolePrint(const char *fmt, ...) =0; dvander@324: dvander@324: /** dvander@324: * @brief Returns the string of an argument. dvander@324: * dvander@324: * @param argno The index of the argument. dvander@324: * @return A string containing the argument, or nothing if invalid. dvander@324: */ dvander@324: virtual const char *GetArgument(unsigned int argno) =0; dvander@324: dvander@324: /** dvander@324: * @brief Returns the number of arguments. dvander@324: * dvander@324: * @return Number of arguments. dvander@324: */ dvander@324: virtual unsigned int GetArgumentCount() =0; dvander@324: dvander@324: /** dvander@324: * @brief Returns the entire argument string. dvander@324: * dvander@324: * @return String containing all arguments. dvander@324: */ dvander@324: virtual const char *GetArguments() =0; dvander@324: dvander@324: /** dvander@324: * @brief Draws a generic command/description pair. dvander@324: * NOTE: The pair is currently four spaces indented and 16-N spaces of separation, dvander@324: * N being the length of the command name. This is subject to change in case we dvander@324: * account for Valve's font choices. dvander@324: * dvander@372: * @param cmd String containing the command option. dvander@372: * @param text String containing the command description. dvander@324: */ dvander@324: virtual void DrawGenericOption(const char *cmd, const char *text) =0; dvander@324: }; ds@432: } dvander@324: dvander@324: #endif //_INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_