39 struct builder_chatbox;
45 : name(name), whisper(whisper), pending_messages(0)
84 active_window_changed_callback_ =
f;
87 void load_log(std::map<std::string, chatroom_log>& log,
bool show_lobby);
94 void finalize_setup();
97 virtual void user_relation_changed(
const std::string& name)
override;
100 virtual void add_chat_message(
const std::time_t& time,
101 const std::string& speaker,
108 virtual void add_whisper_sent(
const std::string& receiver,
109 const std::string& message)
override;
112 virtual void add_whisper_received(
const std::string& sender,
113 const std::string& message)
override;
116 virtual void add_chat_room_message_sent(
const std::string& room,
117 const std::string& message)
override;
120 virtual void add_chat_room_message_received(
const std::string& room,
121 const std::string& speaker,
122 const std::string& message)
override;
137 std::map<std::string, chatroom_log>*
log_;
141 static const std::string&
type();
145 virtual const std::string& get_control_type()
const override;
153 void chat_input_keypress_callback(
const SDL_Keycode key);
155 void append_to_chatbox(
const std::string& text,
const bool force_scroll =
false);
157 void append_to_chatbox(
const std::string& text, std::size_t
id,
const bool force_scroll =
false);
160 bool whisper_window_active(
const std::string& name);
163 bool room_window_active(
const std::string& room);
166 void increment_waiting_whispers(
const std::string& name);
169 void increment_waiting_messages(
const std::string& room);
172 void add_whisper_window_whisper(
const std::string& sender,
173 const std::string& message);
178 void add_active_window_whisper(
const std::string& sender,
179 const std::string& message,
180 const bool force_scroll =
false);
183 void add_room_window_message(
const std::string& room,
184 const std::string& sender,
185 const std::string& message);
188 void add_active_window_message(
const std::string& sender,
189 const std::string& message,
190 const bool force_scroll =
false);
192 void close_window(std::size_t idx);
196 virtual void send_chat_message(
const std::string& message,
bool allies_only)
override;
198 virtual void clear_messages()
override;
206 void switch_to_window(std::size_t
id);
208 void active_window_changed();
217 const bool open_new,
const bool allow_close =
true);
229 lobby_chat_window* find_or_create_window(
const std::string& name,
const bool whisper,
const bool open_new,
const bool allow_close,
const std::string& initial_text);
231 void close_window_button_callback(std::string room_name,
bool& handled,
bool& halt);
233 void process_message(const ::config&
data,
bool whisper =
false);
235 void process_network_data(const ::config& data);
238 void signal_handler_receive_keyboard_focus(
const event::ui_event event);
267 virtual std::unique_ptr<widget>
build()
const override;
Base class of a resolution, contains the common keys for a resolution.
multi_page * chat_log_container_
ui_event
The event sent to the dispatcher.
Main class to show messages to the user.
virtual void set_self_active(const bool) override
See container_base::set_self_active.
std::map< std::string, chatroom_log > * log_
virtual void set_active(const bool) override
See styled_widget::set_active.
std::vector< lobby_chat_window > open_windows_
lobby_chat_window(const std::string &name, bool whisper)
std::size_t active_window_
Class for a single line text area.
void set_active_window_changed_callback(const std::function< void(void)> &f)
std::function< void(void)> active_window_changed_callback_
virtual bool get_active() const override
See styled_widget::get_active.
virtual unsigned get_state() const override
See styled_widget::get_state.
A generic container base class.
std::shared_ptr< builder_grid > builder_grid_ptr
A multi page is a control that contains several 'pages' of which only one is visible.
void send_to_server(const config &data)
Attempts to send given data to server if a connection is open.
std::unique_ptr< window > build(const builder_window::window_resolution &definition)
Builds a window.
A config object defines a single node in a WML file, with access to child nodes.
Contains the implementation details for lexical_cast and shouldn't be used directly.