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_INCREASE_HEIGHT_TOOL_H 21 #define WL_EDITOR_TOOLS_INCREASE_HEIGHT_TOOL_H 22 23 #include "editor/tools/decrease_height_tool.h" 24 #include "editor/tools/set_height_tool.h" 25 26 /// Increases the height of a field by a value. 27 struct EditorIncreaseHeightTool : public EditorTool { EditorIncreaseHeightToolEditorIncreaseHeightTool28 EditorIncreaseHeightTool(EditorDecreaseHeightTool& the_decrease_tool, 29 EditorSetHeightTool& the_set_tool) 30 : EditorTool(the_decrease_tool, the_set_tool), 31 decrease_tool_(the_decrease_tool), 32 set_tool_(the_set_tool), 33 change_by_(1) { 34 } 35 36 int32_t handle_click_impl(const Widelands::NodeAndTriangle<>& center, 37 EditorInteractive& parent, 38 EditorActionArgs* args, 39 Widelands::Map* map) override; 40 41 int32_t handle_undo_impl(const Widelands::NodeAndTriangle<>& center, 42 EditorInteractive& parent, 43 EditorActionArgs* args, 44 Widelands::Map* map) override; 45 46 EditorActionArgs format_args_impl(EditorInteractive& parent) override; 47 get_sel_implEditorIncreaseHeightTool48 const Image* get_sel_impl() const override { 49 return g_gr->images().get("images/wui/editor/fsel_editor_increase_height.png"); 50 } 51 get_change_byEditorIncreaseHeightTool52 int32_t get_change_by() const { 53 return change_by_; 54 } set_change_byEditorIncreaseHeightTool55 void set_change_by(const int32_t n) { 56 change_by_ = n; 57 } 58 decrease_toolEditorIncreaseHeightTool59 EditorDecreaseHeightTool& decrease_tool() const { 60 return decrease_tool_; 61 } set_toolEditorIncreaseHeightTool62 EditorSetHeightTool& set_tool() const { 63 return set_tool_; 64 } 65 66 private: 67 EditorDecreaseHeightTool& decrease_tool_; 68 EditorSetHeightTool& set_tool_; 69 int32_t change_by_; 70 }; 71 72 #endif // end of include guard: WL_EDITOR_TOOLS_INCREASE_HEIGHT_TOOL_H 73