BsGUIStatusBar.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. /**
  56. * Activates or deactives the "import in progress" visuals on the status bar, as well as updates the related
  57. * progress bar to the specified percentage (if active).
  58. */
  59. void setIsImporting(bool importing, float percentage);
  60. /** @copydoc GUIElement::setTint */
  61. void setTint(const Color& color) override;
  62. /** @copydoc GUIElement::_updateLayoutInternal */
  63. void _updateLayoutInternal(const GUILayoutData& data) override;
  64. /** @copydoc GUIElement::_getOptimalSize */
  65. Vector2I _getOptimalSize() const override;
  66. Event<void()> onMessageClicked; /**< Triggered when the user clicks on the console message. */
  67. private:
  68. virtual ~GUIStatusBar();
  69. /** @copydoc GUIElement::styleUpdated */
  70. void styleUpdated() override;
  71. /** Triggered when the debug Log was modified. */
  72. void logModified();
  73. /** Triggered when the user clicks on the message display. */
  74. void messageBtnClicked();
  75. private:
  76. static const Color COLOR_INFO;
  77. static const Color COLOR_WARNING;
  78. static const Color COLOR_ERROR;
  79. GUIPanel* mPanel;
  80. GUIPanel* mBgPanel;
  81. GUIButton* mMessage;
  82. GUILabel* mScene;
  83. GUILabel* mProject;
  84. GUIFixedSpace* mCompilingSpace;
  85. GUILabel* mCompiling;
  86. GUILayout* mImportLayout;
  87. GUIFixedSpace* mImportSpace;
  88. GUILabel* mImporting;
  89. GUIProgressBar* mImportProgressBar;
  90. GUITexture* mBackground;
  91. HEvent mLogEntryAddedConn;
  92. HEvent mMessageBtnPressedConn;
  93. };
  94. /** @} */
  95. }