BsGUIStatusBar.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. * @copydoc GUIElement::setTint
  48. */
  49. virtual void setTint(const Color& color) override;
  50. /**
  51. * @copydoc GUIElement::_updateLayoutInternal
  52. */
  53. void _updateLayoutInternal(const GUILayoutData& data) override;
  54. /**
  55. * @copydoc GUIElement::_getOptimalSize
  56. */
  57. Vector2I _getOptimalSize() const override;
  58. Event<void()> onMessageClicked; /**< Triggered when the user clicks on the console message. */
  59. private:
  60. virtual ~GUIStatusBar();
  61. /**
  62. * @copydoc GUIElement::styleUpdated
  63. */
  64. void styleUpdated() override;
  65. /**
  66. * @brief Triggered when a new entry is added to the debug Log.
  67. */
  68. void logEntryAdded(const LogEntry& entry);
  69. /**
  70. * @brief Triggered when the user clicks on the message display.
  71. */
  72. void messageBtnClicked();
  73. private:
  74. static const Color COLOR_INFO;
  75. static const Color COLOR_WARNING;
  76. static const Color COLOR_ERROR;
  77. GUIPanel* mPanel;
  78. GUIPanel* mBgPanel;
  79. GUIButton* mMessage;
  80. GUITexture* mBackground;
  81. HEvent mLogEntryAddedConn;
  82. HEvent mMessageBtnPressedConn;
  83. };
  84. }