openxr_action_set_editor.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /**************************************************************************/
  2. /* openxr_action_set_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. #ifndef OPENXR_ACTION_SET_EDITOR_H
  31. #define OPENXR_ACTION_SET_EDITOR_H
  32. #include "../action_map/openxr_action_map.h"
  33. #include "../action_map/openxr_action_set.h"
  34. #include "openxr_action_editor.h"
  35. #include "scene/gui/box_container.h"
  36. #include "scene/gui/button.h"
  37. #include "scene/gui/line_edit.h"
  38. #include "scene/gui/panel_container.h"
  39. #include "scene/gui/text_edit.h"
  40. class OpenXRActionSetEditor : public HBoxContainer {
  41. GDCLASS(OpenXRActionSetEditor, HBoxContainer);
  42. private:
  43. EditorUndoRedoManager *undo_redo;
  44. Ref<OpenXRActionMap> action_map;
  45. Ref<OpenXRActionSet> action_set;
  46. bool is_expanded = true;
  47. PanelContainer *panel = nullptr;
  48. Button *fold_btn = nullptr;
  49. VBoxContainer *main_vb = nullptr;
  50. HBoxContainer *action_set_hb = nullptr;
  51. LineEdit *action_set_name = nullptr;
  52. LineEdit *action_set_localized_name = nullptr;
  53. TextEdit *action_set_priority = nullptr;
  54. Button *add_action = nullptr;
  55. Button *rem_action_set = nullptr;
  56. VBoxContainer *actions_vb = nullptr;
  57. void _set_fold_icon();
  58. void _theme_changed();
  59. OpenXRActionEditor *_add_action_editor(Ref<OpenXRAction> p_action);
  60. void _on_toggle_expand();
  61. void _on_action_set_name_changed(const String p_new_text);
  62. void _on_action_set_localized_name_changed(const String p_new_text);
  63. void _on_action_set_priority_changed(const String p_new_text);
  64. void _on_add_action();
  65. void _on_remove_action_set();
  66. void _on_remove_action(Object *p_action_editor);
  67. protected:
  68. static void _bind_methods();
  69. void _notification(int p_what);
  70. // used for undo/redo
  71. void _do_set_name(const String p_new_text);
  72. void _do_set_localized_name(const String p_new_text);
  73. void _do_set_priority(int64_t value);
  74. void _do_add_action_editor(OpenXRActionEditor *p_action_editor);
  75. void _do_remove_action_editor(OpenXRActionEditor *p_action_editor);
  76. public:
  77. Ref<OpenXRActionSet> get_action_set() { return action_set; }
  78. void set_focus_on_entry();
  79. void remove_all_actions();
  80. OpenXRActionSetEditor(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRActionSet> p_action_set);
  81. };
  82. #endif // OPENXR_ACTION_SET_EDITOR_H