1 | /**************************************************************************/ |
2 | /* tile_proxies_manager_dialog.h */ |
3 | /**************************************************************************/ |
4 | /* This file is part of: */ |
5 | /* GODOT ENGINE */ |
6 | /* https://godotengine.org */ |
7 | /**************************************************************************/ |
8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
10 | /* */ |
11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
12 | /* a copy of this software and associated documentation files (the */ |
13 | /* "Software"), to deal in the Software without restriction, including */ |
14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
17 | /* the following conditions: */ |
18 | /* */ |
19 | /* The above copyright notice and this permission notice shall be */ |
20 | /* included in all copies or substantial portions of the Software. */ |
21 | /* */ |
22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
29 | /**************************************************************************/ |
30 | |
31 | #ifndef TILE_PROXIES_MANAGER_DIALOG_H |
32 | #define TILE_PROXIES_MANAGER_DIALOG_H |
33 | |
34 | #include "editor/editor_properties.h" |
35 | #include "scene/2d/tile_map.h" |
36 | #include "scene/gui/dialogs.h" |
37 | #include "scene/gui/item_list.h" |
38 | |
39 | class EditorPropertyVector2i; |
40 | class EditorUndoRedoManager; |
41 | |
42 | class TileProxiesManagerDialog : public ConfirmationDialog { |
43 | GDCLASS(TileProxiesManagerDialog, ConfirmationDialog); |
44 | |
45 | private: |
46 | int commited_actions_count = 0; |
47 | Ref<TileSet> tile_set; |
48 | |
49 | TileMapCell from; |
50 | TileMapCell to; |
51 | |
52 | // GUI |
53 | ItemList *source_level_list = nullptr; |
54 | ItemList *coords_level_list = nullptr; |
55 | ItemList *alternative_level_list = nullptr; |
56 | |
57 | EditorPropertyInteger *source_from_property_editor = nullptr; |
58 | EditorPropertyVector2i *coords_from_property_editor = nullptr; |
59 | EditorPropertyInteger *alternative_from_property_editor = nullptr; |
60 | EditorPropertyInteger *source_to_property_editor = nullptr; |
61 | EditorPropertyVector2i *coords_to_property_editor = nullptr; |
62 | EditorPropertyInteger *alternative_to_property_editor = nullptr; |
63 | |
64 | PopupMenu * = nullptr; |
65 | void _right_clicked(int p_item, Vector2 p_local_mouse_pos, MouseButton p_mouse_button_index, Object *p_item_list); |
66 | void (int p_id); |
67 | void _delete_selected_bindings(); |
68 | void _update_lists(); |
69 | void _update_enabled_property_editors(); |
70 | void _property_changed(const String &p_path, const Variant &p_value, const String &p_name, bool p_changing); |
71 | void _add_button_pressed(); |
72 | |
73 | void _clear_invalid_button_pressed(); |
74 | void _clear_all_button_pressed(); |
75 | |
76 | protected: |
77 | bool _set(const StringName &p_name, const Variant &p_value); |
78 | bool _get(const StringName &p_name, Variant &r_ret) const; |
79 | void _unhandled_key_input(Ref<InputEvent> p_event); |
80 | virtual void cancel_pressed() override; |
81 | static void _bind_methods(); |
82 | |
83 | public: |
84 | void update_tile_set(Ref<TileSet> p_tile_set); |
85 | |
86 | TileProxiesManagerDialog(); |
87 | }; |
88 | |
89 | #endif // TILE_PROXIES_MANAGER_DIALOG_H |
90 | |