BsGUIColor.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUIElement.h"
  4. #include "BsImageSprite.h"
  5. #include "BsGUIContent.h"
  6. namespace BansheeEngine
  7. {
  8. class GUIColor : public GUIElement
  9. {
  10. public:
  11. static const String& getGUITypeName();
  12. static GUIColor* create(const String& styleName = StringUtil::BLANK);
  13. static GUIColor* create(const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
  14. virtual Vector2I _getOptimalSize() const;
  15. void setColor(const Color& color);
  16. Color getColor() const { return mColor; }
  17. Event<void(const Color&)> onValueChanged;
  18. protected:
  19. GUIColor(const String& styleName, const GUILayoutOptions& layoutOptions);
  20. virtual ~GUIColor();
  21. /**
  22. * @copydoc GUIElement::getNumRenderElements()
  23. */
  24. virtual UINT32 getNumRenderElements() const;
  25. /**
  26. * @copydoc GUIElement::getMaterial()
  27. */
  28. virtual const GUIMaterialInfo& getMaterial(UINT32 renderElementIdx) const;
  29. /**
  30. * @copydoc GUIElement::getNumQuads()
  31. */
  32. virtual UINT32 getNumQuads(UINT32 renderElementIdx) const;
  33. /**
  34. * @copydoc GUIElement::fillBuffer()
  35. */
  36. virtual void fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad,
  37. UINT32 maxNumQuads, UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const;
  38. /**
  39. * @copydoc GUIElement::updateRenderElementsInternal()
  40. */
  41. virtual void updateRenderElementsInternal();
  42. /**
  43. * @copydoc GUIElement::updateBounds()
  44. */
  45. virtual void updateClippedBounds();
  46. virtual bool mouseEvent(const GUIMouseEvent& ev);
  47. private:
  48. static const float ALPHA_SPLIT_POSITION;
  49. ImageSprite* mColorSprite;
  50. ImageSprite* mAlphaSprite;
  51. IMAGE_SPRITE_DESC mColorImageDesc;
  52. IMAGE_SPRITE_DESC mAlphaImageDesc;
  53. Color mColor;
  54. };
  55. }