dvander@372: /**
dvander@375: * vim: set ts=4 :
ds@1330: * =============================================================================
dvander@1226: * SourceMod
ds@1947: * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
ds@1330: * =============================================================================
dvander@372: *
ds@1330: * This program is free software; you can redistribute it and/or modify it under
ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330: * Free Software Foundation.
dvander@379: *
ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
ds@1330: * details.
dvander@1226: *
ds@1330: * You should have received a copy of the GNU General Public License along with
ds@1330: * this program. If not, see .
dvander@1226: *
ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in
ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants
ds@1330: * this exception to all derivative works. AlliedModders LLC defines further
ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330: * or .
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@1883: * You must be using the compat_wrappers.h header file to use this on
dvander@1883: * Original/Episode1 builds.
dvander@324: */
dvander@324:
dvander@1883: #define SMINTERFACE_ROOTCONSOLE_NAME "IRootConsole"
dvander@1883: #define SMINTERFACE_ROOTCONSOLE_VERSION 1
dvander@1883:
dvander@1545: class CCommand;
dvander@1545:
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:
faluco@1541: virtual void OnRootConsoleCommand(const char *cmdname, const CCommand &command) =0;
dvander@324: };
dvander@324:
dvander@324: /**
dvander@324: * @brief Manages the root console menu - the "sm" command for servers.
dvander@324: */
dvander@1883: class IRootConsole : public SMInterface
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 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_