BsGUIColor.h 1.9 KB

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