BsGUIColor.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. protected:
  18. GUIColor(const String& styleName, const GUILayoutOptions& layoutOptions);
  19. virtual ~GUIColor();
  20. /**
  21. * @copydoc GUIElement::getNumRenderElements()
  22. */
  23. virtual UINT32 getNumRenderElements() const;
  24. /**
  25. * @copydoc GUIElement::getMaterial()
  26. */
  27. virtual const GUIMaterialInfo& getMaterial(UINT32 renderElementIdx) const;
  28. /**
  29. * @copydoc GUIElement::getNumQuads()
  30. */
  31. virtual UINT32 getNumQuads(UINT32 renderElementIdx) const;
  32. /**
  33. * @copydoc GUIElement::fillBuffer()
  34. */
  35. virtual void fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad,
  36. UINT32 maxNumQuads, UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const;
  37. /**
  38. * @copydoc GUIElement::updateRenderElementsInternal()
  39. */
  40. virtual void updateRenderElementsInternal();
  41. /**
  42. * @copydoc GUIElement::updateBounds()
  43. */
  44. virtual void updateClippedBounds();
  45. virtual bool mouseEvent(const GUIMouseEvent& ev);
  46. private:
  47. static const float ALPHA_SPLIT_POSITION;
  48. ImageSprite* mColorSprite;
  49. ImageSprite* mAlphaSprite;
  50. IMAGE_SPRITE_DESC mColorImageDesc;
  51. IMAGE_SPRITE_DESC mAlphaImageDesc;
  52. Color mColor;
  53. };
  54. }