Debian Codegraph @

editor/gui/touch_actions_panel.h

raw symbols SCIP
1 /**************************************************************************/
2 /* touch_actions_panel.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 #pragma once
32
33 #include "scene/gui/panel_container.h"
34
35 class BoxContainer;
36 class Button;
37 class TextureRect;
38
39 class TouchActionsPanel : public PanelContainer {
40 GDCLASS(TouchActionsPanel, PanelContainer);
41
42 private:
43 BoxContainer *box = nullptr;
44 Button *save_button = nullptr;
45 Button *delete_button = nullptr;
46 Button *undo_button = nullptr;
47 Button *redo_button = nullptr;
48 Button *cut_button = nullptr;
49 Button *copy_button = nullptr;
50 Button *paste_button = nullptr;
51
52 TextureRect *drag_handle = nullptr;
53 Button *layout_toggle_button = nullptr;
54 Button *lock_panel_button = nullptr;
55 Button *panel_pos_button = nullptr;
56
57 bool locked_panel = false;
58 bool dragging = false;
59 Vector2 drag_offset;
60
61 enum Modifier {
62 MODIFIER_CTRL,
63 MODIFIER_SHIFT,
64 MODIFIER_ALT
65 };
66
67 bool ctrl_btn_pressed = false;
68 bool shift_btn_pressed = false;
69 bool alt_btn_pressed = false;
70
71 bool is_floating = false; // Embedded panel mode is default.
72 int embedded_panel_index = 0;
73
74 void _notification(int p_what);
75 virtual void input(const Ref<InputEvent> &event) override;
76
77 void _simulate_editor_shortcut(const String &p_shortcut_name);
78 void _simulate_key_press(Key p_keycode);
79 void _on_drag_handle_gui_input(const Ref<InputEvent> &p_event);
80 void _switch_layout();
81 void _lock_panel_toggled(bool p_pressed);
82 void _switch_embedded_panel_side();
83
84 Button *_add_new_action_button(const String &p_shortcut, const String &p_name, Key p_keycode = Key::NONE);
85 void _add_new_modifier_button(Modifier p_modifier);
86 void _on_modifier_button_toggled(bool p_pressed, int p_modifier);
87
88 void _hardware_keyboard_connected(bool p_connected);
89
90 public:
91 TouchActionsPanel();
92 };