26 #include <SDL2/SDL_keyboard.h>
30 #define ERR_DP LOG_STREAM(err, log_display)
69 const rect& area =
gui.map_outside_area();
71 const int border_size = 10;
76 const int ypos = area.y + border_size - (
check_ !=
nullptr ?
check_->height() + border_size : 0);
78 const int ypos = area.y + area.h - 30 - (
check_ !=
nullptr ?
check_->height() + border_size : 0);
98 const int textbox_width = area.w - label_area.w - border_size * 3;
100 if(textbox_width <= 0) {
105 if(
box_ !=
nullptr) {
107 area.x + label_area.w + border_size * 2
117 check_->set_location(
box_->location().x,
box_->location().y +
box_->location().h + border_size);
130 if(!check_label.empty()) {
132 check_->set_check(checked);
141 SDL_StartTextInput();
151 std::string text =
box_->text();
152 std::vector<std::string> matches(dictionary.begin(), dictionary.end());
155 if(matches.empty()) {
160 text.append(line_start ?
": " :
" ");
161 }
else if(matches.size() > 1) {
162 std::string completion_list =
utils::join(matches,
" ");
166 box_->set_text(text);
171 if(command.empty()) {
void add_chat_message(const std::chrono::system_clock::time_point &time, const std::string &speaker, int side, const std::string &msg, events::chat_handler::MESSAGE_TYPE type, bool bell)
void set_position(double xpos, double ypos)
void set_alignment(ALIGN align)
void set_color(const color_t &color)
void set_clip_rect(const rect &r)
static game_display * get_singleton()
display_chat_manager & get_chat_manager()
void show(gui::TEXTBOX_MODE mode, const std::string &label, const std::string &check_label, bool checked, game_display &gui)
void memorize_command(const std::string &command)
std::string label_string_
TEXTBOX_MODE mode() const
void update_location(game_display &gui)
void tab(const std::set< std::string > &dictionary)
std::unique_ptr< gui::button > check_
std::vector< std::string > command_history_
std::unique_ptr< gui::textbox > box_
void set_message_private(bool value)
static lg::log_domain log_display("display")
std::string label
What to show in the filter's drop-down list.
Standard logging facilities (interface).
const color_t YELLOW_COLOR
int add_floating_label(const floating_label &flabel)
add a label floating on the screen above everything else.
rect get_floating_label_rect(int handle)
void remove_floating_label(int handle, const std::chrono::milliseconds &fadeout)
removes the floating label given by 'handle' from the screen
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
bool word_completion(std::string &text, std::vector< std::string > &wordlist)
Try to complete the last word of 'text' with the 'wordlist'.
auto * find(Container &container, const Value &value)
Convenience wrapper for using find on a container without needing to comare to end()
An abstract description of a rectangle with integer coordinates.