1 /*
2  * Copyright (C) 2002-2020 by the Widelands Development Team
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program 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 this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  *
18  */
19 
20 #ifndef WL_EDITOR_TOOLS_RESIZE_TOOL_H
21 #define WL_EDITOR_TOOLS_RESIZE_TOOL_H
22 
23 #include "editor/tools/tool.h"
24 
25 ///  Resize the map
26 struct EditorResizeTool : public EditorTool {
EditorResizeToolEditorResizeTool27 	EditorResizeTool(int16_t width, int16_t height)
28 	   : EditorTool(*this, *this), width_(width), height_(height) {
29 	}
30 
31 	/**
32 	 * Change the map size
33 	 */
34 	int32_t handle_click_impl(const Widelands::NodeAndTriangle<>& center,
35 	                          EditorInteractive& parent,
36 	                          EditorActionArgs* args,
37 	                          Widelands::Map* map) override;
38 
39 	int32_t handle_undo_impl(const Widelands::NodeAndTriangle<>& center,
40 	                         EditorInteractive& parent,
41 	                         EditorActionArgs* args,
42 	                         Widelands::Map* map) override;
43 
44 	EditorActionArgs format_args_impl(EditorInteractive& parent) override;
45 
get_sel_implEditorResizeTool46 	const Image* get_sel_impl() const override {
47 		return g_gr->images().get("images/wui/editor/fsel_editor_resize.png");
48 	}
49 
has_size_oneEditorResizeTool50 	bool has_size_one() const override {
51 		return true;
52 	}
53 
set_widthEditorResizeTool54 	void set_width(uint32_t w) {
55 		width_ = w;
56 	}
57 
get_widthEditorResizeTool58 	uint32_t get_width() {
59 		return width_;
60 	}
61 
set_heightEditorResizeTool62 	void set_height(uint32_t h) {
63 		height_ = h;
64 	}
65 
get_heightEditorResizeTool66 	uint32_t get_height() {
67 		return height_;
68 	}
69 
70 private:
71 	uint32_t width_;
72 	uint32_t height_;
73 };
74 
75 #endif  // end of include guard: WL_EDITOR_TOOLS_RESIZE_TOOL_H
76