# network_chat_gui.cpp File Reference

GUI for handling chat messages. More...

`#include <stdarg.h>`
`#include "../stdafx.h"`
`#include "../date_func.h"`
`#include "../gfx_func.h"`
`#include "../strings_func.h"`
`#include "../blitter/factory.hpp"`
`#include "../console_func.h"`
`#include "../video/video_driver.hpp"`
`#include "../table/sprites.h"`
`#include "../querystring_gui.h"`
`#include "../town.h"`
`#include "../window_func.h"`
`#include "../core/geometry_func.hpp"`
`#include "network.h"`
`#include "network_client.h"`
`#include "network_base.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Data Structures
struct | ChatMessage
struct | NetworkChatWindow
## Enumerations
enum | { NETWORK_CHAT_LINE_SPACING = 3 }
enum | NetWorkChatWidgets { NWCW_CLOSE, NWCW_BACKGROUND, NWCW_DESTINATION, NWCW_TEXTBOX, NWCW_SENDBUTTON }
| Widget numbers of the chat window. More...
## Functions
| assert_compile ((int) DRAW_STRING_BUFFER >=(int) NETWORK_CHAT_LENGTH+NETWORK_NAME_LENGTH+40)
static uint | GetChatMessageCount ()
void CDECL | NetworkAddChatMessage (TextColour colour, uint8 duration, const char *message,...)
| Add a text message to the 'chat window' to be shown.
void | NetworkInitChatMessage ()
void | NetworkUndrawChatMessage ()
| Hide the chatbox.
void | NetworkChatMessageDailyLoop ()
| Check if a message is expired every day.
void | NetworkDrawChatMessage ()
| Draw the chat message-box.
static void | SendChat (const char *buf, DestType type, int dest)
void | ShowNetworkChatQueryWindow (DestType type, int dest)
## Variables
static ChatMessage * | _chatmsg_list = NULL
static bool | _chatmessage_dirty = false
static bool | _chatmessage_visible = false
static bool | _chat_tab_completion_active
static uint | MAX_CHAT_MESSAGES = 0
static PointDimension | _chatmsg_box
static uint8 * | _chatmessage_backup = NULL
static const NWidgetPart | _nested_chat_window_widgets []
static const WindowDesc | _chat_window_desc (WDP_MANUAL, 640, 14, WC_SEND_NETWORK_MSG, WC_NONE, 0, _nested_chat_window_widgets, lengthof(_nested_chat_window_widgets))

## Detailed Description

GUI for handling chat messages.

Definition in file network_chat_gui.cpp.

## Enumeration Type Documentation

enum NetWorkChatWidgets

Widget numbers of the chat window.

Definition at line 269 of file network_chat_gui.cpp.

## Function Documentation

void CDECL NetworkAddChatMessage | ( | TextColour | colour,
|  | uint8 | duration,
|  | const char * | message,
|  |  | ... |
| ) |  |  |

Add a text message to the 'chat window' to be shown.

Parameters:

  | colour | The colour this message is to be shown in
  | duration | The duration of the chat message in game-days
  | message | message itself in printf() style

Definition at line 76 of file network_chat_gui.cpp.

References _date, FormatStringLinebreaks(), GB(), IS_PALETTE_COLOUR, lastof, lengthof, strecpy(), and Utf8TrimString().

## Variable Documentation

const NWidgetPart _nested_chat_window_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_GREY, NWCW_CLOSE),
        NWidget(WWT_PANEL, COLOUR_GREY, NWCW_BACKGROUND),
          NWidget(NWID_HORIZONTAL),
            NWidget(WWT_TEXT, COLOUR_GREY, NWCW_DESTINATION), SetMinimalSize(62, 12), SetPadding(1, 0, 1, 0), SetDataTip(STR_NULL, STR_NULL),
            NWidget(WWT_EDITBOX, COLOUR_GREY, NWCW_TEXTBOX), SetMinimalSize(100, 12), SetPadding(1, 0, 1, 0), SetResize(1, 0),
                                      SetDataTip(STR_NETWORK_CHAT_OSKTITLE, STR_NULL),
            NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, NWCW_SENDBUTTON), SetMinimalSize(62, 12), SetPadding(1, 0, 1, 0), SetDataTip(STR_NETWORK_CHAT_SEND, STR_NULL),
          EndContainer(),
        EndContainer(),
      EndContainer(),
    }

Definition at line 533 of file network_chat_gui.cpp.