DecoratorDefender.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * This source file is part of RmlUi, the HTML/CSS Interface Middleware
  3. *
  4. * For the latest information, see http://github.com/mikke89/RmlUi
  5. *
  6. * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
  7. * Copyright (c) 2019 The RmlUi Team, and contributors
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documentation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in
  17. * all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. * THE SOFTWARE.
  26. *
  27. */
  28. #ifndef RMLUIINVADERSDECORATORDEFENDER_H
  29. #define RMLUIINVADERSDECORATORDEFENDER_H
  30. #include <RmlUi/Core/Decorator.h>
  31. class DecoratorDefender : public Rml::Core::Decorator
  32. {
  33. public:
  34. virtual ~DecoratorDefender();
  35. bool Initialise(const Rml::Core::String& image_source, const Rml::Core::String& image_path);
  36. /// Called on a decorator to generate any required per-element data for a newly decorated element.
  37. /// @param element[in] The newly decorated element.
  38. /// @return A handle to a decorator-defined data handle, or nullptr if none is needed for the element.
  39. Rml::Core::DecoratorDataHandle GenerateElementData(Rml::Core::Element* element) const override;
  40. /// Called to release element data generated by this decorator.
  41. /// @param element_data[in] The element data handle to release.
  42. void ReleaseElementData(Rml::Core::DecoratorDataHandle element_data) const override;
  43. /// Called to render the decorator on an element.
  44. /// @param element[in] The element to render the decorator on.
  45. /// @param element_data[in] The handle to the data generated by the decorator for the element.
  46. void RenderElement(Rml::Core::Element* element, Rml::Core::DecoratorDataHandle element_data) const override;
  47. private:
  48. int image_index;
  49. };
  50. #endif