ResourceEditor.h 1.5 KB

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