BsGUIStatusBar.h 3.5 KB

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