public/IRootConsoleMenu.h
author David Anderson <dvander@alliedmods.net>
Sun Oct 14 17:55:02 2007 +0000 (2007-10-14)
changeset 1545 4ceff5fa5fdd
parent 1541 e46ad208b9b4
child 1883 c9705da6f066
permissions -rw-r--r--
fixed compat wrappers including core stuff
dvander@372
     1
/**
dvander@375
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
dvander@1226
     4
 * SourceMod
dvander@1226
     5
 * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
ds@1330
     6
 * =============================================================================
dvander@372
     7
 *
ds@1330
     8
 * This program is free software; you can redistribute it and/or modify it under
ds@1330
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330
    10
 * Free Software Foundation.
dvander@379
    11
 * 
ds@1330
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1330
    15
 * details.
dvander@1226
    16
 *
ds@1330
    17
 * You should have received a copy of the GNU General Public License along with
ds@1330
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1226
    19
 *
ds@1330
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1330
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1330
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1330
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330
    27
 * or <http://www.sourcemod.net/license.php>.
dvander@372
    28
 *
dvander@372
    29
 * Version: $Id$
dvander@372
    30
 */
dvander@372
    31
dvander@324
    32
#ifndef _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
dvander@324
    33
#define _INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_
dvander@324
    34
dvander@324
    35
/**
dvander@372
    36
 * @file IRootConsoleMenu.h
dvander@372
    37
 * @brief Defines the interface for adding options to the "sm" console command.
dvander@372
    38
 *
dvander@372
    39
 *  This interface is not yet exported.  It will be eventually.  The initial reason should 
dvander@372
    40
 * be obvious: we do not want users actually touching it.  If we exposed this, every little 
dvander@372
    41
 * plugin would be dropping down a silly set of user commands, and exploiting/cluttering the menu.
dvander@372
    42
 * Since this menu is explicitly provided for stuff that only Core itself is capable of managing,
dvander@372
    43
 * we won't expose it until a legitimate reason comes up.
dvander@324
    44
 */
dvander@324
    45
dvander@1545
    46
class CCommand;
dvander@1545
    47
dvander@324
    48
namespace SourceMod
dvander@324
    49
{
dvander@324
    50
	/**
dvander@324
    51
	 * @brief Handles a root console menu action.
dvander@324
    52
	 */
dvander@324
    53
	class IRootConsoleCommand
dvander@324
    54
	{
dvander@324
    55
	public:
faluco@1541
    56
		virtual void OnRootConsoleCommand(const char *cmdname, const CCommand &command) =0;
dvander@324
    57
	};
dvander@324
    58
dvander@324
    59
	/**
dvander@324
    60
	 * @brief Manages the root console menu - the "sm" command for servers.
dvander@324
    61
	 */
dvander@324
    62
	class IRootConsole
dvander@324
    63
	{
dvander@324
    64
	public:
dvander@324
    65
		/**
dvander@324
    66
		 * @brief Adds a root console command handler.  The command must be unique.
dvander@324
    67
		 *
dvander@324
    68
		 * @param cmd			String containing the console command.
dvander@324
    69
		 * @param text			Description text.
dvander@324
    70
		 * @param pHandler		An IRootConsoleCommand pointer to handle the command.
dvander@324
    71
		 * @return				True on success, false on too many commands or duplicate command.
dvander@324
    72
		 */
dvander@324
    73
		virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0;
dvander@324
    74
dvander@324
    75
		/**
dvander@324
    76
		 * @brief Removes a root console command handler.
dvander@324
    77
		 *
dvander@324
    78
		 * @param cmd			String containing the console command.
dvander@324
    79
		 * @param pHandler		An IRootConsoleCommand pointer for verification.
dvander@324
    80
		 * @return				True on success, false otherwise.
dvander@324
    81
		 */
dvander@324
    82
		virtual bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler) =0;
dvander@324
    83
dvander@324
    84
		/**
dvander@324
    85
		 * @brief Prints text back to the console.
dvander@324
    86
		 *
dvander@324
    87
		 * @param fmt			Format of string.
dvander@324
    88
		 * @param ...			Format arguments.
dvander@324
    89
		 */
dvander@324
    90
		virtual void ConsolePrint(const char *fmt, ...) =0;
dvander@324
    91
dvander@324
    92
		/**
dvander@324
    93
		 * @brief Draws a generic command/description pair.
dvander@324
    94
		 * NOTE: The pair is currently four spaces indented and 16-N spaces of separation,
dvander@324
    95
		 * N being the length of the command name.  This is subject to change in case we
dvander@324
    96
		 * account for Valve's font choices.
dvander@324
    97
		 *
dvander@372
    98
		 * @param cmd		String containing the command option.
dvander@372
    99
		 * @param text		String containing the command description.
dvander@324
   100
		 */
dvander@324
   101
		virtual void DrawGenericOption(const char *cmd, const char *text) =0;
dvander@324
   102
	};
ds@432
   103
}
dvander@324
   104
dvander@324
   105
#endif //_INCLUDE_SOURCEMOD_ROOT_CONSOLE_MENU_H_