Browse Source

Remove 'none' decorator, no need for that anymore. Add an interface class for DecoratorInstancer for a more stable API.

Michael Ragazzon 6 years ago
parent
commit
43da6ad7a2

+ 0 - 4
Build/cmake/FileList.cmake

@@ -5,8 +5,6 @@ set(Core_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/ComputeProperty.h
     ${PROJECT_SOURCE_DIR}/Source/Core/ContextInstancerDefault.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DebugFont.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorNone.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorNoneInstancer.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiled.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBox.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBoxInstancer.h
@@ -215,8 +213,6 @@ set(Core_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/Core.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Decorator.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorInstancer.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorNone.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorNoneInstancer.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiled.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBox.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBoxInstancer.cpp

+ 0 - 26
Include/Rocket/Core/Decorator.h

@@ -63,22 +63,6 @@ public:
 	/// @param[in] element_data The element data handle to release.
 	virtual void ReleaseElementData(DecoratorDataHandle element_data) = 0;
 
-	/// Sets the z-index of the decorator. A decorator with a higher z-index will be rendered after a decorator
-	/// with a lower z-index. By default, all decorators have a z-index of 0.
-	/// @param[in] z-index The new z-index of the decorator.
-	void SetZIndex(float z_index);
-	/// Returns the decorator's z-index.
-	/// @return The z-index of the decorator.
-	float GetZIndex() const;
-
-	/// Sets the specificity of the decorator.
-	/// @param[in] specificity The specificity of the decorator.
-	void SetSpecificity(int specificity);
-	/// Returns the specificity of the decorator. This is used when multiple pseudo-classes are active on an
-	/// element, each with similarly-named decorators.
-	/// @return The specificity of the decorator.
-	int GetSpecificity() const;
-
 	/// Called to render the decorator on an element.
 	/// @param[in] element The element to render the decorator on.
 	/// @param[in] element_data The handle to the data generated by the decorator for the element.
@@ -103,18 +87,8 @@ protected:
 	const Texture* GetTexture(int index = 0) const;
 
 private:
-	DecoratorInstancer* instancer;
-
-	// The z-index of this decorator, used to resolve render order when multiple decorators are rendered
-	// simultaneously on the same element.
-	float z_index;
-	// The maximum specificity of the properties used to define the decorator.
-	int specificity;
-
 	// Stores a list of textures in use by this decorator.
 	std::vector< Texture > textures;
-
-	friend class Factory;
 };
 
 }

+ 20 - 3
Include/Rocket/Core/DecoratorInstancer.h

@@ -35,7 +35,11 @@
 namespace Rocket {
 namespace Core {
 
+struct Sprite;
+class StyleSheet;
 class Decorator;
+class DecoratorInstancerInterface;
+
 
 /**
 	An element instancer provides a method for allocating and deallocating decorators.
@@ -55,8 +59,9 @@ public:
 	/// Instances a decorator given the property tag and attributes from the RCSS file.
 	/// @param[in] name The type of decorator desired. For example, "decorator: simple(...);" is declared as type "simple".
 	/// @param[in] properties All RCSS properties associated with the decorator.
-	/// @return The decorator if it was instanced successfully, NULL if an error occured.
-	virtual std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const StyleSheet& style_sheet) = 0;
+	/// @param[in] interface An interface for querying the active style sheet.
+	/// @return A shared_ptr to the decorator if it was instanced successfully.
+	virtual std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const DecoratorInstancerInterface& interface) = 0;
 
 	/// Returns the property specification associated with the instancer.
 	const PropertySpecification& GetPropertySpecification() const;
@@ -67,7 +72,7 @@ protected:
 	/// @param[in] default_value The default value to be used.
 	/// @return The new property definition, ready to have parsers attached.
 	PropertyDefinition& RegisterProperty(const String& property_name, const String& default_value);
-	/// Registers a shorthand property definition.
+	/// Registers a shorthand property definition. Specify a shorthand name of 'decorator' to parse anonymous decorators.
 	/// @param[in] shorthand_name The name to register the new shorthand property under.
 	/// @param[in] properties A comma-separated list of the properties this definition is shorthand for. The order in which they are specified here is the order in which the values will be processed.
 	/// @param[in] type The type of shorthand to declare.
@@ -78,6 +83,18 @@ private:
 	PropertySpecification properties;
 };
 
+
+class ROCKETCORE_API DecoratorInstancerInterface {
+public:
+	DecoratorInstancerInterface(const StyleSheet& style_sheet) : style_sheet(style_sheet) {}
+
+	/// Get a sprite from any @spritesheet in the style sheet the decorator is being instanced on.
+	const Sprite* GetSprite(const String& name) const;
+
+private:
+	const StyleSheet& style_sheet;
+};
+
 }
 }
 

+ 2 - 1
Include/Rocket/Core/Factory.h

@@ -50,6 +50,7 @@ class FontEffectInstancer;
 class StyleSheet;
 class PropertyDictionary;
 class PropertySpecification;
+class DecoratorInstancerInterface;
 enum class EventId : uint16_t;
 
 /**
@@ -124,7 +125,7 @@ public:
 	/// @param[in] name The name of the desired decorator type.
 	/// @param[in] properties The properties associated with the decorator.
 	/// @return The newly instanced decorator, or NULL if the decorator could not be instanced.
-	static std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const StyleSheet& style_sheet);
+	static std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const DecoratorInstancerInterface& interface);
 
 	/// Registers an instancer that will be used to instance font effects.
 	/// @param[in] name The name of the font effect the instancer will be called for.

+ 1 - 1
Samples/invaders/src/DecoratorInstancerDefender.cpp

@@ -41,7 +41,7 @@ DecoratorInstancerDefender::~DecoratorInstancerDefender()
 }
 
 // Instances a decorator given the property tag and attributes from the RCSS file.
-std::shared_ptr<Rocket::Core::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rocket::Core::String& ROCKET_UNUSED_PARAMETER(name), const Rocket::Core::PropertyDictionary& properties, const Rocket::Core::StyleSheet& style_sheet)
+std::shared_ptr<Rocket::Core::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rocket::Core::String& ROCKET_UNUSED_PARAMETER(name), const Rocket::Core::PropertyDictionary& properties, const Rocket::Core::DecoratorInstancerInterface& interface)
 {
 	ROCKET_UNUSED(name);
 

+ 1 - 1
Samples/invaders/src/DecoratorInstancerDefender.h

@@ -44,7 +44,7 @@ public:
 	/// @param[in] name The type of decorator desired. For example, "background-decorator: simple;" is declared as type "simple".
 	/// @param[in] properties All RCSS properties associated with the decorator.
 	/// @return The decorator if it was instanced successful, NULL if an error occured.
-	std::shared_ptr<Rocket::Core::Decorator> InstanceDecorator(const Rocket::Core::String& name, const Rocket::Core::PropertyDictionary& properties, const Rocket::Core::StyleSheet& style_sheet) override;
+	std::shared_ptr<Rocket::Core::Decorator> InstanceDecorator(const Rocket::Core::String& name, const Rocket::Core::PropertyDictionary& properties, const Rocket::Core::DecoratorInstancerInterface& interface) override;
 
 private:
 	Rocket::Core::PropertyId id_image_src;

+ 1 - 1
Samples/invaders/src/DecoratorInstancerStarfield.cpp

@@ -45,7 +45,7 @@ DecoratorInstancerStarfield::~DecoratorInstancerStarfield()
 }
 
 // Instances a decorator given the property tag and attributes from the RCSS file.
-std::shared_ptr<Rocket::Core::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rocket::Core::String& ROCKET_UNUSED_PARAMETER(name), const Rocket::Core::PropertyDictionary& properties, const Rocket::Core::StyleSheet& style_sheet)
+std::shared_ptr<Rocket::Core::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rocket::Core::String& ROCKET_UNUSED_PARAMETER(name), const Rocket::Core::PropertyDictionary& properties, const Rocket::Core::DecoratorInstancerInterface& interface)
 {
 	ROCKET_UNUSED(name);
 

+ 1 - 1
Samples/invaders/src/DecoratorInstancerStarfield.h

@@ -45,7 +45,7 @@ public:
 	/// @param name The type of decorator desired. For example, "background-decorator: simple;" is declared as type "simple".
 	/// @param properties All RCSS properties associated with the decorator.
 	/// @return The decorator if it was instanced successful, NULL if an error occured.
-	std::shared_ptr<Rocket::Core::Decorator> InstanceDecorator(const Rocket::Core::String& name, const Rocket::Core::PropertyDictionary& properties, const Rocket::Core::StyleSheet& style_sheet) override;
+	std::shared_ptr<Rocket::Core::Decorator> InstanceDecorator(const Rocket::Core::String& name, const Rocket::Core::PropertyDictionary& properties, const Rocket::Core::DecoratorInstancerInterface& interface) override;
 
 private:
 	Rocket::Core::PropertyId id_num_layers, id_top_colour, id_bottom_colour, id_top_speed, id_bottom_speed, id_top_density, id_bottom_density;

+ 0 - 26
Source/Core/Decorator.cpp

@@ -36,38 +36,12 @@ namespace Core {
 
 Decorator::Decorator()
 {
-	z_index = 0;
-	specificity = -1;
 }
 
 Decorator::~Decorator()
 {
 }
 
-// Sets the z-index of the decorator.
-void Decorator::SetZIndex(float _z_index)
-{
-	z_index = _z_index;
-}
-
-// Returns the decorator's z-index.
-float Decorator::GetZIndex() const
-{
-	return z_index;
-}
-
-// Sets the specificity of the decorator.
-void Decorator::SetSpecificity(int _specificity)
-{
-	specificity = _specificity;
-}
-
-// Returns the specificity of the decorator.
-int Decorator::GetSpecificity() const
-{
-	return specificity;
-}
-
 // Attempts to load a texture into the list of textures in use by the decorator.
 int Decorator::LoadTexture(const String& texture_name, const String& rcss_path)
 {

+ 5 - 0
Source/Core/DecoratorInstancer.cpp

@@ -57,5 +57,10 @@ ShorthandId DecoratorInstancer::RegisterShorthand(const String& shorthand_name,
 	return properties.RegisterShorthand(shorthand_name, property_names, type);
 }
 
+
+const Sprite* DecoratorInstancerInterface::GetSprite(const String& name) const {
+	return style_sheet.GetSprite(name);
+}
+
 }
 }

+ 0 - 60
Source/Core/DecoratorNone.cpp

@@ -1,60 +0,0 @@
-/*
- * This source file is part of libRocket, the HTML/CSS Interface Middleware
- *
- * For the latest information, see http://www.librocket.com
- *
- * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#include "precompiled.h"
-#include "DecoratorNone.h"
-
-namespace Rocket {
-namespace Core {
-
-DecoratorNone::~DecoratorNone()
-{
-}
-
-// Called on a decorator to generate any required per-element data for a newly decorated element.
-DecoratorDataHandle DecoratorNone::GenerateElementData(Element* ROCKET_UNUSED_PARAMETER(element))
-{
-	ROCKET_UNUSED(element);
-
-	return 0;
-}
-
-// Called to release element data generated by this decorator.
-void DecoratorNone::ReleaseElementData(DecoratorDataHandle ROCKET_UNUSED_PARAMETER(element_data))
-{
-	ROCKET_UNUSED(element_data);
-}
-
-// Called to render the decorator on an element.
-void DecoratorNone::RenderElement(Element* ROCKET_UNUSED_PARAMETER(element), DecoratorDataHandle ROCKET_UNUSED_PARAMETER(element_data))
-{
-	ROCKET_UNUSED(element);
-	ROCKET_UNUSED(element_data);
-}
-
-}
-}

+ 0 - 64
Source/Core/DecoratorNone.h

@@ -1,64 +0,0 @@
-/*
- * This source file is part of libRocket, the HTML/CSS Interface Middleware
- *
- * For the latest information, see http://www.librocket.com
- *
- * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#ifndef ROCKETCOREDECORATORNONE_H
-#define ROCKETCOREDECORATORNONE_H
-
-#include "../../Include/Rocket/Core/Decorator.h"
-
-namespace Rocket {
-namespace Core {
-
-/**
-	A decorator used to represent a 'none' decorator; that is, a decorator that does nothing.
-
-	@author Peter Curry
- */
-
-class DecoratorNone : public Decorator
-{
-public:
-	virtual ~DecoratorNone();
-
-	/// Called on a decorator to generate any required per-element data for a newly decorated element.
-	/// @param element[in] The newly decorated element.
-	/// @return A handle to a decorator-defined data handle, or NULL if none is needed for the element.
-	virtual DecoratorDataHandle GenerateElementData(Element* element);
-	/// Called to release element data generated by this decorator.
-	/// @param element_data[in] The element data handle to release.
-	virtual void ReleaseElementData(DecoratorDataHandle element_data);
-
-	/// Called to render the decorator on an element.
-	/// @param element[in] The element to render the decorator on.
-	/// @param element_data[in] The handle to the data generated by the decorator for the element.
-	virtual void RenderElement(Element* element, DecoratorDataHandle element_data);
-};
-
-}
-}
-
-#endif

+ 0 - 50
Source/Core/DecoratorNoneInstancer.cpp

@@ -1,50 +0,0 @@
-/*
- * This source file is part of libRocket, the HTML/CSS Interface Middleware
- *
- * For the latest information, see http://www.librocket.com
- *
- * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#include "precompiled.h"
-#include "DecoratorNoneInstancer.h"
-#include "DecoratorNone.h"
-
-namespace Rocket {
-namespace Core {
-
-DecoratorNoneInstancer::~DecoratorNoneInstancer()
-{
-}
-
-// Instances a decorator given the property tag and attributes from the RCSS file.
-std::shared_ptr<Decorator> DecoratorNoneInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& ROCKET_UNUSED_PARAMETER(properties), const StyleSheet& ROCKET_UNUSED_PARAMETER(style_sheet))
-{
-	ROCKET_UNUSED(name);
-	ROCKET_UNUSED(properties);
-	ROCKET_UNUSED(style_sheet);
-
-	return std::make_shared<DecoratorNone>();
-}
-
-}
-}

+ 0 - 57
Source/Core/DecoratorNoneInstancer.h

@@ -1,57 +0,0 @@
-/*
- * This source file is part of libRocket, the HTML/CSS Interface Middleware
- *
- * For the latest information, see http://www.librocket.com
- *
- * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- */
-
-#ifndef ROCKETCOREDECORATORNONEINSTANCER_H
-#define ROCKETCOREDECORATORNONEINSTANCER_H
-
-#include "../../Include/Rocket/Core/DecoratorInstancer.h"
-
-namespace Rocket {
-namespace Core {
-
-/**
-	The instancer for the none decorator.
-
-	@author Peter Curry
- */
-
-class DecoratorNoneInstancer : public DecoratorInstancer
-{
-public:
-	~DecoratorNoneInstancer();
-
-	/// Instances a decorator given the property tag and attributes from the RCSS file.
-	/// @param name The type of decorator desired. For example, "background-decorator: simple;" is declared as type "simple".
-	/// @param properties All RCSS properties associated with the decorator.
-	/// @return The decorator if it was instanced successful, NULL if an error occured.
-	std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const StyleSheet& style_sheet) override;
-};
-
-}
-}
-
-#endif

+ 2 - 2
Source/Core/DecoratorTiledBoxInstancer.cpp

@@ -54,7 +54,7 @@ DecoratorTiledBoxInstancer::~DecoratorTiledBoxInstancer()
 }
 
 // Instances a box decorator.
-std::shared_ptr<Decorator>DecoratorTiledBoxInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties, const StyleSheet& style_sheet)
+std::shared_ptr<Decorator>DecoratorTiledBoxInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties, const DecoratorInstancerInterface& interface)
 {
 	ROCKET_UNUSED(name);
 
@@ -65,7 +65,7 @@ std::shared_ptr<Decorator>DecoratorTiledBoxInstancer::InstanceDecorator(const St
 	String rcss_paths[num_tiles];
 
 	for(size_t i = 0; i < num_tiles; i++)
-		GetTileProperties(i, tiles[i], texture_names[i], rcss_paths[i], properties, style_sheet);
+		GetTileProperties(i, tiles[i], texture_names[i], rcss_paths[i], properties, interface);
 
 	auto decorator = std::make_shared<DecoratorTiledBox>();
 	if (decorator->Initialise(tiles, texture_names, rcss_paths))

+ 1 - 1
Source/Core/DecoratorTiledBoxInstancer.h

@@ -44,7 +44,7 @@ public:
 	~DecoratorTiledBoxInstancer();
 
 	/// Instances a box decorator.
-	std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const StyleSheet& style_sheet) override;
+	std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const DecoratorInstancerInterface& interface) override;
 };
 
 }

+ 2 - 14
Source/Core/DecoratorTiledHorizontalInstancer.cpp

@@ -44,8 +44,7 @@ DecoratorTiledHorizontalInstancer::~DecoratorTiledHorizontalInstancer()
 {
 }
 
-// Instances a box decorator.
-std::shared_ptr<Decorator> DecoratorTiledHorizontalInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties, const StyleSheet& style_sheet)
+std::shared_ptr<Decorator> DecoratorTiledHorizontalInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties, const DecoratorInstancerInterface& interface)
 {
 	ROCKET_UNUSED(name);
 
@@ -56,7 +55,7 @@ std::shared_ptr<Decorator> DecoratorTiledHorizontalInstancer::InstanceDecorator(
 	String rcss_paths[num_tiles];
 
 	for (size_t i = 0; i < num_tiles; i++)
-		GetTileProperties(i, tiles[i], texture_names[i], rcss_paths[i], properties, style_sheet);
+		GetTileProperties(i, tiles[i], texture_names[i], rcss_paths[i], properties, interface);
 
 	auto decorator = std::make_shared<DecoratorTiledHorizontal>();
 	if (decorator->Initialise(tiles, texture_names, rcss_paths))
@@ -65,17 +64,6 @@ std::shared_ptr<Decorator> DecoratorTiledHorizontalInstancer::InstanceDecorator(
 	return nullptr;
 }
 
-// Releases the given decorator.
-void DecoratorTiledHorizontalInstancer::ReleaseDecorator(Decorator* decorator)
-{
-	delete decorator;
-}
-
-// Releases the instancer.
-void DecoratorTiledHorizontalInstancer::Release()
-{
-	delete this;
-}
 
 }
 }

+ 1 - 6
Source/Core/DecoratorTiledHorizontalInstancer.h

@@ -44,12 +44,7 @@ public:
 	~DecoratorTiledHorizontalInstancer();
 
 	/// Instances a horizontal decorator.
-	std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const StyleSheet& style_sheet);
-	/// Releases the given decorator.
-	void ReleaseDecorator(Decorator* decorator);
-
-	/// Releases the instancer.
-	void Release();
+	std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const DecoratorInstancerInterface& interface) override;
 };
 
 }

+ 2 - 2
Source/Core/DecoratorTiledImageInstancer.cpp

@@ -43,7 +43,7 @@ DecoratorTiledImageInstancer::~DecoratorTiledImageInstancer()
 }
 
 
-std::shared_ptr<Decorator> DecoratorTiledImageInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties, const StyleSheet& style_sheet)
+std::shared_ptr<Decorator> DecoratorTiledImageInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties, const DecoratorInstancerInterface& interface)
 {
 	ROCKET_UNUSED(name);
 
@@ -51,7 +51,7 @@ std::shared_ptr<Decorator> DecoratorTiledImageInstancer::InstanceDecorator(const
 	String texture_name;
 	String rcss_path;
 
-	GetTileProperties(0, tile, texture_name, rcss_path, properties, style_sheet);
+	GetTileProperties(0, tile, texture_name, rcss_path, properties, interface);
 	
 	auto decorator = std::make_shared<DecoratorTiledImage>();
 

+ 1 - 1
Source/Core/DecoratorTiledImageInstancer.h

@@ -44,7 +44,7 @@ public:
 	~DecoratorTiledImageInstancer();
 
 	/// Instances an image decorator.
-	std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const StyleSheet& style_sheet) override;
+	std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const DecoratorInstancerInterface& interface) override;
 };
 
 }

+ 2 - 2
Source/Core/DecoratorTiledInstancer.cpp

@@ -64,7 +64,7 @@ void DecoratorTiledInstancer::RegisterTileProperty(const String& name, bool regi
 }
 
 // Retrieves all the properties for a tile from the property dictionary.
-void DecoratorTiledInstancer::GetTileProperties(size_t tile_index, DecoratorTiled::Tile& tile, String& texture_name, String& rcss_path, const PropertyDictionary& properties, const StyleSheet& style_sheet)
+void DecoratorTiledInstancer::GetTileProperties(size_t tile_index, DecoratorTiled::Tile& tile, String& texture_name, String& rcss_path, const PropertyDictionary& properties, const DecoratorInstancerInterface& interface)
 {
 	ROCKET_ASSERT(tile_index < tile_property_ids.size());
 
@@ -82,7 +82,7 @@ void DecoratorTiledInstancer::GetTileProperties(size_t tile_index, DecoratorTile
 
 	// @performance / @todo: We want some way to determine sprite or image instead of always doing the lookup as a sprite name.
 	// @performance: We already have the texture loaded in the spritesheet, very unnecessary to return as name and then convert to texture again.
-	if (const Sprite * sprite = style_sheet.GetSprite(texture_name))
+	if (const Sprite * sprite = interface.GetSprite(texture_name))
 	{
 		texture_name = sprite->sprite_sheet->image_source;
 		rcss_path = sprite->sprite_sheet->definition_source;

+ 1 - 1
Source/Core/DecoratorTiledInstancer.h

@@ -56,7 +56,7 @@ protected:
 	/// @param[out] rcss_path The path of the RCSS file that generated the texture path.
 	/// @param[in] properties The user-defined list of parameters for the decorator.
 	/// @param[in] name The name of the tile to fetch the properties for.
-	void GetTileProperties(size_t tile_index, DecoratorTiled::Tile& tile, String& texture_name, String& rcss_path, const PropertyDictionary& properties, const StyleSheet& style_sheet);
+	void GetTileProperties(size_t tile_index, DecoratorTiled::Tile& tile, String& texture_name, String& rcss_path, const PropertyDictionary& properties, const DecoratorInstancerInterface& interface);
 
 private:
 	// Loads a single texture coordinate value from the properties.

+ 2 - 3
Source/Core/DecoratorTiledVerticalInstancer.cpp

@@ -44,8 +44,7 @@ DecoratorTiledVerticalInstancer::~DecoratorTiledVerticalInstancer()
 {
 }
 
-// Instances a box decorator.
-std::shared_ptr<Decorator> DecoratorTiledVerticalInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties, const StyleSheet& style_sheet)
+std::shared_ptr<Decorator> DecoratorTiledVerticalInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties, const DecoratorInstancerInterface& interface)
 {
 	ROCKET_UNUSED(name);
 
@@ -56,7 +55,7 @@ std::shared_ptr<Decorator> DecoratorTiledVerticalInstancer::InstanceDecorator(co
 	String rcss_paths[num_tiles];
 
 	for (size_t i = 0; i < num_tiles; i++)
-		GetTileProperties(i, tiles[i], texture_names[i], rcss_paths[i], properties, style_sheet);
+		GetTileProperties(i, tiles[i], texture_names[i], rcss_paths[i], properties, interface);
 
 	auto decorator = std::make_shared<DecoratorTiledVertical>();
 	if (decorator->Initialise(tiles, texture_names, rcss_paths))

+ 1 - 1
Source/Core/DecoratorTiledVerticalInstancer.h

@@ -44,7 +44,7 @@ public:
 	~DecoratorTiledVerticalInstancer();
 
 	/// Instances a vertical decorator.
-	std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const StyleSheet& style_sheet) override;
+	std::shared_ptr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties, const DecoratorInstancerInterface& interface) override;
 };
 
 }

+ 2 - 11
Source/Core/Factory.cpp

@@ -29,7 +29,6 @@
 #include "../../Include/Rocket/Core.h"
 #include "../../Include/Rocket/Core/StreamMemory.h"
 #include "ContextInstancerDefault.h"
-#include "DecoratorNoneInstancer.h"
 #include "DecoratorTiledBoxInstancer.h"
 #include "DecoratorTiledHorizontalInstancer.h"
 #include "DecoratorTiledImageInstancer.h"
@@ -110,7 +109,6 @@ bool Factory::Initialise()
 	RegisterDecoratorInstancer("tiled-vertical", std::make_unique<DecoratorTiledVerticalInstancer>());
 	RegisterDecoratorInstancer("tiled-box", std::make_unique<DecoratorTiledBoxInstancer>());
 	RegisterDecoratorInstancer("image", std::make_unique<DecoratorTiledImageInstancer>());
-	RegisterDecoratorInstancer("none", std::make_unique<DecoratorNoneInstancer>());
 
 	RegisterFontEffectInstancer("shadow", new FontEffectShadowInstancer())->RemoveReference();
 	RegisterFontEffectInstancer("outline", new FontEffectOutlineInstancer())->RemoveReference();
@@ -347,12 +345,8 @@ const PropertySpecification* Factory::GetDecoratorPropertySpecification(const St
 }
 
 // Attempts to instance a decorator from an instancer registered with the factory.
-std::shared_ptr<Decorator> Factory::InstanceDecorator(const String& name, const PropertyDictionary& properties, const StyleSheet& style_sheet)
+std::shared_ptr<Decorator> Factory::InstanceDecorator(const String& name, const PropertyDictionary& properties, const DecoratorInstancerInterface& interface)
 {
-	// TODO: z-index, specificity no longer part of decorator
-	float z_index = 0;
-	int specificity = -1;
-
 	auto iterator = decorator_instancers.find(name);
 	if (iterator == decorator_instancers.end())
 		return nullptr;
@@ -370,13 +364,10 @@ std::shared_ptr<Decorator> Factory::InstanceDecorator(const String& name, const
 		return nullptr;
 	}
 
-	std::shared_ptr<Decorator> decorator = instancer.InstanceDecorator(name, properties, style_sheet);
+	std::shared_ptr<Decorator> decorator = instancer.InstanceDecorator(name, properties, interface);
 	if (!decorator)
 		return nullptr;
 
-	decorator->SetZIndex(z_index);
-	decorator->SetSpecificity(specificity);
-	decorator->instancer = &instancer;
 	return decorator;
 }
 

+ 1 - 1
Source/Core/StyleSheet.cpp

@@ -205,7 +205,7 @@ DecoratorList StyleSheet::InstanceDecoratorsFromString(const String& decorator_s
 
 			specification->SetPropertyDefaults(properties);
 
-			std::shared_ptr<Decorator> decorator = Factory::InstanceDecorator(type, properties, *this);
+			std::shared_ptr<Decorator> decorator = Factory::InstanceDecorator(type, properties, DecoratorInstancerInterface(*this));
 
 			if (decorator)
 				decorator_list.emplace_back(std::move(decorator));

+ 1 - 1
Source/Core/StyleSheetParser.cpp

@@ -304,7 +304,7 @@ bool StyleSheetParser::ParseDecoratorBlock(const String& at_name, DecoratorSpeci
 	// Set non-defined properties to their defaults
 	property_specification->SetPropertyDefaults(properties);
 
-	std::shared_ptr<Decorator> decorator = Factory::InstanceDecorator(decorator_type, properties, style_sheet);
+	std::shared_ptr<Decorator> decorator = Factory::InstanceDecorator(decorator_type, properties, DecoratorInstancerInterface(style_sheet));
 	if (!decorator)
 	{
 		Log::Message(Log::LT_WARNING, "Could not instance decorator of type '%s' declared at %s:%d.", decorator_type.c_str(), stream_file_name.c_str(), line_number);