Debian Codegraph @

modules/openxr/editor/openxr_binding_modifier_editor.h

raw symbols SCIP
1 /**************************************************************************/
2 /* openxr_binding_modifier_editor.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 "../action_map/openxr_action_map.h"
34 #include "../action_map/openxr_action_set.h"
35 #include "../action_map/openxr_binding_modifier.h"
36 #include "editor/editor_undo_redo_manager.h"
37 #include "editor/inspector/editor_inspector.h"
38 #include "scene/gui/box_container.h"
39 #include "scene/gui/button.h"
40 #include "scene/gui/label.h"
41 #include "scene/gui/panel_container.h"
42
43 class EditorPropertyActionSet : public EditorProperty {
44 GDCLASS(EditorPropertyActionSet, EditorProperty);
45 OptionButton *options = nullptr;
46
47 void _option_selected(int p_which);
48
49 protected:
50 virtual void _set_read_only(bool p_read_only) override;
51
52 public:
53 void setup(const Ref<OpenXRActionMap> &p_action_map);
54 virtual void update_property() override;
55 void set_option_button_clip(bool p_enable);
56 EditorPropertyActionSet();
57 };
58
59 class EditorPropertyBindingPath : public EditorProperty {
60 GDCLASS(EditorPropertyBindingPath, EditorProperty);
61 OptionButton *options = nullptr;
62
63 void _option_selected(int p_which);
64
65 protected:
66 virtual void _set_read_only(bool p_read_only) override;
67
68 public:
69 void setup(const String &p_interaction_profile_path, Vector<OpenXRAction::ActionType> p_include_action_types);
70 virtual void update_property() override;
71 void set_option_button_clip(bool p_enable);
72 EditorPropertyBindingPath();
73 };
74
75 class EditorInspectorPluginBindingModifier : public EditorInspectorPlugin {
76 GDCLASS(EditorInspectorPluginBindingModifier, EditorInspectorPlugin);
77
78 public:
79 virtual bool can_handle(Object *p_object) override;
80 virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide) override;
81 };
82
83 class OpenXRBindingModifierEditor : public PanelContainer {
84 GDCLASS(OpenXRBindingModifierEditor, PanelContainer);
85
86 private:
87 HBoxContainer *header_hb = nullptr;
88 Label *binding_modifier_title = nullptr;
89 Button *rem_binding_modifier_btn = nullptr;
90 EditorInspector *editor_inspector = nullptr;
91
92 protected:
93 VBoxContainer *main_vb = nullptr;
94
95 EditorUndoRedoManager *undo_redo;
96 Ref<OpenXRBindingModifier> binding_modifier;
97 Ref<OpenXRActionMap> action_map;
98
99 static void _bind_methods();
100 void _notification(int p_what);
101
102 void _on_remove_binding_modifier();
103
104 public:
105 Ref<OpenXRBindingModifier> get_binding_modifier() const { return binding_modifier; }
106
107 virtual void setup(const Ref<OpenXRActionMap> &p_action_map, const Ref<OpenXRBindingModifier> &p_binding_modifier);
108
109 OpenXRBindingModifierEditor();
110 };