UISelectable.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include "../Math/Color.h"
  5. #include "../UI/UIElement.h"
  6. namespace Urho3D
  7. {
  8. class URHO3D_API UISelectable : public UIElement
  9. {
  10. public:
  11. URHO3D_OBJECT(UISelectable, UIElement);
  12. /// Construct.
  13. using UIElement::UIElement;
  14. /// Destruct.
  15. ~UISelectable() override = default;
  16. /// Register object factory.
  17. /// @nobind
  18. static void RegisterObject(Context* context);
  19. /// Return UI rendering batches.
  20. void GetBatches(Vector<UIBatch>& batches, Vector<float>& vertexData, const IntRect& currentScissor) override;
  21. /// Set selection background color. Color with 0 alpha (default) disables.
  22. /// @property
  23. void SetSelectionColor(const Color& color);
  24. /// Set hover background color. Color with 0 alpha (default) disables.
  25. /// @property
  26. void SetHoverColor(const Color& color);
  27. /// Return selection background color.
  28. /// @property
  29. const Color& GetSelectionColor() const { return selectionColor_; }
  30. /// Return hover background color.
  31. /// @property
  32. const Color& GetHoverColor() const { return hoverColor_; }
  33. protected:
  34. /// Selection background color.
  35. Color selectionColor_{Color::TRANSPARENT_BLACK};
  36. /// Hover background color.
  37. Color hoverColor_{Color::TRANSPARENT_BLACK};
  38. };
  39. }