UIResourceFrame.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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/Container/HashMap.h>
  6. #include "AEWidget.h"
  7. #include <TurboBadger/tb_tab_container.h>
  8. #include <TurboBadger/tb_style_edit.h>
  9. using namespace Atomic;
  10. namespace tb
  11. {
  12. class TBLayout;
  13. }
  14. namespace AtomicEditor
  15. {
  16. class ResourceEditor;
  17. class IssuesWidget;
  18. class ErrorsWidget;
  19. class ConsoleWidget;
  20. class ResourceFrame : public AEWidget
  21. {
  22. OBJECT(ResourceFrame);
  23. public:
  24. /// Construct.
  25. ResourceFrame(Context* context);
  26. /// Destruct.
  27. virtual ~ResourceFrame();
  28. void EditResource(const String& fullpath);
  29. void NavigateToResource(const String& fullpath, int lineNumber = -1, int tokenPos = -1);
  30. void CloseResourceEditor(ResourceEditor* editor, bool navigateToAvailableResource = true);
  31. void CloseAllResourceEditors();
  32. void FocusCurrentTab();
  33. bool HasUnsavedModifications();
  34. bool IssuesWidgetVisible();
  35. void ShowIssuesWidget(bool show = true);
  36. bool ErrorsWidgetVisible();
  37. void ShowErrorsWidget(bool show = true);
  38. bool ConsoleWidgetVisible();
  39. void ShowConsoleWidget(bool show = true);
  40. bool OnEvent(const TBWidgetEvent &ev);
  41. void SendCurrentEditorEvent(const TBWidgetEvent &ev);
  42. private:
  43. void HandleFindText(StringHash eventType, VariantMap& eventData);
  44. void HandleFindTextClose(StringHash eventType, VariantMap& eventData);
  45. void HandlePlayStarted(StringHash eventType, VariantMap& eventData);
  46. void HandlePlayStopped(StringHash eventType, VariantMap& eventData);
  47. HashMap<String, SharedPtr<ResourceEditor> > editors_;
  48. HashMap<TBWidget*, SharedPtr<ResourceEditor> > editorLookup_;
  49. WeakPtr<ResourceEditor> currentResourceEditor_;
  50. SharedPtr<IssuesWidget> issueswidget_;
  51. SharedPtr<ErrorsWidget> errorswidget_;
  52. SharedPtr<ConsoleWidget> consolewidget_;
  53. TBTabContainer* tabcontainer_;
  54. TBLayout* resourceLayout_;
  55. };
  56. }