The Battle for Wesnoth  1.19.0-dev
floating_textbox.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 - 2024
3  by Joerg Hinrichs <joerg.hinrichs@alice-dsl.de>
4  Copyright (C) 2003 by David White <dave@whitevine.net>
5  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY.
13 
14  See the COPYING file for more details.
15 */
16 
17 #pragma once
18 
19 // Scoped_resource can't use a pointer to an incomplete pointer with MSVC.
20 #include "widgets/textbox.hpp"
21 
22 #include <memory>
23 #include <set>
24 
25 class game_display;
26 
27 namespace gui{
28 
29 
32 
34  public:
36 
37  TEXTBOX_MODE mode() const { return mode_; }
38  const std::unique_ptr<gui::button>& check() const { return check_; }
39  const std::unique_ptr<gui::textbox>& box() const { return box_; }
40  const std::vector<std::string>& command_history() const { return command_history_; }
41 
42  void close();
44  void show(gui::TEXTBOX_MODE mode, const std::string& label,
45  const std::string& check_label, bool checked, game_display& gui);
46  void tab(const std::set<std::string>& dictionary);
47  void memorize_command(const std::string& command);
48  bool active() const { return box_.get() != nullptr; }
49 
50  private:
51  std::unique_ptr<gui::textbox> box_;
52  std::unique_ptr<gui::button> check_;
53 
55 
56  std::string label_string_;
57  int label_;
58 
59  std::vector<std::string> command_history_;
60  };
61 }
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)
const std::unique_ptr< gui::textbox > & box() const
TEXTBOX_MODE mode() const
void update_location(game_display &gui)
void tab(const std::set< std::string > &dictionary)
std::unique_ptr< gui::button > check_
const std::unique_ptr< gui::button > & check() const
std::vector< std::string > command_history_
const std::vector< std::string > & command_history() const
std::unique_ptr< gui::textbox > box_
std::string label
What to show in the filter's drop-down list.
Definition: manager.cpp:209
General purpose widgets.
@ TEXTBOX_MESSAGE
@ TEXTBOX_SEARCH
@ TEXTBOX_COMMAND