1 /*
2  * This file is part of EasyRPG Player.
3  *
4  * EasyRPG Player is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * EasyRPG Player is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef EP_WINDOW_COMMAND_H
19 #define EP_WINDOW_COMMAND_H
20 
21 // Headers
22 #include <vector>
23 #include "window_selectable.h"
24 #include "font.h"
25 
26 /**
27  * Window Command class.
28  */
29 class Window_Command: public Window_Selectable {
30 public:
31 	/**
32 	 * Constructor.
33 	 *
34 	 * @param commands commands to display.
35 	 * @param width window width, if no width is passed
36 	 *              the width is autocalculated.
37 	 * @param max_item forces a window height for max_item
38 	 *                 items, if no height is passed
39 	 *                 the height is autocalculated.
40 	 */
41 	Window_Command(std::vector<std::string> commands, int width = -1, int max_item = -1);
42 
43 	/**
44 	 * Refreshes the window contents.
45 	 */
46 	void Refresh();
47 
48 	/**
49 	 * Disables a command.
50 	 *
51 	 * @param index command index.
52 	 */
53 	void DisableItem(int index);
54 
55 	/**
56 	 * Enables a command.
57 	 *
58 	 * @param index command index.
59 	 */
60 	void EnableItem(int index);
61 
62 	/**
63 	 * Replaces the text of an item.
64 	 *
65 	 * @param index command index.
66 	 * @param text new item text.
67 	 */
68 	void SetItemText(unsigned index, StringView text);
69 
70 	/**
71 	 * Replace all commands with a new command set.
72 	 *
73 	 * @param commands the commands to replace with
74 	 * @note auto-generating width and height is not supported.
75 	 */
76 	void ReplaceCommands(std::vector<std::string> commands);
77 
78 protected:
79 	std::vector<std::string> commands;
80 
81 	void DrawItem(int index, Font::SystemColor color);
82 };
83 
84 #endif
85