3 * =============================================================================
5 * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
6 * =============================================================================
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.
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
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/>.
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>.
32 #ifndef _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
33 #define _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
36 * @file IRootConsoleMenu.h
37 * @brief Defines the interface for adding options to the "sm" console command.
39 * You must be using the compat_wrappers.h header file to use this on
40 * Original/Episode1 builds.
43 #define SMINTERFACE_ROOTCONSOLE_NAME "IRootConsole"
44 #define SMINTERFACE_ROOTCONSOLE_VERSION 1
51 * @brief Handles a root console menu action.
53 class IRootConsoleCommand
56 virtual void OnRootConsoleCommand(const char *cmdname, const CCommand &command) =0;
60 * @brief Manages the root console menu - the "sm" command for servers.
62 class IRootConsole : public SMInterface
66 * @brief Adds a root console command handler. The command must be unique.
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.
73 virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0;
76 * @brief Removes a root console command handler.
78 * @param cmd String containing the console command.
79 * @param pHandler An IRootConsoleCommand pointer for verification.
80 * @return True on success, false otherwise.
82 virtual bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) =0;
85 * @brief Prints text back to the console.
87 * @param fmt Format of string.
88 * @param ... Format arguments.
90 virtual void ConsolePrint(const char *fmt, ...) =0;
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.
98 * @param cmd String containing the command option.
99 * @param text String containing the command description.
101 virtual void DrawGenericOption(const char *cmd, const char *text) =0;
105 #endif //_INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_