BsGUIStatusBar.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. /** @cond INTERNAL */
  9. /** @addtogroup GUI-Editor
  10. * @{
  11. */
  12. /** Editor window status bar that displays log messages and various other information. */
  13. class BS_ED_EXPORT GUIStatusBar : public GUIElementContainer
  14. {
  15. struct PrivatelyConstruct {};
  16. public:
  17. /** Returns type name of the GUI element used for finding GUI element styles. */
  18. static const String& getGUITypeName();
  19. /** Returns type name of the internal background GUI element. */
  20. static const String& getGUIBackgroundTypeName();
  21. /** Returns type name of the internal message button GUI element. */
  22. static const String& getGUIMessageTypeName();
  23. /**
  24. * Creates a new GUI status bar.
  25. *
  26. * @param[in] options Options that allow you to control how is the element positioned and sized.
  27. * This will override any similar options set by style.
  28. * @param[in] styleName Optional style to use for the element. Style will be retrieved from GUISkin of the
  29. * GUIWidget the element is used on. If not specified default style is used.
  30. */
  31. static GUIStatusBar* create(const GUIOptions& options, const String& style = StringUtil::BLANK);
  32. /**
  33. * Creates a new GUI status bar.
  34. *
  35. * @param[in] options Options that allow you to control how is the element positioned and sized.
  36. * This will override any similar options set by style.
  37. * @param[in] styleName Optional style to use for the element. Style will be retrieved from GUISkin of the
  38. * GUIWidget the element is used on. If not specified default style is used.
  39. */
  40. static GUIStatusBar* create(const String& style = StringUtil::BLANK);
  41. GUIStatusBar(const PrivatelyConstruct& dummy, const String& style, const GUIDimensions& dimensions);
  42. /**
  43. * Updates the active project displayed on the status bar.
  44. *
  45. * @param[in] name Name of the project.
  46. * @param[in] modified Should the project be displayed as modified (and needs saving).
  47. */
  48. void setProject(const WString& name, bool modified);
  49. /**
  50. * Updates the active scene displayed on the status bar.
  51. *
  52. * @param[in] name Name of the scene.
  53. * @param[in] modified Should the scene be displayed as modified (and needs saving).
  54. */
  55. void setScene(const WString& name, bool modified);
  56. /** Activates or deactivates the "compilation in progress" visuals on the status bar. */
  57. void setIsCompiling(bool compiling);
  58. /** @copydoc GUIElement::setTint */
  59. virtual void setTint(const Color& color) override;
  60. /** @copydoc GUIElement::_updateLayoutInternal */
  61. void _updateLayoutInternal(const GUILayoutData& data) override;
  62. /** @copydoc GUIElement::_getOptimalSize */
  63. Vector2I _getOptimalSize() const override;
  64. Event<void()> onMessageClicked; /**< Triggered when the user clicks on the console message. */
  65. private:
  66. virtual ~GUIStatusBar();
  67. /** @copydoc GUIElement::styleUpdated */
  68. void styleUpdated() override;
  69. /** Triggered when the debug Log was modified. */
  70. void logModified();
  71. /** Triggered when the user clicks on the message display. */
  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. GUILabel* mScene;
  81. GUILabel* mProject;
  82. GUILabel* mCompiling;
  83. GUITexture* mBackground;
  84. HEvent mLogEntryAddedConn;
  85. HEvent mMessageBtnPressedConn;
  86. };
  87. /** @} */
  88. /** @endcond */
  89. }