# console_gui.cpp File Reference

Handling the GUI of the in-game console. More...

`#include "stdafx.h"`
`#include "textbuf_gui.h"`
`#include "window_gui.h"`
`#include "console_gui.h"`
`#include "console_internal.h"`
`#include "window_func.h"`
`#include "string_func.h"`
`#include "gfx_func.h"`
`#include "core/math_func.hpp"`
`#include "settings_type.h"`
`#include "rev.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Data Structures
struct | IConsoleLine
| Container for a single line of console output. More...
struct | IConsoleWindow
## Enumerations
enum | { ICON_HISTORY_SIZE = 20, ICON_LINE_HEIGHT = 12, ICON_RIGHT_BORDERWIDTH = 10, ICON_BOTTOM_BORDERWIDTH = 12 }
## Functions
static void | IConsoleClearCommand ()
static void | IConsoleResetHistoryPos ()
static void | IConsoleHistoryAdd (const char *cmd)
| Add the entered line into the history so you can look it back scroll, etc.
static void | IConsoleHistoryNavigate (int direction)
| Navigate Up/Down in the history of typed commands.
void | IConsoleGUIInit ()
void | IConsoleClearBuffer ()
void | IConsoleGUIFree ()
void | IConsoleResize (Window *w)
void | IConsoleSwitch ()
void | IConsoleClose ()
void | IConsoleOpen ()
void | IConsoleGUIPrint (ConsoleColour colour_code, char *str)
| Handle the printing of text entered into the console or redirected there by any other means.
## Variables
static Textbuf | _iconsole_cmdline
static char * | _iconsole_history [ICON_HISTORY_SIZE]
static byte | _iconsole_historypos
IConsoleModes | _iconsole_mode
static const Widget | _iconsole_window_widgets []
static const WindowDesc | _iconsole_window_desc (0, 0, 2, 2, 2, 2, WC_CONSOLE, WC_NONE, WDF_STD_TOOLTIPS|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS, _iconsole_window_widgets)

## Detailed Description

Handling the GUI of the in-game console.

Definition in file console_gui.cpp.

## Function Documentation

void IConsoleGUIPrint | ( | ConsoleColour | colour_code,
|  | char * | str |
| ) |  |  |

Handle the printing of text entered into the console or redirected there by any other means.

Text can be redirected to other clients in a network game as well as to a logfile. If the network server is a dedicated server, all activities are also logged. All lines to print are added to a temporary buffer which can be used as a history to print them onscreen

Parameters:

  | colour_code | the colour of the command. Red in case of errors, etc.
  | string | the message entered or output on the console (notice, error, etc.)

Definition at line 443 of file console_gui.cpp.

References FindWindowById(), and SetWindowDirty().

Referenced by IConsolePrint().

static void IConsoleHistoryAdd | ( | const char * | cmd | ) | `[static]`

Add the entered line into the history so you can look it back scroll, etc.

Put it to the beginning as it is the latest text

Parameters:

  | cmd | Text to be entered into the 'history'

Definition at line 397 of file console_gui.cpp.

static void IConsoleHistoryNavigate | ( | int | direction | ) | `[static]`

Navigate Up/Down in the history of typed commands.

Parameters:

  | direction | Go further back in history (+1), go to recently typed commands (-1)

Definition at line 410 of file console_gui.cpp.

References IsInsideMM(), ttd_strlcpy(), and UpdateTextBufferSize().

## Variable Documentation

const Widget _iconsole_window_widgets[]`[static]`

Initial value:

     {
      {WIDGETS_END}
    }

Definition at line 316 of file console_gui.cpp.