public/IRootConsoleMenu.h

Go to the documentation of this file.
00001 /**
00002  * vim: set ts=4 :
00003  * =============================================================================
00004  * SourceMod
00005  * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
00006  * =============================================================================
00007  *
00008  * This program is free software; you can redistribute it and/or modify it under
00009  * the terms of the GNU General Public License, version 3.0, as published by the
00010  * Free Software Foundation.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00015  * details.
00016  *
00017  * You should have received a copy of the GNU General Public License along with
00018  * this program.  If not, see <http://www.gnu.org/licenses/>.
00019  *
00020  * As a special exception, AlliedModders LLC gives you permission to link the
00021  * code of this program (as well as its derivative works) to "Half-Life 2," the
00022  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
00023  * by the Valve Corporation.  You must obey the GNU General Public License in
00024  * all respects for all other code used.  Additionally, AlliedModders LLC grants
00025  * this exception to all derivative works.  AlliedModders LLC defines further
00026  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
00027  * or <http://www.sourcemod.net/license.php>.
00028  *
00029  * Version: $Id$
00030  */
00031 
00032 #ifndef _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
00033 #define _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
00034 
00035 /**
00036  * @file IRootConsoleMenu.h
00037  * @brief Defines the interface for adding options to the "sm" console command.
00038  *
00039  * You must be using the compat_wrappers.h header file to use this on 
00040  * Original/Episode1 builds.  
00041  */
00042 
00043 #define SMINTERFACE_ROOTCONSOLE_NAME                        "IRootConsole"
00044 #define SMINTERFACE_ROOTCONSOLE_VERSION                     1
00045 
00046 class CCommand;
00047 
00048 namespace SourceMod
00049 {
00050           /**
00051            * @brief Handles a root console menu action.
00052            */
00053           class IRootConsoleCommand
00054           {
00055           public:
00056                     virtual void OnRootConsoleCommand(const char *cmdname, const CCommand &command) =0;
00057           };
00058 
00059           /**
00060            * @brief Manages the root console menu - the "sm" command for servers.
00061            */
00062           class IRootConsole : public SMInterface
00063           {
00064           public:
00065                     /**
00066                      * @brief Adds a root console command handler.  The command must be unique.
00067                      *
00068                      * @param cmd                           String containing the console command.
00069                      * @param text                          Description text.
00070                      * @param pHandler            An IRootConsoleCommand pointer to handle the command.
00071                      * @return                                        True on success, false on too many commands or duplicate command.
00072                      */
00073                     virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0;
00074 
00075                     /**
00076                      * @brief Removes a root console command handler.
00077                      *
00078                      * @param cmd                           String containing the console command.
00079                      * @param pHandler            An IRootConsoleCommand pointer for verification.
00080                      * @return                                        True on success, false otherwise.
00081                      */
00082                     virtual bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) =0;
00083 
00084                     /**
00085                      * @brief Prints text back to the console.
00086                      *
00087                      * @param fmt                           Format of string.
00088                      * @param ...                           Format arguments.
00089                      */
00090                     virtual void ConsolePrint(const char *fmt, ...) =0;
00091 
00092                     /**
00093                      * @brief Draws a generic command/description pair.
00094                      * NOTE: The pair is currently four spaces indented and 16-N spaces of separation,
00095                      * N being the length of the command name.  This is subject to change in case we
00096                      * account for Valve's font choices.
00097                      *
00098                      * @param cmd                 String containing the command option.
00099                      * @param text                String containing the command description.
00100                      */
00101                     virtual void DrawGenericOption(const char *cmd, const char *text) =0;
00102           };
00103 }
00104 
00105 #endif //_INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_

Generated on Sun Dec 28 23:26:25 2008 for SourceMod SDK by  doxygen 1.5.1