supertux
item_script_line.hpp
1 // SuperTux
2 // Copyright (C) 2016 Hume2 <teratux.mail@gmail.com>
3 // 2022 Vankata453
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #ifndef HEADER_SUPERTUX_GUI_ITEM_SCRIPT_LINE_HPP
19 #define HEADER_SUPERTUX_GUI_ITEM_SCRIPT_LINE_HPP
20 
21 #include "gui/item_textfield.hpp"
22 
23 class ItemScriptLine final : public ItemTextField
24 {
25 public:
26  ItemScriptLine(std::string* input_, int id_ = -1);
27 
29  virtual void draw(DrawingContext&, const Vector& pos, int menu_width, bool active) override;
30 
32  virtual int get_width() const override;
33 
35  virtual void process_action(const MenuAction& action) override;
36 
38  virtual void event(const SDL_Event& ev) override;
39 
41  virtual void invalid_remove() override;
42 
43  // Text manipulation and navigation functions
44 
45  virtual void paste() override;
46  virtual void new_line();
47  virtual void duplicate_line();
48 
49 private:
50  ItemScriptLine(const ItemScriptLine&) = delete;
51  ItemScriptLine& operator=(const ItemScriptLine&) = delete;
52 };
53 
54 #endif
55 
56 /* EOF */
virtual int get_width() const override
Returns the minimum width of the menu item.
Definition: item_script_line.cpp:62
virtual void draw(DrawingContext &, const Vector &pos, int menu_width, bool active) override
Draws the menu item.
Definition: item_script_line.cpp:37
Definition: item_script_line.hpp:23
Definition: item_textfield.hpp:23
virtual void invalid_remove() override
Calls when the user wants to remove an invalid char.
Definition: item_script_line.cpp:96
virtual void event(const SDL_Event &ev) override
Processes the given event.
Definition: item_script_line.cpp:68
virtual void process_action(const MenuAction &action) override
Processes the menu action.
Definition: item_script_line.cpp:85
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42