ResourceEditor.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. #pragma once
  8. #include <Atomic/Core/Object.h>
  9. #include <Atomic/UI/UIButton.h>
  10. #include <Atomic/UI/UITabContainer.h>
  11. using namespace Atomic;
  12. using namespace tb;
  13. namespace AtomicEditor
  14. {
  15. class EditorTabLayout;
  16. class ResourceEditor: public Object
  17. {
  18. OBJECT(ResourceEditor);
  19. public:
  20. ResourceEditor(Context* context, const String& fullpath, UITabContainer* container);
  21. virtual ~ResourceEditor();
  22. UIButton* GetButton() { return button_; }
  23. virtual bool HasUnsavedModifications() { return modified_; }
  24. virtual void SetFocus() {}
  25. virtual void Close(bool navigateToAvailableResource = true);
  26. virtual bool OnEvent(const TBWidgetEvent &ev) { return false; }
  27. virtual bool FindText(const String& text, unsigned flags) { return false; }
  28. virtual void FindTextClose() { }
  29. virtual bool RequiresInspector() { return false; }
  30. const String& GetFullPath() { return fullpath_; }
  31. virtual void Undo() {}
  32. virtual void Redo() {}
  33. virtual bool Save() { return true; }
  34. UIWidget* GetRootContentWidget() { return rootContentWidget_; }
  35. virtual void InvokeShortcut(const String& shortcut);
  36. void RequestClose();
  37. void SetModified(bool modified);
  38. protected:
  39. String fullpath_;
  40. bool modified_;
  41. EditorTabLayout* editorTabLayout_;
  42. SharedPtr<UITabContainer> container_;
  43. SharedPtr<UIWidget> rootContentWidget_;
  44. SharedPtr<UIButton> button_;
  45. private:
  46. void HandleFileChanged(StringHash eventType, VariantMap& eventData);
  47. };
  48. }