BsGUIStatusBar.h 3.9 KB

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