1 /* 2 Copyright (C) 2008 - 2018 by Fabian Mueller <fabianmueller5@gmx.de> 3 Part of the Battle for Wesnoth Project https://www.wesnoth.org/ 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 2 of the License, or 8 (at your option) any later version. 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY. 11 12 See the COPYING file for more details. 13 */ 14 15 #pragma once 16 17 #include "mouse_action.hpp" 18 #include "editor/palette/empty_palette.hpp" 19 20 class CKey; 21 22 namespace editor { 23 24 /** 25 * Set map label action. 26 */ 27 class mouse_action_map_label : public mouse_action 28 { 29 public: mouse_action_map_label(const CKey & key,empty_palette & palette)30 mouse_action_map_label(const CKey& key, empty_palette& palette) 31 : mouse_action(palette, key), click_(false), clicked_on_(), last_draged_() 32 { 33 } 34 35 editor_action* click_left(editor_display& disp, int x, int y); 36 37 /** 38 * Drag operation. A click should have occurred earlier. Defaults to no action. 39 */ 40 editor_action* drag_left(editor_display& disp, int x, int y, bool& partial, editor_action* last_undo); 41 42 /** 43 * Left click displays a dialog that is used for entering the label string. 44 */ 45 editor_action* up_left(editor_display& disp, int x, int y); 46 47 editor_action* click_right(editor_display& disp, int x, int y); 48 49 /** 50 * Right click erases the label under the mouse. 51 */ 52 editor_action* up_right(editor_display& disp, int x, int y); 53 54 virtual void set_mouse_overlay(editor_display& disp); 55 56 private: 57 bool click_; 58 map_location clicked_on_; 59 map_location last_draged_; 60 }; 61 62 } //end namespace editor 63