BsGUIStatusBar.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUIElementContainer.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief Editor window status bar that displays log messages and various other information.
  8. */
  9. class BS_ED_EXPORT GUIStatusBar : public GUIElementContainer
  10. {
  11. struct PrivatelyConstruct {};
  12. public:
  13. /**
  14. * Returns type name of the GUI element used for finding GUI element styles.
  15. */
  16. static const String& getGUITypeName();
  17. /**
  18. * Returns type name of the internal background GUI element.
  19. */
  20. static const String& getGUIBackgroundTypeName();
  21. /**
  22. * Returns type name of the internal message button GUI element.
  23. */
  24. static const String& getGUIMessageTypeName();
  25. /**
  26. * @brief Creates a new GUI status bar.
  27. *
  28. * @param options Options that allow you to control how is the element positioned and sized.
  29. * This will override any similar options set by style.
  30. * @param styleName Optional style to use for the element. Style will be retrieved
  31. * from GUISkin of the GUIWidget the element is used on. If not specified
  32. * default style is used.
  33. */
  34. static GUIStatusBar* create(const GUIOptions& options, const String& style = StringUtil::BLANK);
  35. /**
  36. * @brief Creates a new GUI status bar.
  37. *
  38. * @param options Options that allow you to control how is the element positioned and sized.
  39. * This will override any similar options set by style.
  40. * @param styleName Optional style to use for the element. Style will be retrieved
  41. * from GUISkin of the GUIWidget the element is used on. If not specified
  42. * default style is used.
  43. */
  44. static GUIStatusBar* create(const String& style = StringUtil::BLANK);
  45. GUIStatusBar(const PrivatelyConstruct& dummy, const String& style, const GUIDimensions& dimensions);
  46. /**
  47. * @brief Updates the active project displayed on the status bar.
  48. *
  49. * @param name Name of the project.
  50. * @param modified Should the project be displayed as modified (i.e. needs saving).
  51. */
  52. void setProject(const WString& name, bool modified);
  53. /**
  54. * @brief Updates the active scene displayed on the status bar.
  55. *
  56. * @param name Name of the scene.
  57. * @param modified Should the scene be displayed as modified (i.e. needs saving).
  58. */
  59. void setScene(const WString& name, bool modified);
  60. /**
  61. * @brief Activates or deactivates the "compilation in progress" visuals on the status bar.
  62. */
  63. void setIsCompiling(bool compiling);
  64. /**
  65. * @copydoc GUIElement::setTint
  66. */
  67. virtual void setTint(const Color& color) override;
  68. /**
  69. * @copydoc GUIElement::_updateLayoutInternal
  70. */
  71. void _updateLayoutInternal(const GUILayoutData& data) override;
  72. /**
  73. * @copydoc GUIElement::_getOptimalSize
  74. */
  75. Vector2I _getOptimalSize() const override;
  76. Event<void()> onMessageClicked; /**< Triggered when the user clicks on the console message. */
  77. private:
  78. virtual ~GUIStatusBar();
  79. /**
  80. * @copydoc GUIElement::styleUpdated
  81. */
  82. void styleUpdated() override;
  83. /**
  84. * @brief Triggered when a new entry is added to the debug Log.
  85. */
  86. void logEntryAdded(const LogEntry& entry);
  87. /**
  88. * @brief Triggered when the user clicks on the message display.
  89. */
  90. void messageBtnClicked();
  91. private:
  92. static const Color COLOR_INFO;
  93. static const Color COLOR_WARNING;
  94. static const Color COLOR_ERROR;
  95. GUIPanel* mPanel;
  96. GUIPanel* mBgPanel;
  97. GUIButton* mMessage;
  98. GUILabel* mScene;
  99. GUILabel* mProject;
  100. GUILabel* mCompiling;
  101. GUITexture* mBackground;
  102. HEvent mLogEntryAddedConn;
  103. HEvent mMessageBtnPressedConn;
  104. };
  105. }