Browse Source

Merge branch 'master' into add_tests

# Conflicts:
#	CMakeLists.txt
#	Source/Core/DataModel.cpp
#	Source/Core/GeometryDatabase.cpp
Michael Ragazzon 5 years ago
parent
commit
fcae4ffe79
100 changed files with 514 additions and 291 deletions
  1. 1 0
      CMake/FileList.cmake
  2. 1 0
      CMake/gen_filelists.sh
  3. 48 1
      CMakeLists.txt
  4. 203 0
      Include/RmlUi/Config/Config.h
  5. 2 2
      Include/RmlUi/Core/Animation.h
  6. 4 0
      Include/RmlUi/Core/Colour.h
  7. 12 3
      Include/RmlUi/Core/Context.h
  8. 1 2
      Include/RmlUi/Core/DataController.h
  9. 3 1
      Include/RmlUi/Core/DataModel.h
  10. 6 6
      Include/RmlUi/Core/DataTypeRegister.h
  11. 5 6
      Include/RmlUi/Core/DataTypes.h
  12. 2 3
      Include/RmlUi/Core/DataView.h
  13. 1 2
      Include/RmlUi/Core/Decorator.h
  14. 1 1
      Include/RmlUi/Core/Element.h
  15. 1 1
      Include/RmlUi/Core/Elements/DataQuery.h
  16. 1 2
      Include/RmlUi/Core/Elements/DataSource.h
  17. 2 2
      Include/RmlUi/Core/Elements/ElementDataGrid.h
  18. 2 3
      Include/RmlUi/Core/Elements/ElementDataGridRow.h
  19. 5 5
      Include/RmlUi/Core/Geometry.h
  20. 3 0
      Include/RmlUi/Core/Matrix4.h
  21. 1 1
      Include/RmlUi/Core/ObserverPtr.h
  22. 1 1
      Include/RmlUi/Core/PropertyDefinition.h
  23. 2 2
      Include/RmlUi/Core/PropertySpecification.h
  24. 1 1
      Include/RmlUi/Core/Spritesheet.h
  25. 3 3
      Include/RmlUi/Core/StyleSheet.h
  26. 1 2
      Include/RmlUi/Core/Texture.h
  27. 4 4
      Include/RmlUi/Core/Traits.h
  28. 1 1
      Include/RmlUi/Core/Transform.h
  29. 6 7
      Include/RmlUi/Core/TransformPrimitive.h
  30. 1 3
      Include/RmlUi/Core/Tween.h
  31. 13 67
      Include/RmlUi/Core/Types.h
  32. 4 0
      Include/RmlUi/Core/Vector2.h
  33. 4 0
      Include/RmlUi/Core/Vector3.h
  34. 4 0
      Include/RmlUi/Core/Vector4.h
  35. 1 1
      Include/RmlUi/Core/XMLParser.h
  36. 4 4
      Samples/basic/bitmapfont/src/FontEngineBitmap.cpp
  37. 12 12
      Samples/basic/databinding/src/main.cpp
  38. 4 4
      Samples/basic/demo/src/main.cpp
  39. 3 3
      Samples/basic/sdl2/src/RenderInterfaceSDL2.cpp
  40. 1 1
      Samples/basic/sdl2/src/SystemInterfaceSDL2.cpp
  41. 4 4
      Samples/basic/sfml2/src/RenderInterfaceSFML.cpp
  42. 1 1
      Samples/basic/sfml2/src/SystemInterfaceSFML.cpp
  43. 1 1
      Samples/basic/treeview/src/FileSystem.cpp
  44. 2 2
      Samples/invaders/src/DecoratorInstancerDefender.cpp
  45. 1 1
      Samples/invaders/src/DecoratorInstancerDefender.h
  46. 2 2
      Samples/invaders/src/DecoratorInstancerStarfield.cpp
  47. 1 1
      Samples/invaders/src/DecoratorInstancerStarfield.h
  48. 3 3
      Samples/invaders/src/DecoratorStarfield.h
  49. 2 2
      Samples/luainvaders/src/DecoratorInstancerDefender.cpp
  50. 1 1
      Samples/luainvaders/src/DecoratorInstancerDefender.h
  51. 2 2
      Samples/luainvaders/src/DecoratorInstancerStarfield.cpp
  52. 1 1
      Samples/luainvaders/src/DecoratorInstancerStarfield.h
  53. 3 3
      Samples/luainvaders/src/DecoratorStarfield.h
  54. 2 2
      Samples/shell/src/macosx/ShellMacOSX.cpp
  55. 2 2
      Samples/shell/src/win32/ShellWin32.cpp
  56. 2 2
      Samples/shell/src/x11/ShellX11.cpp
  57. 2 2
      Samples/tutorial/datagrid/src/DecoratorInstancerDefender.cpp
  58. 1 1
      Samples/tutorial/datagrid/src/DecoratorInstancerDefender.h
  59. 2 2
      Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.cpp
  60. 1 1
      Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.h
  61. 21 11
      Source/Core/Context.cpp
  62. 2 2
      Source/Core/Core.cpp
  63. 1 1
      Source/Core/DataControllerDefault.cpp
  64. 2 2
      Source/Core/DataExpression.cpp
  65. 2 2
      Source/Core/DataExpression.h
  66. 3 4
      Source/Core/DataModel.cpp
  67. 1 1
      Source/Core/DataView.cpp
  68. 4 4
      Source/Core/DataViewDefault.cpp
  69. 1 1
      Source/Core/DataViewDefault.h
  70. 1 1
      Source/Core/DecoratorGradient.cpp
  71. 6 7
      Source/Core/DecoratorNinePatch.cpp
  72. 2 2
      Source/Core/DecoratorNinePatch.h
  73. 1 1
      Source/Core/DecoratorTiled.cpp
  74. 1 1
      Source/Core/DecoratorTiled.h
  75. 1 1
      Source/Core/DecoratorTiledBoxInstancer.cpp
  76. 1 1
      Source/Core/DecoratorTiledHorizontalInstancer.cpp
  77. 1 1
      Source/Core/DecoratorTiledImageInstancer.cpp
  78. 1 1
      Source/Core/DecoratorTiledInstancer.h
  79. 1 1
      Source/Core/DecoratorTiledVerticalInstancer.cpp
  80. 1 1
      Source/Core/DocumentHeader.h
  81. 8 8
      Source/Core/Element.cpp
  82. 4 4
      Source/Core/ElementAnimation.cpp
  83. 1 1
      Source/Core/ElementAnimation.h
  84. 2 2
      Source/Core/ElementBackground.cpp
  85. 2 2
      Source/Core/ElementBorder.cpp
  86. 1 1
      Source/Core/ElementDecoration.h
  87. 1 1
      Source/Core/ElementDefinition.cpp
  88. 1 1
      Source/Core/ElementDefinition.h
  89. 4 4
      Source/Core/ElementDocument.cpp
  90. 1 1
      Source/Core/ElementTextDefault.cpp
  91. 1 1
      Source/Core/ElementTextDefault.h
  92. 4 5
      Source/Core/ElementUtilities.cpp
  93. 2 2
      Source/Core/Elements/ElementImage.cpp
  94. 2 3
      Source/Core/Elements/ElementProgressBar.cpp
  95. 1 2
      Source/Core/Elements/WidgetDropDown.h
  96. 7 7
      Source/Core/Elements/WidgetTextInput.cpp
  97. 1 1
      Source/Core/Elements/WidgetTextInput.h
  98. 3 3
      Source/Core/EventDispatcher.cpp
  99. 2 2
      Source/Core/EventDispatcher.h
  100. 1 1
      Source/Core/EventSpecification.cpp

+ 1 - 0
CMake/FileList.cmake

@@ -115,6 +115,7 @@ set(MASTER_Core_PUB_HDR_FILES
 )
 
 set(Core_PUB_HDR_FILES
+    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Config/Config.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Animation.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/BaseXMLParser.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Box.h

+ 1 - 0
CMake/gen_filelists.sh

@@ -25,6 +25,7 @@ printfiles() {
     echo -e ')\n' >>$file
     # Print public headers sub directory
     echo ${pubhdr/lib/$1} >>$file
+	if [[ "$1" == "Core" ]]; then echo '    '$srcdir/Include/RmlUi/Config/Config.h >>$file; fi
     find  $hdrpath/$1 -maxdepth 3 -path */$luapath -prune -o -path */$fontdefaultpath -prune -o \( -iname "*.h" -o -iname "*.inl" -o -iname "*.hpp" \) -exec echo '    '$srcdir/{} \; 2>/dev/null | sort -f >>$file
     echo -e ')\n' >>$file
     # Print source files

+ 48 - 1
CMakeLists.txt

@@ -154,6 +154,8 @@ endif()
 
 option(BUILD_SAMPLES "Build samples" OFF)
 
+option(MATRIX_ROW_MAJOR "Use row-major matrices. Column-major matrices are used by default." OFF)
+
 if(APPLE)
 	if(IOS)
 		if(BUILD_SHARED_LIBS)
@@ -191,6 +193,31 @@ if( NO_THIRDPARTY_CONTAINERS )
 	message("-- No third-party containers will be used: Make sure to #define RMLUI_NO_THIRDPARTY_CONTAINERS before including RmlUi in your project.")
 endif()
 
+option(CUSTOM_CONFIGURATION "Customize RmlUi configuration files for overriding the default configuration and types." OFF)
+
+set(CUSTOM_CONFIGURATION_FILE "" CACHE STRING "Custom configuration file to be included in place of <RmlUi/Config/Config.h>.")
+if( CUSTOM_CONFIGURATION AND CUSTOM_CONFIGURATION_FILE )
+	add_definitions(-DRMLUI_CUSTOM_CONFIGURATION_FILE="${CUSTOM_CONFIGURATION_FILE}")
+	message("-- Including ${CUSTOM_CONFIGURATION_FILE} instead of <RmlUi/Config/Config.h>")
+endif ()
+
+set(CUSTOM_INCLUDE_DIRS "" CACHE STRING "Extra include directories (use with CUSTOM_CONFIGURATION_FILE).")
+if( CUSTOM_CONFIGURATION AND CUSTOM_INCLUDE_DIRS )
+	include_directories(${CUSTOM_INCLUDE_DIRS})
+endif ()
+
+set(CUSTOM_LINK_LIBRARIES "" CACHE STRING "Extra link libraries (use with CUSTOM_CONFIGURATION_FILE).")
+
+if( CUSTOM_CONFIGURATION )
+	mark_as_advanced( CLEAR CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES )
+else()
+	mark_as_advanced( FORCE CUSTOM_CONFIGURATION_FILE CUSTOM_INCLUDE_DIRS CUSTOM_LINK_LIBRARIES )
+	
+	if( CUSTOM_CONFIGURATION_FILE OR CUSTOM_INCLUDE_DIRS OR CUSTOM_LINK_LIBRARIES )
+		message("-- CUSTOM_CONFIGURATION disabled, but custom configuration variables are set. They will have no effect.")
+	endif()
+endif()
+
 option(ENABLE_TRACY_PROFILING "Enable profiling with Tracy. Source files can be placed in Dependencies/tracy." OFF)
 if( ENABLE_TRACY_PROFILING )
 	find_package(Tracy REQUIRED)
@@ -316,13 +343,31 @@ foreach(library ${LIBRARIES})
 		ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
 		RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
 	)
-	
 
 	set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${NAME})
 endforeach(library)
 
+if( CUSTOM_CONFIGURATION )
+	foreach(library ${CUSTOM_LINK_LIBRARIES})
+		install(TARGETS ${library}
+			EXPORT RmlUiTargets
+			LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+			ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+			RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+		)
+		set(RMLUI_EXPORTED_TARGETS ${RMLUI_EXPORTED_TARGETS} ${library})
+	endforeach(library ${CUSTOM_LINK_LIBRARIES})
+endif()
+
 target_compile_definitions(RmlCore PRIVATE RMLUI_VERSION="${RMLUI_VERSION_SHORT}")
 
+if( MATRIX_ROW_MAJOR )
+	target_compile_definitions(RmlCore PUBLIC -DRMLUI_MATRIX_ROW_MAJOR)
+endif ()
+if( CUSTOM_CONFIGURATION AND CUSTOM_LINK_LIBRARIES )
+	target_link_libraries(RmlCore PUBLIC ${CUSTOM_LINK_LIBRARIES})
+endif ()
+
 if (PRECOMPILED_HEADERS_ENABLED)
 	target_precompile_headers(RmlCore PRIVATE ${PROJECT_SOURCE_DIR}/Source/Core/precompiled.h)
 endif()
@@ -549,6 +594,8 @@ endif(NOT BUILD_FRAMEWORK)
 		target_link_libraries(shell PUBLIC shlwapi)
 	endif()
 	
+	target_link_libraries(shell PUBLIC RmlCore)
+	
 	add_common_target_options(shell)
 
 	# Build and install the basic samples

+ 203 - 0
Include/RmlUi/Config/Config.h

@@ -0,0 +1,203 @@
+/*
+ * This source file is part of RmlUi, the HTML/CSS Interface Middleware
+ *
+ * For the latest information, see http://github.com/mikke89/RmlUi
+ *
+ * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
+ * Copyright (c) 2019 The RmlUi Team, and contributors
+ *
+ * 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 RMLUI_CONFIG_CONFIG_H
+#define RMLUI_CONFIG_CONFIG_H
+
+/*
+ * This file provides the means to configure various types used across RmlUi. It is possible to override container
+ * types with your own, provided they are compatible with STL, or customize STL containers, for example by setting
+ * custom allocators. This file may be edited directly, or can be copied to an alternate location, modified, and
+ * included by setting the CMake option CUSTOM_CONFIGURATION_FILE (RMLUI_CUSTOM_CONFIGURATION_FILE preprocessor 
+ * define) to the path of that file.
+ */
+
+#ifdef RMLUI_CUSTOM_CONFIGURATION_FILE
+#include RMLUI_CUSTOM_CONFIGURATION_FILE
+#else
+#include <utility>
+#include <vector>
+#include <string>
+#include <stack>
+#include <list>
+#include <functional>
+#include <queue>
+#include <array>
+#include <unordered_map>
+#include <memory>
+
+#ifdef RMLUI_NO_THIRDPARTY_CONTAINERS
+#include <set>
+#include <unordered_set>
+#else
+#include "../Core/Containers/chobo/flat_map.hpp"
+#include "../Core/Containers/chobo/flat_set.hpp"
+#include "../Core/Containers/robin_hood.h"
+#endif	// RMLUI_NO_THIRDPARTY_CONTAINERS
+
+namespace Rml {
+
+// Default matrix type to be used. This alias may be set to ColumnMajorMatrix4f or RowMajorMatrix4f. This alias can not
+// be set here because matrix types are defined after this include in Core/Types.h.
+#ifdef RMLUI_MATRIX_ROW_MAJOR
+#define RMLUI_MATRIX4_TYPE RowMajorMatrix4f
+#else
+#define RMLUI_MATRIX4_TYPE ColumnMajorMatrix4f
+#endif
+
+// A way to disable 'final' specified for Rml::Releaser class. It breaks EASTL.
+#define RMLUI_RELEASER_FINAL final
+
+// Containers types.
+template<typename T>
+using Vector = std::vector<T>;
+template<typename T, size_t N = 1>
+using Array = std::array<T, N>;
+template<typename T>
+using Stack = std::stack<T>;
+template<typename T>
+using List = std::list<T>;
+template<typename T>
+using Queue = std::queue<T>;
+template<typename T1, typename T2>
+using Pair = std::pair<T1, T2>;
+template <typename Key, typename Value>
+using UnorderedMultimap = std::unordered_multimap< Key, Value >;
+#ifdef RMLUI_NO_THIRDPARTY_CONTAINERS
+template <typename Key, typename Value>
+using UnorderedMap = std::unordered_map< Key, Value >;
+template <typename Key, typename Value>
+using SmallUnorderedMap = UnorderedMap< Key, Value >;
+template <typename T>
+using UnorderedSet = std::unordered_set< T >;
+template <typename T>
+using SmallUnorderedSet = std::unordered_set< T >;
+template <typename T>
+using SmallOrderedSet = std::set< T >;
+#else
+template < typename Key, typename Value>
+using UnorderedMap = robin_hood::unordered_flat_map< Key, Value >;
+template <typename Key, typename Value>
+using SmallUnorderedMap = chobo::flat_map< Key, Value >;
+template <typename T>
+using UnorderedSet = robin_hood::unordered_flat_set< T >;
+template <typename T>
+using SmallUnorderedSet = chobo::flat_set< T >;
+template <typename T>
+using SmallOrderedSet = chobo::flat_set< T >;
+#endif	// RMLUI_NO_THIRDPARTY_CONTAINERS
+template<typename Iterator>
+inline std::move_iterator<Iterator> MakeMoveIterator(Iterator it) { return std::make_move_iterator(it); }
+
+// Utilities.
+template <typename T>
+using Hash = std::hash<T>;
+template<typename T>
+using Function = std::function<T>;
+
+// Strings.
+using String = std::string;
+using StringList = Vector< String >;
+using U16String = std::u16string;
+
+// Smart pointer types.
+template<typename T>
+using UniquePtr = std::unique_ptr<T>;
+template<typename T>
+class Releaser;
+template<typename T>
+using UniqueReleaserPtr = std::unique_ptr<T, Releaser<T>>;
+template<typename T>
+using SharedPtr = std::shared_ptr<T>;
+template<typename T>
+using WeakPtr = std::weak_ptr<T>;
+template<typename T, typename... Args>
+inline SharedPtr<T> MakeShared(Args... args) { return std::make_shared<T, Args...>(std::forward<Args>(args)...); }
+template<typename T, typename... Args>
+inline UniquePtr<T> MakeUnique(Args... args) { return std::make_unique<T, Args...>(std::forward<Args>(args)...); }
+
+}
+
+
+/***
+// The following defines should be used for inserting custom type cast operators for conversion of RmlUi types
+// to user types. RmlUi uses template math types, therefore conversion operators to non-templated types
+// should be done using SFINAE as in example below.
+
+// Extra code to be inserted into RmlUi::Color<> class body. Note: be mindful of colorspaces used by different
+// color types. RmlUi assumes that float colors are interpreted in linear colorspace while byte colors are 
+// interpreted as sRGB.
+
+#define RMLUI_COLOUR_USER_EXTRA                                                                         \
+	template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, byte>>* = nullptr>    \
+	operator MyColor() const { return MyColor(                                                          \
+		(float)red / 255.0f, (float)green / 255.0f, (float)blue / 255.0f, (float)alpha / 255.0f); }     \
+	template<typename U = ColourType, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>   \
+	operator MyColor() const { return MyColor(red, green, blue, alpha); }                               \
+
+// Extra code to be inserted into RmlUi::Vector2<> class body.
+#define RMLUI_VECTOR2_USER_EXTRA                                                                        \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	operator typename MyIntVector2() const { return MyIntVector2(x, y); }                               \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	operator MyVector2() const { return MyVector2(x, y); }                                              \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	Vector2(MyIntVector2 value) : Vector2(value.x_, value.y_) { }                                       \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	Vector2(MyVector2 value) : Vector2(value.x_, value.y_) { }                                          \
+
+// Extra code to be inserted into RmlUi::Vector3<> class body.
+#define RMLUI_VECTOR3_USER_EXTRA                                                                        \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	operator typename MyIntVector3() const { return MyIntVector3(x, y, z); }                            \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	operator MyVector3() const { return MyVector3(x, y, z); }                                           \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	Vector3(MyIntVector3 value) : Vector3(value.x_, value.y_, value.z_) { }                             \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	Vector3(MyVector3 value) : Vector3(value.x_, value.y_, value.z_) { }                                \
+
+// Extra code to be inserted into RmlUi::Vector4<> class body.
+#define RMLUI_VECTOR4_USER_EXTRA                                                                        \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	operator typename MyIntVector4() const { return MyIntVector4(x, y, z, w); }                         \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	operator MyVector4() const { return MyVector4(x, y, z, w); }                                        \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, int>>* = nullptr>           \
+	Vector4(MyIntVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { }                   \
+	template<typename U = Type, typename std::enable_if_t<std::is_same_v<U, float>>* = nullptr>         \
+	Vector4(MyVector4 value) : Vector4(value.x_, value.y_, value.z_, value.w_) { }                      \
+
+// Extra code to be inserted into RmlUi::Matrix4<> class body.
+	#define RMLUI_MATRIX4_USER_EXTRA operator MyMatrix4() const { return MyMatrix4(data()); }
+***/
+
+
+#endif	// RMLUI_USER_CONFIG_FILE
+
+#endif  // RMLUI_CONFIG_CONFIG_H

+ 2 - 2
Include/RmlUi/Core/Animation.h

@@ -57,10 +57,10 @@ struct Transition {
 struct TransitionList {
 	bool none = true;
 	bool all = false;
-	std::vector<Transition> transitions;
+	Vector<Transition> transitions;
 
 	TransitionList() {}
-	TransitionList(bool none, bool all, std::vector<Transition> transitions) :
+	TransitionList(bool none, bool all, Vector<Transition> transitions) :
 		none(none), all(all), transitions(transitions) {}
 };
 

+ 4 - 0
Include/RmlUi/Core/Colour.h

@@ -109,6 +109,10 @@ public:
 	inline operator ColourType*() { return &red; }
 
 	ColourType red, green, blue, alpha;
+
+#ifdef RMLUI_COLOUR_USER_EXTRA
+	RMLUI_COLOUR_USER_EXTRA
+#endif
 };
 
 } // namespace Rml

+ 12 - 3
Include/RmlUi/Core/Context.h

@@ -88,9 +88,9 @@ public:
 	bool Render();
 
 	/// Creates a new, empty document and places it into this context.
-	/// @param[in] tag The document type to create.
+	/// @param[in] instancer_name The name of the instancer used to create the document.
 	/// @return The new document, or nullptr if no document could be created.
-	ElementDocument* CreateDocument(const String& tag = "body");
+	ElementDocument* CreateDocument(const String& instancer_name = "body");
 	/// Load a document into the context.
 	/// @param[in] document_path The path to the document to load.
 	/// @return The loaded document, or nullptr if no document was loaded.
@@ -239,6 +239,14 @@ public:
 	/// @return True if succesfully removed, false if no data model was found.
 	bool RemoveDataModel(const String& name);
 
+	/// This will set the documents base <tag> before creation. Default = "body"
+	/// @param[in] tag The name of the base tag. Example: "html"
+	void SetDocumentsBaseTag(const String& tag);
+
+	/// Gets the name of the documents base tag.
+	/// @return The current documents base tag name.
+	const String& GetDocumentsBaseTag();
+
 protected:
 	void Release() override;
 
@@ -246,11 +254,12 @@ private:
 	String name;
 	Vector2i dimensions;
 	float density_independent_pixel_ratio;
+	String documents_base_tag = "body";
 
 	ContextInstancer* instancer;
 
 	using ElementSet = SmallOrderedSet< Element* > ;
-	using ElementList = std::vector< Element* >;
+	using ElementList = Vector< Element* >;
 	// Set of elements that are currently in hover state.
 	ElementSet hover_chain;
 	// List of elements that are currently in active state.

+ 1 - 2
Include/RmlUi/Core/DataController.h

@@ -32,7 +32,6 @@
 #include "Header.h"
 #include "Types.h"
 #include "Traits.h"
-#include <unordered_map>
 
 namespace Rml {
 
@@ -111,7 +110,7 @@ public:
     void OnElementRemove(Element* element);
 
 private:
-    using ElementControllersMap = std::unordered_multimap<Element*, DataControllerPtr>;
+    using ElementControllersMap = UnorderedMultimap<Element*, DataControllerPtr>;
     ElementControllersMap controllers;
 };
 

+ 3 - 1
Include/RmlUi/Core/DataModel.h

@@ -154,7 +154,9 @@ public:
 	// Convenience wrapper around BindEventCallback for member functions.
 	template<typename T>
 	bool BindEventCallback(const String& name, DataEventMemberFunc<T> member_func, T* object_pointer) {
-		return BindEventCallback(name, std::bind(member_func, object_pointer, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+		return BindEventCallback(name, [member_func, object_pointer](DataModelHandle handle, Event& event, const VariantList& arguments) {
+			(object_pointer->*member_func)(handle, event, arguments);
+		});
 	}
 
 	// Register a struct type.

+ 6 - 6
Include/RmlUi/Core/DataTypeRegister.h

@@ -89,7 +89,7 @@ public:
 		static_assert(std::is_class<T>::value, "Type must be a struct or class type.");
 		FamilyId id = Family<T>::Id();
 
-		auto struct_variable = std::make_unique<StructDefinition>();
+		auto struct_variable = MakeUnique<StructDefinition>();
 		StructDefinition* struct_variable_raw = struct_variable.get();
 
 		bool inserted = type_register.emplace(id, std::move(struct_variable)).second;
@@ -113,7 +113,7 @@ public:
 
 		FamilyId container_id = Family<Container>::Id();
 
-		auto array_variable = std::make_unique<ArrayDefinition<Container>>(value_variable);
+		auto array_variable = MakeUnique<ArrayDefinition<Container>>(value_variable);
 
 		bool inserted = type_register.emplace(container_id, std::move(array_variable)).second;
 		if (!inserted)
@@ -135,7 +135,7 @@ public:
 		bool inserted = result.second;
 
 		if (inserted)
-			it->second = std::make_unique<MemberFuncDefinition<T>>(get_func, set_func);
+			it->second = MakeUnique<MemberFuncDefinition<T>>(get_func, set_func);
 
 		return it->second.get();
 	}
@@ -150,7 +150,7 @@ public:
 		UniquePtr<VariableDefinition>& definition = result.first->second;
 
 		if (inserted)
-			definition = std::make_unique<ScalarDefinition<T>>();
+			definition = MakeUnique<ScalarDefinition<T>>();
 
 		return definition.get();
 	}
@@ -190,13 +190,13 @@ template<typename Object>
 template<typename MemberType>
 inline StructHandle<Object>& StructHandle<Object>::RegisterMember(const String& name, MemberType Object::* member_ptr) {
 	VariableDefinition* member_type = type_register->GetOrAddScalar<MemberType>();
-	struct_definition->AddMember(name, std::make_unique<StructMemberObject<Object, MemberType>>(member_type, member_ptr));
+	struct_definition->AddMember(name, MakeUnique<StructMemberObject<Object, MemberType>>(member_type, member_ptr));
 	return *this;
 }
 template<typename Object>
 inline StructHandle<Object>& StructHandle<Object>::RegisterMemberFunc(const String& name, MemberGetFunc<Object> get_func, MemberSetFunc<Object> set_func) {
 	VariableDefinition* definition = type_register->RegisterMemberFunc<Object>(get_func, set_func);
-	struct_definition->AddMember(name, std::make_unique<StructMemberFunc>(definition));
+	struct_definition->AddMember(name, MakeUnique<StructMemberFunc>(definition));
 	return *this;
 }
 

+ 5 - 6
Include/RmlUi/Core/DataTypes.h

@@ -31,7 +31,6 @@
 
 #include "Header.h"
 #include "Types.h"
-#include <functional>
 
 namespace Rml {
 
@@ -41,10 +40,10 @@ class TransformFuncRegister;
 class DataModelHandle;
 class DataVariable;
 
-using DataGetFunc = std::function<void(Variant&)>;
-using DataSetFunc = std::function<void(const Variant&)>;
-using DataTransformFunc = std::function<bool(Variant&, const VariantList&)>;
-using DataEventFunc = std::function<void(DataModelHandle, Event&, const VariantList&)>;
+using DataGetFunc = Function<void(Variant&)>;
+using DataSetFunc = Function<void(const Variant&)>;
+using DataTransformFunc = Function<bool(Variant&, const VariantList&)>;
+using DataEventFunc = Function<void(DataModelHandle, Event&, const VariantList&)>;
 
 template<typename T> using MemberGetFunc = void(T::*)(Variant&);
 template<typename T> using MemberSetFunc = void(T::*)(const Variant&);
@@ -57,7 +56,7 @@ struct DataAddressEntry {
 	String name;
 	int index;
 };
-using DataAddress = std::vector<DataAddressEntry>;
+using DataAddress = Vector<DataAddressEntry>;
 
 } // namespace Rml
 #endif

+ 2 - 3
Include/RmlUi/Core/DataView.h

@@ -33,7 +33,6 @@
 #include "Types.h"
 #include "Traits.h"
 #include "DataTypes.h"
-#include <unordered_map>
 
 namespace Rml {
 
@@ -117,14 +116,14 @@ public:
 	bool Update(DataModel& model, const DirtyVariables& dirty_variables);
 
 private:
-	using DataViewList = std::vector<DataViewPtr>;
+	using DataViewList = Vector<DataViewPtr>;
 
 	DataViewList views;
 	
 	DataViewList views_to_add;
 	DataViewList views_to_remove;
 
-	using NameViewMap = std::unordered_multimap<String, DataView*>;
+	using NameViewMap = UnorderedMultimap<String, DataView*>;
 	NameViewMap name_view_map;
 };
 

+ 1 - 2
Include/RmlUi/Core/Decorator.h

@@ -29,7 +29,6 @@
 #ifndef RMLUI_CORE_DECORATOR_H
 #define RMLUI_CORE_DECORATOR_H
 
-#include <vector>
 #include "Header.h"
 #include "Texture.h"
 #include "Types.h"
@@ -91,7 +90,7 @@ private:
 	// Stores a list of textures in use by this decorator.
 	// Optimized for the common case of a single texture.
 	Texture first_texture;
-	std::vector< Texture > additional_textures;
+	Vector< Texture > additional_textures;
 };
 
 } // namespace Rml

+ 1 - 1
Include/RmlUi/Core/Element.h

@@ -700,7 +700,7 @@ private:
 	Vector2f scroll_offset;
 
 	// The size of the element.
-	using BoxList = std::vector< Box >;
+	using BoxList = Vector< Box >;
 	Box main_box;
 	BoxList additional_boxes;
 

+ 1 - 1
Include/RmlUi/Core/Elements/DataQuery.h

@@ -122,7 +122,7 @@ private:
 	int offset;
 	int limit;
 
-	typedef std::vector< StringList > Rows;
+	typedef Vector< StringList > Rows;
 	Rows rows;    
 	typedef UnorderedMap< String, size_t > FieldIndices;
 	FieldIndices field_indices;

+ 1 - 2
Include/RmlUi/Core/Elements/DataSource.h

@@ -31,7 +31,6 @@
 
 #include "../Header.h"
 #include "../Types.h"
-#include <list>
 
 namespace Rml {
 
@@ -101,7 +100,7 @@ class RMLUICORE_API DataSource
 	private:
 		String name;
 
-		using ListenerList = std::list< DataSourceListener* >;
+		using ListenerList = List< DataSourceListener* >;
 		ListenerList listeners;
 };
 

+ 2 - 2
Include/RmlUi/Core/Elements/ElementDataGrid.h

@@ -129,8 +129,8 @@ protected:
 	void GetInnerRML(String& content) const override;
 
 private:
-	typedef std::vector< Column > ColumnList;
-	typedef std::vector< ElementDataGridRow* > RowList;
+	typedef Vector< Column > ColumnList;
+	typedef Vector< ElementDataGridRow* > RowList;
 
 	ColumnList columns;
 	String column_fields;

+ 2 - 3
Include/RmlUi/Core/Elements/ElementDataGridRow.h

@@ -33,7 +33,6 @@
 #include "../Element.h"
 #include "DataSourceListener.h"
 #include "DataQuery.h"
-#include <queue>
 
 namespace Rml {
 
@@ -97,8 +96,8 @@ protected:
 	void OnRowChange(DataSource* data_source, const String& table) override;
 
 private:
-	typedef std::queue< ElementDataGridRow* > RowQueue;
-	typedef std::vector< ElementDataGridRow* > RowList;
+	typedef Queue< ElementDataGridRow* > RowQueue;
+	typedef Vector< ElementDataGridRow* > RowList;
 
 	// Called when a row change (addition or removal) occurs in one of our
 	// children. Causes the table row index to be dirtied on all following

+ 5 - 5
Include/RmlUi/Core/Geometry.h

@@ -71,10 +71,10 @@ public:
 
 	/// Returns the geometry's vertices. If these are written to, Release() should be called to force a recompile.
 	/// @return The geometry's vertex array.
-	std::vector< Vertex >& GetVertices();
+	Vector< Vertex >& GetVertices();
 	/// Returns the geometry's indices. If these are written to, Release() should be called to force a recompile.
 	/// @return The geometry's index array.
-	std::vector< int >& GetIndices();
+	Vector< int >& GetIndices();
 
 	/// Gets the geometry's texture.
 	/// @return The geometry's texture.
@@ -96,8 +96,8 @@ private:
 	Context* host_context = nullptr;
 	Element* host_element = nullptr;
 
-	std::vector< Vertex > vertices;
-	std::vector< int > indices;
+	Vector< Vertex > vertices;
+	Vector< int > indices;
 	const Texture* texture = nullptr;
 
 	CompiledGeometryHandle compiled_geometry = 0;
@@ -106,7 +106,7 @@ private:
 	GeometryDatabaseHandle database_handle;
 };
 
-using GeometryList = std::vector< Geometry >;
+using GeometryList = Vector< Geometry >;
 
 } // namespace Rml
 #endif

+ 3 - 0
Include/RmlUi/Core/Matrix4.h

@@ -499,6 +499,9 @@ class Matrix4
 		static ThisType Compose(const Vector3< Component >& translation, const Vector3< Component >& scale,
 			const Vector3< Component >& skew, const Vector4< Component >& perspective, const Vector4< Component >& quaternion) noexcept;
 
+#ifdef RMLUI_MATRIX4_USER_EXTRA
+		RMLUI_MATRIX4_USER_EXTRA
+#endif
 };
 
 } // namespace Rml

+ 1 - 1
Include/RmlUi/Core/ObserverPtr.h

@@ -53,7 +53,7 @@ class EnableObserverPtr;
 
 	Usage: Given a class T, derive from EnableObserverPtr<T>. Then, we can use the observer pointer as follows:
 
-		auto object = std::make_unique<T>();
+		auto object = MakeUnique<T>();
 		ObserverPtr<T> observer_ptr = object->GetObserverPtr();
 		// ...
 		if(obserer_ptr) { 

+ 1 - 1
Include/RmlUi/Core/PropertyDefinition.h

@@ -97,7 +97,7 @@ private:
 		ParameterMap parameters;
 	};
 
-	std::vector< ParserState > parsers;
+	Vector< ParserState > parsers;
 
 	RelativeTarget relative_target;
 };

+ 2 - 2
Include/RmlUi/Core/PropertySpecification.h

@@ -121,8 +121,8 @@ public:
 	String PropertiesToString(const PropertyDictionary& dictionary) const;
 
 private:
-	using Properties = std::vector< UniquePtr<PropertyDefinition> >;
-	using Shorthands = std::vector< UniquePtr<ShorthandDefinition> >;
+	using Properties = Vector< UniquePtr<PropertyDefinition> >;
+	using Shorthands = Vector< UniquePtr<ShorthandDefinition> >;
 
 	Properties properties;
 	Shorthands shorthands;

+ 1 - 1
Include/RmlUi/Core/Spritesheet.h

@@ -64,7 +64,7 @@ struct Spritesheet {
 };
 
 using SpritesheetMap = SmallUnorderedMap<String, SharedPtr<const Spritesheet>>; // key: spritesheet name (as given in @spritesheet)
-using SpriteDefinitionList = std::vector<std::pair<String, Rectangle>>; // Sprite name and rectangle
+using SpriteDefinitionList = Vector<Pair<String, Rectangle>>; // Sprite name and rectangle
 
 
 /**

+ 3 - 3
Include/RmlUi/Core/StyleSheet.h

@@ -51,8 +51,8 @@ struct KeyframeBlock {
 	PropertyDictionary properties;
 };
 struct Keyframes {
-	std::vector<PropertyId> property_ids;
-	std::vector<KeyframeBlock> blocks;
+	Vector<PropertyId> property_ids;
+	Vector<KeyframeBlock> blocks;
 };
 using KeyframesMap = UnorderedMap<String, Keyframes>;
 
@@ -73,7 +73,7 @@ using DecoratorSpecificationMap = UnorderedMap<String, DecoratorSpecification>;
 class RMLUICORE_API StyleSheet : public NonCopyMoveable
 {
 public:
-	typedef std::vector< StyleSheetNode* > NodeList;
+	typedef Vector< StyleSheetNode* > NodeList;
 	typedef UnorderedMap< size_t, NodeList > NodeIndex;
 
 	StyleSheet();

+ 1 - 2
Include/RmlUi/Core/Texture.h

@@ -31,7 +31,6 @@
 
 #include "Header.h"
 #include "Types.h"
-#include <functional>
 
 namespace Rml {
 
@@ -45,7 +44,7 @@ class RenderInterface;
 	/// @param[out] dimensions The width and height of the generated texture.
 	/// @return True on success.
 */
-using TextureCallback = std::function<bool(const String& name, UniquePtr<const byte[]>& data, Vector2i& dimensions)>;
+using TextureCallback = Function<bool(const String& name, UniquePtr<const byte[]>& data, Vector2i& dimensions)>;
 
 
 /**

+ 4 - 4
Include/RmlUi/Core/Traits.h

@@ -30,6 +30,7 @@
 #define RMLUI_CORE_TRAITS_H
 
 #include "Header.h"
+#include "../Config/Config.h"
 #include <type_traits>
 
 namespace Rml {
@@ -62,7 +63,7 @@ protected:
 };
 
 template<typename T>
-class RMLUICORE_API Releaser final : public ReleaserBase {
+class RMLUICORE_API Releaser : public ReleaserBase {
 public:
 	void operator()(T* target) const {
 		static_assert(std::is_base_of<Releasable, T>::value, "Rml::Releaser can only operate with classes derived from ::Rml::Releasable.");
@@ -155,7 +156,6 @@ const char* rmlui_type_name(const T& var)
 	return typeid(var).name();
 }
 
-#endif
+#endif	// RMLUI_USE_CUSTOM_RTTI
 
-
-#endif
+#endif	// RMLUI_CORE_TRAITS_H

+ 1 - 1
Include/RmlUi/Core/Transform.h

@@ -52,7 +52,7 @@ class Property;
 class RMLUICORE_API Transform
 {
 public:
-	using PrimitiveList = std::vector< TransformPrimitive >;
+	using PrimitiveList = Vector< TransformPrimitive >;
 
 	/// Default constructor, initializes an identity transform
 	Transform();

+ 6 - 7
Include/RmlUi/Core/TransformPrimitive.h

@@ -32,7 +32,6 @@
 #include "Header.h"
 #include "Types.h"
 #include "Property.h"
-#include <array>
 
 namespace Rml {
 namespace Transforms {
@@ -49,25 +48,25 @@ struct RMLUICORE_API NumericValue {
 template< size_t N >
 struct RMLUICORE_API ResolvedPrimitive
 {
-	std::array<float, N> values;
+	Array<float, N> values;
 
 protected:
 	ResolvedPrimitive(const float* values) noexcept;
 	ResolvedPrimitive(const NumericValue* values) noexcept;
-	ResolvedPrimitive(const NumericValue* values, std::array<Property::Unit, N> base_units) noexcept;
-	ResolvedPrimitive(std::array<NumericValue, N> values, std::array<Property::Unit, N> base_units) noexcept;
-	ResolvedPrimitive(std::array<float, N> values) noexcept;
+	ResolvedPrimitive(const NumericValue* values, Array<Property::Unit, N> base_units) noexcept;
+	ResolvedPrimitive(Array<NumericValue, N> values, Array<Property::Unit, N> base_units) noexcept;
+	ResolvedPrimitive(Array<float, N> values) noexcept;
 };
 
 // An unresolved primitive may have values that depend on the final layout of a given element, such as its width.
 template< size_t N >
 struct RMLUICORE_API UnresolvedPrimitive
 {
-	std::array<NumericValue, N> values;
+	Array<NumericValue, N> values;
 
 protected:
 	UnresolvedPrimitive(const NumericValue* values) noexcept;
-	UnresolvedPrimitive(std::array<NumericValue, N> values) noexcept;
+	UnresolvedPrimitive(Array<NumericValue, N> values) noexcept;
 };
 
 

+ 1 - 3
Include/RmlUi/Core/Tween.h

@@ -28,13 +28,11 @@
 #ifndef RMLUI_CORE_TWEEN_H
 #define RMLUI_CORE_TWEEN_H
 
-#include <string>
+#include "Types.h"
 #include "Header.h"
 
 namespace Rml {
 
-using String = std::string;
-
 class RMLUICORE_API Tween {
 public:
 	enum Type { None, Back, Bounce, Circular, Cubic, Elastic, Exponential, Linear, Quadratic, Quartic, Quintic, Sine, Callback, Count };

+ 13 - 67
Include/RmlUi/Core/Types.h

@@ -29,24 +29,13 @@
 #ifndef RMLUI_CORE_TYPES_H
 #define RMLUI_CORE_TYPES_H
 
-#include <string>
+#include "../Config/Config.h"
+
 #include <cstdlib>
 #include <memory>
-#include <utility>
-#include <vector>
 
 #include "Traits.h"
 
-#ifdef RMLUI_NO_THIRDPARTY_CONTAINERS
-#include <set>
-#include <unordered_set>
-#include <unordered_map>
-#else
-#include "Containers/chobo/flat_map.hpp"
-#include "Containers/chobo/flat_set.hpp"
-#include "Containers/robin_hood.h"
-#endif
-
 namespace Rml {
 
 // Commonly used basic types
@@ -59,7 +48,6 @@ enum class Character : char32_t { Null, Replacement = 0xfffd };
 
 }
 
-
 #include "Colour.h"
 #include "Vector2.h"
 #include "Vector3.h"
@@ -80,8 +68,7 @@ using Vector4i = Vector4< int >;
 using Vector4f = Vector4< float >;
 using ColumnMajorMatrix4f = Matrix4< float, ColumnMajorStorage< float > >;
 using RowMajorMatrix4f = Matrix4< float, RowMajorStorage< float > >;
-using Matrix4f = ColumnMajorMatrix4f;
-
+using Matrix4f = RMLUI_MATRIX4_TYPE;
 
 // Common classes
 class Element;
@@ -111,56 +98,15 @@ using DecoratorDataHandle = uintptr_t;
 using FontFaceHandle = uintptr_t;
 using FontEffectsHandle = uintptr_t;
 
-// Strings
-using String = std::string;
-using StringList = std::vector< String >;
-using U16String = std::u16string;
-
-// Smart pointer types
-template<typename T>
-using UniquePtr = std::unique_ptr<T>;
-template<typename T>
-using UniqueReleaserPtr = std::unique_ptr<T, Releaser<T>>;
-template<typename T>
-using SharedPtr = std::shared_ptr<T>;
-template<typename T>
-using WeakPtr = std::weak_ptr<T>;
-
 using ElementPtr = UniqueReleaserPtr<Element>;
 using ContextPtr = UniqueReleaserPtr<Context>;
 using EventPtr = UniqueReleaserPtr<Event>;
 
-// Containers
-#ifdef RMLUI_NO_THIRDPARTY_CONTAINERS
-template <typename Key, typename Value>
-using UnorderedMap = std::unordered_map< Key, Value >;
-template <typename Key, typename Value>
-using SmallUnorderedMap = UnorderedMap< Key, Value >;
-template <typename T>
-using UnorderedSet = std::unordered_set< T >;
-template <typename T>
-using SmallUnorderedSet = std::unordered_set< T >;
-template <typename T>
-using SmallOrderedSet = std::set< T >;
-#else
-template < typename Key, typename Value>
-using UnorderedMap = robin_hood::unordered_flat_map< Key, Value >;
-template <typename Key, typename Value>
-using SmallUnorderedMap = chobo::flat_map< Key, Value >;
-template <typename T>
-using UnorderedSet = robin_hood::unordered_flat_set< T >;
-template <typename T>
-using SmallUnorderedSet = chobo::flat_set< T >;
-template <typename T>
-using SmallOrderedSet = chobo::flat_set< T >;
-#endif
-
-
 // Container types for common classes
-using ElementList = std::vector< Element* >;
-using OwnedElementList = std::vector< ElementPtr >;
-using VariantList = std::vector< Variant >;
-using ElementAnimationList = std::vector< ElementAnimation >;
+using ElementList = Vector< Element* >;
+using OwnedElementList = Vector< ElementPtr >;
+using VariantList = Vector< Variant >;
+using ElementAnimationList = Vector< ElementAnimation >;
 
 using PseudoClassList = SmallUnorderedSet< String >;
 using AttributeNameList = SmallUnorderedSet< String >;
@@ -170,9 +116,9 @@ using Dictionary = SmallUnorderedMap< String, Variant >;
 using ElementAttributes = Dictionary;
 using XMLAttributes = Dictionary;
 
-using AnimationList = std::vector<Animation>;
-using DecoratorList = std::vector<SharedPtr<const Decorator>>;
-using FontEffectList = std::vector<SharedPtr<const FontEffect>>;
+using AnimationList = Vector<Animation>;
+using DecoratorList = Vector<SharedPtr<const Decorator>>;
+using FontEffectList = Vector<SharedPtr<const FontEffect>>;
 
 struct Decorators {
 	DecoratorList list;
@@ -201,11 +147,11 @@ namespace std {
 // Hash specialization for enum class types (required on some older compilers)
 template <> struct hash<::Rml::PropertyId> {
 	using utype = typename ::std::underlying_type<::Rml::PropertyId>::type;
-	size_t operator() (const ::Rml::PropertyId& t) const { ::std::hash<utype> h; return h(static_cast<utype>(t)); }
+	size_t operator() (const ::Rml::PropertyId& t) const { ::Rml::Hash<utype> h; return h(static_cast<utype>(t)); }
 };
 template <> struct hash<::Rml::Character> {
-    using utype = typename ::std::underlying_type<::Rml::Character>::type;
-    size_t operator() (const ::Rml::Character& t) const { ::std::hash<utype> h; return h(static_cast<utype>(t)); }
+	using utype = typename ::std::underlying_type<::Rml::Character>::type;
+	size_t operator() (const ::Rml::Character& t) const { ::Rml::Hash<utype> h; return h(static_cast<utype>(t)); }
 };
 template <> struct hash<::Rml::FamilyId> {
 	using utype = typename ::std::underlying_type<::Rml::FamilyId>::type;

+ 4 - 0
Include/RmlUi/Core/Vector2.h

@@ -147,6 +147,10 @@ class Vector2
 		// The components of the vector.
 		Type x;
 		Type y;
+
+#ifdef RMLUI_VECTOR2_USER_EXTRA
+		RMLUI_VECTOR2_USER_EXTRA
+#endif
 };
 
 } // namespace Rml

+ 4 - 0
Include/RmlUi/Core/Vector3.h

@@ -133,6 +133,10 @@ class Vector3
 		Type x;
 		Type y;
 		Type z;
+
+#ifdef RMLUI_VECTOR3_USER_EXTRA
+		RMLUI_VECTOR3_USER_EXTRA
+#endif
 };
 
 } // namespace Rml

+ 4 - 0
Include/RmlUi/Core/Vector4.h

@@ -138,6 +138,10 @@ class Vector4
 		Type y;
 		Type z;
 		Type w;
+
+#ifdef RMLUI_VECTOR4_USER_EXTRA
+		RMLUI_VECTOR4_USER_EXTRA
+#endif
 };
 
 } // namespace Rml

+ 1 - 1
Include/RmlUi/Core/XMLParser.h

@@ -109,7 +109,7 @@ private:
 	XMLNodeHandler* active_handler;
 
 	// The parser stack.
-	using ParserStack = std::stack< ParseFrame >;
+	using ParserStack = Stack< ParseFrame >;
 	ParserStack stack;
 };
 

+ 4 - 4
Samples/basic/bitmapfont/src/FontEngineBitmap.cpp

@@ -33,7 +33,7 @@
 
 namespace FontProviderBitmap
 {
-	static std::vector<std::unique_ptr<FontFaceBitmap>> fonts;
+	static Rml::Vector<Rml::UniquePtr<FontFaceBitmap>> fonts;
 
 
 	void Initialise()
@@ -48,7 +48,7 @@ namespace FontProviderBitmap
 	bool LoadFontFace(const String& file_name)
 	{
 		// Load the xml meta file into memory
-		std::unique_ptr<byte[]> data;
+		Rml::UniquePtr<byte[]> data;
 		size_t length = 0;
 
 		{
@@ -73,7 +73,7 @@ namespace FontProviderBitmap
 		FontParserBitmap parser;
 
 		{
-			auto stream = std::make_unique<Rml::StreamMemory>(data.get(), length);
+			auto stream = Rml::MakeUnique<Rml::StreamMemory>(data.get(), length);
 			stream->SetSourceURL(file_name);
 
 			parser.Parse(stream.get());
@@ -91,7 +91,7 @@ namespace FontProviderBitmap
 
 		// Construct and add the font face
 		fonts.push_back(
-			std::make_unique<FontFaceBitmap>( 
+			Rml::MakeUnique<FontFaceBitmap>( 
 				parser.family, parser.style, parser.weight, parser.metrics, texture, parser.texture_dimensions, std::move(parser.glyphs), std::move(parser.kerning)
 		));
 

+ 12 - 12
Samples/basic/databinding/src/main.cpp

@@ -75,9 +75,9 @@ namespace EventsExample {
 		Rml::String mouse_detector = "Mouse-move <em>Detector</em>.";
 		int rating = 99;
 
-		std::vector<float> list = { 1, 2, 3, 4, 5 };
+		Rml::Vector<float> list = { 1, 2, 3, 4, 5 };
 
-		std::vector<Rml::Vector2f> positions;
+		Rml::Vector<Rml::Vector2f> positions;
 
 		void AddMousePos(Rml::DataModelHandle model, Rml::Event& ev, const Rml::VariantList& /*arguments*/)
 		{
@@ -108,14 +108,14 @@ namespace EventsExample {
 			return false;
 
 		// Register all the types first
-		constructor.RegisterArray<std::vector<float>>();
+		constructor.RegisterArray<Rml::Vector<float>>();
 
 		if (auto vec2_handle = constructor.RegisterStruct<Vector2f>())
 		{
 			vec2_handle.RegisterMember("x", &Vector2f::x);
 			vec2_handle.RegisterMember("y", &Vector2f::y);
 		}
-		constructor.RegisterArray<std::vector<Vector2f>>();
+		constructor.RegisterArray<Rml::Vector<Vector2f>>();
 
 		// Bind the variables to the data model
 		constructor.Bind("hello_world", &my_data.hello_world);
@@ -169,7 +169,7 @@ namespace InvadersExample {
 		Rml::String name;
 		Rml::String sprite;
 		Rml::Colourb color{ 255, 255, 255 };
-		std::vector<int> damage;
+		Rml::Vector<int> damage;
 		float danger_rating = 50;
 
 		void GetColor(Rml::Variant& variant) {
@@ -190,7 +190,7 @@ namespace InvadersExample {
 
 		float incoming_invaders_rate = 10; // Per minute
 
-		std::vector<Invader> invaders = {
+		Rml::Vector<Invader> invaders = {
 			Invader{"Angry invader", "icon-invader", {255, 40, 30}, {3, 6, 7}, 80}
 		};
 
@@ -209,7 +209,7 @@ namespace InvadersExample {
 			return false;
 
 		// Since Invader::damage is an array type.
-		constructor.RegisterArray<std::vector<int>>();
+		constructor.RegisterArray<Rml::Vector<int>>();
 
 		// Structs are registered by adding all its members through the returned handle.
 		if (auto invader_handle = constructor.RegisterStruct<Invader>())
@@ -225,7 +225,7 @@ namespace InvadersExample {
 
 		// We can even have an Array of Structs, infinitely nested if we so desire.
 		// Make sure the underlying type (here Invader) is registered before the array.
-		constructor.RegisterArray<std::vector<Invader>>();
+		constructor.RegisterArray<Rml::Vector<Invader>>();
 
 		// Now we can bind the variables to the model.
 		constructor.Bind("incoming_invaders_rate", &invaders_data.incoming_invaders_rate);
@@ -247,9 +247,9 @@ namespace InvadersExample {
 		{
 			using namespace Rml;
 			const int num_items = 4;
-			static std::array<String, num_items> names = { "Angry invader", "Harmless invader", "Deceitful invader", "Cute invader" };
-			static std::array<String, num_items> sprites = { "icon-invader", "icon-flag", "icon-game", "icon-waves" };
-			static std::array<Colourb, num_items> colors = { { { 255, 40, 30 }, {20, 40, 255}, {255, 255, 30}, {230, 230, 230} } };
+			static Array<String, num_items> names = { "Angry invader", "Harmless invader", "Deceitful invader", "Cute invader" };
+			static Array<String, num_items> sprites = { "icon-invader", "icon-flag", "icon-game", "icon-waves" };
+			static Array<Colourb, num_items> colors = { { { 255, 40, 30 }, {20, 40, 255}, {255, 255, 30}, {230, 230, 230} } };
 
 			Invader new_invader;
 			new_invader.name = names[rand() % num_items];
@@ -424,7 +424,7 @@ int main(int RMLUI_UNUSED_PARAMETER(argc), char** RMLUI_UNUSED_PARAMETER(argv))
 	
 	Shell::LoadFonts("assets/");
 
-	auto demo_window = std::make_unique<DemoWindow>("Data binding", Rml::Vector2f(150, 50), context);
+	auto demo_window = Rml::MakeUnique<DemoWindow>("Data binding", Rml::Vector2f(150, 50), context);
 	demo_window->GetDocument()->AddEventListener(Rml::EventId::Keydown, demo_window.get());
 	demo_window->GetDocument()->AddEventListener(Rml::EventId::Keyup, demo_window.get());
 

+ 4 - 4
Samples/basic/demo/src/main.cpp

@@ -102,7 +102,7 @@ public:
 				Rml::StreamMemory stream((Rml::byte*)style_sheet_content.data(), style_sheet_content.size());
 				stream.SetSourceURL("sandbox://default_rcss");
 
-				rml_basic_style_sheet = std::make_shared<Rml::StyleSheet>();
+				rml_basic_style_sheet = MakeShared<Rml::StyleSheet>();
 				rml_basic_style_sheet->LoadStyleSheet(&stream);
 			}
 
@@ -224,7 +224,7 @@ public:
 	{
 		if (iframe && rml_basic_style_sheet)
 		{
-			auto style = std::make_shared<Rml::StyleSheet>();
+			auto style = Rml::MakeShared<Rml::StyleSheet>();
 			Rml::StreamMemory stream((const Rml::byte*)string.data(), string.size());
 			stream.SetSourceURL("sandbox://rcss");
 
@@ -256,7 +256,7 @@ private:
 
 Rml::Context* context = nullptr;
 ShellRenderInterfaceExtensions *shell_renderer;
-std::unique_ptr<DemoWindow> demo_window;
+Rml::UniquePtr<DemoWindow> demo_window;
 
 struct TweeningParameters {
 	Rml::Tween::Type type = Rml::Tween::Linear;
@@ -507,7 +507,7 @@ int main(int RMLUI_UNUSED_PARAMETER(argc), char** RMLUI_UNUSED_PARAMETER(argv))
 
 	Shell::LoadFonts("assets/");
 
-	demo_window = std::make_unique<DemoWindow>("Demo sample", Rml::Vector2f(150, 50), context);
+	demo_window = Rml::MakeUnique<DemoWindow>("Demo sample", Rml::Vector2f(150, 50), context);
 	demo_window->GetDocument()->AddEventListener(Rml::EventId::Keydown, demo_window.get());
 	demo_window->GetDocument()->AddEventListener(Rml::EventId::Keyup, demo_window.get());
 	demo_window->GetDocument()->AddEventListener(Rml::EventId::Animationend, demo_window.get());

+ 3 - 3
Samples/basic/sdl2/src/RenderInterfaceSDL2.cpp

@@ -49,9 +49,9 @@ void RmlUiSDL2Renderer::RenderGeometry(Rml::Vertex* vertices, int num_vertices,
     glPushMatrix();
     glTranslatef(translation.x, translation.y, 0);
  
-    std::vector<Rml::Vector2f> Positions(num_vertices);
-    std::vector<Rml::Colourb> Colors(num_vertices);
-    std::vector<Rml::Vector2f> TexCoords(num_vertices);
+    Rml::Vector<Rml::Vector2f> Positions(num_vertices);
+    Rml::Vector<Rml::Colourb> Colors(num_vertices);
+    Rml::Vector<Rml::Vector2f> TexCoords(num_vertices);
     float texw = 0.0f;
     float texh = 0.0f;
  

+ 1 - 1
Samples/basic/sdl2/src/SystemInterfaceSDL2.cpp

@@ -410,7 +410,7 @@ double RmlUiSDL2SystemInterface::GetElapsedTime()
 
 bool RmlUiSDL2SystemInterface::LogMessage(Rml::Log::Type type, const Rml::String& message)
 {
-	std::string Type;
+	Rml::String Type;
 
 	switch(type)
 	{

+ 4 - 4
Samples/basic/sfml2/src/RenderInterfaceSFML.cpp

@@ -86,9 +86,9 @@ void RmlUiSFMLRenderer::RenderGeometry(Rml::Vertex* vertices, int num_vertices,
 
 	glTranslatef(translation.x, translation.y, 0);
 
-	std::vector<Rml::Vector2f> Positions(num_vertices);
-	std::vector<Rml::Colourb> Colors(num_vertices);
-	std::vector<Rml::Vector2f> TexCoords(num_vertices);
+	Rml::Vector<Rml::Vector2f> Positions(num_vertices);
+	Rml::Vector<Rml::Colourb> Colors(num_vertices);
+	Rml::Vector<Rml::Vector2f> TexCoords(num_vertices);
 
 	for(int i = 0; i < num_vertices; i++)
 	{
@@ -135,7 +135,7 @@ void RmlUiSFMLRenderer::RenderGeometry(Rml::Vertex* vertices, int num_vertices,
 Rml::CompiledGeometryHandle RmlUiSFMLRenderer::CompileGeometry(Rml::Vertex* vertices, int num_vertices, int* indices, int num_indices, const Rml::TextureHandle texture)
 {
 #ifdef ENABLE_GLEW
-	std::vector<RmlUiSFMLRendererVertex> Data(num_vertices);
+	Rml::Vector<RmlUiSFMLRendererVertex> Data(num_vertices);
 
 	for(std::size_t i = 0; i < Data.size(); i++)
 	{

+ 1 - 1
Samples/basic/sfml2/src/SystemInterfaceSFML.cpp

@@ -314,7 +314,7 @@ double RmlUiSFMLSystemInterface::GetElapsedTime()
 
 bool RmlUiSFMLSystemInterface::LogMessage(Rml::Log::Type type, const Rml::String& message)
 {
-	std::string Type;
+	Rml::String Type;
 
 	switch(type)
 	{

+ 1 - 1
Samples/basic/treeview/src/FileSystem.cpp

@@ -117,7 +117,7 @@ struct FileSystemNode
 		}
 	}
 
-	typedef std::vector< FileSystemNode* > NodeList;
+	typedef Rml::Vector< FileSystemNode* > NodeList;
 
 	Rml::String id;
 	Rml::String name;

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

@@ -43,7 +43,7 @@ DecoratorInstancerDefender::~DecoratorInstancerDefender()
 }
 
 // Instances a decorator given the property tag and attributes from the RCSS file.
-std::shared_ptr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
 	const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& /*interface*/)
 {
 	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
@@ -52,7 +52,7 @@ std::shared_ptr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(co
 	if (auto & source = image_source_property->source)
 		source_path = source->path;
 
-	auto decorator = std::make_shared<DecoratorDefender>();
+	auto decorator = Rml::MakeShared<DecoratorDefender>();
 	if (decorator->Initialise(image_source, source_path))
 		return decorator;
 	

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

@@ -45,7 +45,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, nullptr if an error occured.
-	std::shared_ptr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
 
 private:
 	Rml::PropertyId id_image_src;

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

@@ -47,7 +47,7 @@ DecoratorInstancerStarfield::~DecoratorInstancerStarfield()
 }
 
 // Instances a decorator given the property tag and attributes from the RCSS file.
-std::shared_ptr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rml::String& /*name*/,
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rml::String& /*name*/,
 	const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& /*interface*/)
 {
 	int num_layers = Rml::Math::RealToInteger(properties.GetProperty(id_num_layers)->Get< float >());
@@ -58,7 +58,7 @@ std::shared_ptr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(c
 	int top_density = Rml::Math::RealToInteger(properties.GetProperty(id_top_density)->Get< float >());
 	int bottom_density = Rml::Math::RealToInteger(properties.GetProperty(id_bottom_density)->Get< float >());
 
-	auto decorator = std::make_shared<DecoratorStarfield>();
+	auto decorator = Rml::MakeShared<DecoratorStarfield>();
 	if (decorator->Initialise(num_layers, top_colour, bottom_colour, top_speed, bottom_speed, top_density, bottom_density))
 		return decorator;
 

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

@@ -46,7 +46,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, nullptr if an error occured.
-	std::shared_ptr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
 
 private:
 	Rml::PropertyId id_num_layers, id_top_colour, id_bottom_colour, id_top_speed, id_bottom_speed, id_top_density, id_bottom_density;

+ 3 - 3
Samples/invaders/src/DecoratorStarfield.h

@@ -29,8 +29,8 @@
 #ifndef RMLUI_INVADERS_DECORATORSTARFIELD_H
 #define RMLUI_INVADERS_DECORATORSTARFIELD_H
 
+#include <RmlUi/Core/Types.h>
 #include <RmlUi/Core/Decorator.h>
-#include <vector>
 
 class DecoratorStarfield : public Rml::Decorator
 {
@@ -63,7 +63,7 @@ private:
 
 	struct StarLayer
 	{
-		typedef std::vector< Rml::Vector2f > StarList;
+		typedef Rml::Vector< Rml::Vector2f > StarList;
 		StarList stars;
 		Rml::Colourb colour;
 		float speed;
@@ -75,7 +75,7 @@ private:
 		double last_update;
 		Rml::Vector2f dimensions;
 
-		typedef std::vector< StarLayer > StarLayerList;
+		typedef Rml::Vector< StarLayer > StarLayerList;
 		StarLayerList star_layers;
 	};
 };

+ 2 - 2
Samples/luainvaders/src/DecoratorInstancerDefender.cpp

@@ -43,7 +43,7 @@ DecoratorInstancerDefender::~DecoratorInstancerDefender()
 }
 
 // Instances a decorator given the property tag and attributes from the RCSS file.
-std::shared_ptr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
 	const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& /*interface*/)
 {
 	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
@@ -52,7 +52,7 @@ std::shared_ptr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(co
 	if (auto & source = image_source_property->source)
 		source_path = source->path;
 
-	auto decorator = std::make_shared<DecoratorDefender>();
+	auto decorator = Rml::MakeShared<DecoratorDefender>();
 	if (decorator->Initialise(image_source, source_path))
 		return decorator;
 

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

@@ -45,7 +45,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, nullptr if an error occured.
-	std::shared_ptr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
 
 private:
 	Rml::PropertyId id_image_src;

+ 2 - 2
Samples/luainvaders/src/DecoratorInstancerStarfield.cpp

@@ -47,7 +47,7 @@ DecoratorInstancerStarfield::~DecoratorInstancerStarfield()
 }
 
 // Instances a decorator given the property tag and attributes from the RCSS file.
-std::shared_ptr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rml::String& /*name*/,
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rml::String& /*name*/,
 	const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& /*interface*/)
 {
 	int num_layers = Rml::Math::RealToInteger(properties.GetProperty(id_num_layers)->Get< float >());
@@ -58,7 +58,7 @@ std::shared_ptr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(c
 	int top_density = Rml::Math::RealToInteger(properties.GetProperty(id_top_density)->Get< float >());
 	int bottom_density = Rml::Math::RealToInteger(properties.GetProperty(id_bottom_density)->Get< float >());
 
-	auto decorator = std::make_shared<DecoratorStarfield>();
+	auto decorator = Rml::MakeShared<DecoratorStarfield>();
 	if (decorator->Initialise(num_layers, top_colour, bottom_colour, top_speed, bottom_speed, top_density, bottom_density))
 		return decorator;
 

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

@@ -46,7 +46,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, nullptr if an error occured.
-	std::shared_ptr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
 
 private:
 	Rml::PropertyId id_num_layers, id_top_colour, id_bottom_colour, id_top_speed, id_bottom_speed, id_top_density, id_bottom_density;

+ 3 - 3
Samples/luainvaders/src/DecoratorStarfield.h

@@ -29,8 +29,8 @@
 #ifndef RMLUI_LUAINVADERS_DECORATORSTARFIELD_H
 #define RMLUI_LUAINVADERS_DECORATORSTARFIELD_H
 
+#include <RmlUi/Core/Types.h>
 #include <RmlUi/Core/Decorator.h>
-#include <vector>
 
 class DecoratorStarfield : public Rml::Decorator
 {
@@ -63,7 +63,7 @@ private:
 
 	struct StarLayer
 	{
-		typedef std::vector< Rml::Vector2f > StarList;
+		typedef Rml::Vector< Rml::Vector2f > StarList;
 		StarList stars;
 		Rml::Colourb colour;
 		float speed;
@@ -75,7 +75,7 @@ private:
 		double last_update;
 		Rml::Vector2f dimensions;
 
-		typedef std::vector< StarLayer > StarLayerList;
+		typedef Rml::Vector< StarLayer > StarLayerList;
 		StarLayerList star_layers;
 	};
 };

+ 2 - 2
Samples/shell/src/macosx/ShellMacOSX.cpp

@@ -57,7 +57,7 @@ static WindowRef window;
 static timeval start_time;
 static Rml::String clipboard_text;
 
-static std::unique_ptr<ShellFileInterface> file_interface;
+static Rml::UniquePtr<ShellFileInterface> file_interface;
 
 static void IdleTimerCallback(EventLoopTimerRef timer, EventLoopIdleTimerMessage inState, void* p);
 static OSStatus EventHandler(EventHandlerCallRef next_handler, EventRef event, void* p);
@@ -70,7 +70,7 @@ bool Shell::Initialise()
 
 	Rml::String root = FindSamplesRoot();
 
-	file_interface = std::make_unique<ShellFileInterface>(root);
+	file_interface = Rml::MakeUnique<ShellFileInterface>(root);
 	Rml::SetFileInterface(file_interface.get());
 
 	return true;

+ 2 - 2
Samples/shell/src/win32/ShellWin32.cpp

@@ -46,7 +46,7 @@ static HINSTANCE instance_handle = nullptr;
 static double time_frequency;
 static LARGE_INTEGER time_startup;
 
-static std::unique_ptr<ShellFileInterface> file_interface;
+static Rml::UniquePtr<ShellFileInterface> file_interface;
 
 static HCURSOR cursor_default = nullptr;
 static HCURSOR cursor_move = nullptr;
@@ -80,7 +80,7 @@ bool Shell::Initialise()
 	Rml::String root = FindSamplesRoot();
 	bool result = !root.empty();
 	
-	file_interface = std::make_unique<ShellFileInterface>(root);
+	file_interface = Rml::MakeUnique<ShellFileInterface>(root);
 	Rml::SetFileInterface(file_interface.get());
 
 	return result;

+ 2 - 2
Samples/shell/src/x11/ShellX11.cpp

@@ -50,7 +50,7 @@ static int screen = -1;
 static timeval start_time;
 static Rml::String clipboard_text;
 
-static std::unique_ptr<ShellFileInterface> file_interface;
+static Rml::UniquePtr<ShellFileInterface> file_interface;
 
 static Cursor cursor_default = 0;
 static Cursor cursor_move = 0;
@@ -74,7 +74,7 @@ bool Shell::Initialise()
 	Rml::String root = FindSamplesRoot();
 	bool result = !root.empty();
 
-	file_interface = std::make_unique<ShellFileInterface>(root);
+	file_interface = Rml::MakeUnique<ShellFileInterface>(root);
 	Rml::SetFileInterface(file_interface.get());
 
 	return result;

+ 2 - 2
Samples/tutorial/datagrid/src/DecoratorInstancerDefender.cpp

@@ -26,7 +26,7 @@ DecoratorInstancerDefender::~DecoratorInstancerDefender()
 }
 
 // Instances a decorator given the property tag and attributes from the RCSS file.
-std::shared_ptr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
 	const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& /*interface*/)
 {
 	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
@@ -35,7 +35,7 @@ std::shared_ptr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(co
 	if (auto & source = image_source_property->source)
 		source_path = source->path;
 
-	auto decorator = std::make_shared<DecoratorDefender>();
+	auto decorator = Rml::MakeShared<DecoratorDefender>();
 	if (decorator->Initialise(image_source, source_path))
 		return decorator;
 

+ 1 - 1
Samples/tutorial/datagrid/src/DecoratorInstancerDefender.h

@@ -30,7 +30,7 @@ public:
 	/// @param[in] properties All RCSS properties associated with the decorator.
 	/// @param[in] interface An interface for querying the active style sheet.
 	/// @return A shared_ptr to the decorator if it was instanced successfully.
-	std::shared_ptr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
 
 private:
 	Rml::PropertyId id_image_src;

+ 2 - 2
Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.cpp

@@ -26,7 +26,7 @@ DecoratorInstancerDefender::~DecoratorInstancerDefender()
 }
 
 // Instances a decorator given the property tag and attributes from the RCSS file.
-std::shared_ptr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
 	const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& /*interface*/)
 {
 	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
@@ -35,7 +35,7 @@ std::shared_ptr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(co
 	if (auto & source = image_source_property->source)
 		source_path = source->path;
 
-	auto decorator = std::make_shared<DecoratorDefender>();
+	auto decorator = Rml::MakeShared<DecoratorDefender>();
 	if (decorator->Initialise(image_source, source_path))
 		return decorator;
 

+ 1 - 1
Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.h

@@ -30,7 +30,7 @@ public:
 	/// @param[in] properties All RCSS properties associated with the decorator.
 	/// @param[in] interface An interface for querying the active style sheet.
 	/// @return A shared_ptr to the decorator if it was instanced successfully.
-	std::shared_ptr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& interface) override;
 
 private:
 	Rml::PropertyId id_image_src;

+ 21 - 11
Source/Core/Context.cpp

@@ -63,7 +63,7 @@ Context::Context(const String& name) : name(name), dimensions(0, 0), density_ind
 	root->SetOffset(Vector2f(0, 0), nullptr);
 	root->SetProperty(PropertyId::ZIndex, Property(0, Property::NUMBER));
 
-	cursor_proxy = Factory::InstanceElement(nullptr, "body", "body", XMLAttributes());
+	cursor_proxy = Factory::InstanceElement(nullptr, documents_base_tag, documents_base_tag, XMLAttributes());
 	ElementDocument* cursor_proxy_document = rmlui_dynamic_cast< ElementDocument* >(cursor_proxy.get());
 	if (cursor_proxy_document)
 		cursor_proxy_document->context = this;
@@ -214,20 +214,20 @@ bool Context::Render()
 	return true;
 }
 
-// Creates a new, empty document and places it into this context.
-ElementDocument* Context::CreateDocument(const String& tag)
+// Creates a new, empty document and places it into this context. 
+ElementDocument* Context::CreateDocument(const String& instancer_name)
 {
-	ElementPtr element = Factory::InstanceElement(nullptr, tag, "body", XMLAttributes());
+	ElementPtr element = Factory::InstanceElement(nullptr, instancer_name, documents_base_tag, XMLAttributes());
 	if (!element)
 	{
-		Log::Message(Log::LT_ERROR, "Failed to instance document on tag '%s', instancer returned nullptr.", tag.c_str());
+		Log::Message(Log::LT_ERROR, "Failed to instance document on instancer_name '%s', instancer returned nullptr.", instancer_name.c_str());
 		return nullptr;
 	}
 
 	ElementDocument* document = rmlui_dynamic_cast< ElementDocument* >(element.get());
 	if (!document)
 	{
-		Log::Message(Log::LT_ERROR, "Failed to instance document on tag '%s', Found type '%s', was expecting derivative of ElementDocument.", tag.c_str(), rmlui_type_name(*element));
+		Log::Message(Log::LT_ERROR, "Failed to instance document on instancer_name '%s', Found type '%s', was expecting derivative of ElementDocument.", instancer_name.c_str(), rmlui_type_name(*element));
 		return nullptr;
 	}
 
@@ -242,7 +242,7 @@ ElementDocument* Context::CreateDocument(const String& tag)
 // Load a document into the context.
 ElementDocument* Context::LoadDocument(const String& document_path)
 {	
-	auto stream = std::make_unique<StreamFile>();
+	auto stream = MakeUnique<StreamFile>();
 
 	if (!stream->Open(document_path))
 		return nullptr;
@@ -283,7 +283,7 @@ ElementDocument* Context::LoadDocument(Stream* stream)
 ElementDocument* Context::LoadDocumentFromMemory(const String& string)
 {
 	// Open the stream based on the string contents.
-	auto stream = std::make_unique<StreamMemory>((byte*)string.c_str(), string.size());
+	auto stream = MakeUnique<StreamMemory>((byte*)string.c_str(), string.size());
 	stream->SetSourceURL("[document from memory]");
 
 	// Load the document from the stream.
@@ -800,9 +800,9 @@ void Context::SetInstancer(ContextInstancer* _instancer)
 DataModelConstructor Context::CreateDataModel(const String& name)
 {
 	if (!data_type_register)
-		data_type_register = std::make_unique<DataTypeRegister>();
+		data_type_register = MakeUnique<DataTypeRegister>();
 
-	auto result = data_models.emplace(name, std::make_unique<DataModel>(data_type_register->GetTransformFuncRegister()));
+	auto result = data_models.emplace(name, MakeUnique<DataModel>(data_type_register->GetTransformFuncRegister()));
 	bool inserted = result.second;
 	if (inserted)
 		return DataModelConstructor(result.first->second.get(), data_type_register.get());
@@ -1253,7 +1253,7 @@ void Context::ReleaseUnloadedDocuments()
 	}
 }
 
-using ElementObserverList = std::vector< ObserverPtr<Element> >;
+using ElementObserverList = Vector< ObserverPtr<Element> >;
 
 class ElementObserverListBackInserter {
 public:
@@ -1298,4 +1298,14 @@ void Context::Release()
 	}
 }
 
+void Context::SetDocumentsBaseTag(const String& tag)
+{
+	documents_base_tag = tag;
+}
+
+const String& Context::GetDocumentsBaseTag()
+{
+	return documents_base_tag;
+}
+
 } // namespace Rml

+ 2 - 2
Source/Core/Core.cpp

@@ -88,7 +88,7 @@ bool Initialise()
 	if (!file_interface)
 	{		
 #ifndef RMLUI_NO_FILE_INTERFACE_DEFAULT
-		default_file_interface = std::make_unique<FileInterfaceDefault>();
+		default_file_interface = MakeUnique<FileInterfaceDefault>();
 		file_interface = default_file_interface.get();
 #else
 		Log::Message(Log::LT_ERROR, "No file interface set!");
@@ -105,7 +105,7 @@ bool Initialise()
 	if (!font_interface)
 	{
 #ifndef RMLUI_NO_FONT_INTERFACE_DEFAULT
-		default_font_interface = std::make_unique<FontEngineInterfaceDefault>();
+		default_font_interface = MakeUnique<FontEngineInterfaceDefault>();
 		font_interface = default_font_interface.get();
 #else
 		Log::Message(Log::LT_ERROR, "No font interface set!");

+ 1 - 1
Source/Core/DataControllerDefault.cpp

@@ -117,7 +117,7 @@ bool DataControllerEvent::Initialize(DataModel& model, Element* element, const S
 {
 	RMLUI_ASSERT(element);
 
-	expression = std::make_unique<DataExpression>(expression_str);
+	expression = MakeUnique<DataExpression>(expression_str);
 	DataExpressionInterface interface(&model, element);
 
 	if (!expression->Parse(interface, true))

+ 2 - 2
Source/Core/DataExpression.cpp

@@ -805,8 +805,8 @@ public:
 
 private:
 	Variant R, L, C;
-	std::stack<Variant> stack;
-	std::vector<Variant> arguments;
+	Stack<Variant> stack;
+	Vector<Variant> arguments;
 
 	const Program& program;
 	const AddressList& addresses;

+ 2 - 2
Source/Core/DataExpression.h

@@ -38,8 +38,8 @@ namespace Rml {
 class Element;
 class DataModel;
 struct InstructionData;
-using Program = std::vector<InstructionData>;
-using AddressList = std::vector<DataAddress>;
+using Program = Vector<InstructionData>;
+using AddressList = Vector<DataAddress>;
 
 class DataExpressionInterface {
 public:

+ 3 - 4
Source/Core/DataModel.cpp

@@ -30,7 +30,6 @@
 #include "../../Include/RmlUi/Core/DataController.h"
 #include "../../Include/RmlUi/Core/DataView.h"
 #include "../../Include/RmlUi/Core/Element.h"
-#include <array>
 
 namespace Rml {
 
@@ -122,8 +121,8 @@ static String DataAddressToString(const DataAddress& address)
 
 DataModel::DataModel(const TransformFuncRegister* transform_register) : transform_register(transform_register)
 {
-	views = std::make_unique<DataViews>();
-	controllers = std::make_unique<DataControllers>();
+	views = MakeUnique<DataViews>();
+	controllers = MakeUnique<DataControllers>();
 }
 
 DataModel::~DataModel()
@@ -175,7 +174,7 @@ bool DataModel::BindFunc(const String& name, DataGetFunc get_func, DataSetFunc s
 		return false;
 	}
 	auto& func_definition_ptr = it->second;
-	func_definition_ptr = std::make_unique<FuncDefinition>(std::move(get_func), std::move(set_func));
+	func_definition_ptr = MakeUnique<FuncDefinition>(std::move(get_func), std::move(set_func));
 
 	return BindVariable(name, DataVariable(func_definition_ptr.get(), nullptr));
 }

+ 1 - 1
Source/Core/DataView.cpp

@@ -93,7 +93,7 @@ bool DataViews::Update(DataModel& model, const DirtyVariables& dirty_variables)
 	//   Without the loop, newly added views won't be updated until the next Update() call.
 	for(int i = 0; i == 0 || (!views_to_add.empty() && i < 10); i++)
 	{
-		std::vector<DataView*> dirty_views;
+		Vector<DataView*> dirty_views;
 
 		if (!views_to_add.empty())
 		{

+ 4 - 4
Source/Core/DataViewDefault.cpp

@@ -45,7 +45,7 @@ bool DataViewCommon::Initialize(DataModel& model, Element* element, const String
 	if (modifier.empty())
 		modifier = in_modifier;
 
-	expression = std::make_unique<DataExpression>(expression_str);
+	expression = MakeUnique<DataExpression>(expression_str);
 	DataExpressionInterface interface(&model, element);
 
 	bool result = expression->Parse(interface, false);
@@ -265,7 +265,7 @@ bool DataViewText::Initialize(DataModel& model, Element* element, const String&
 
 		DataEntry entry;
 		entry.index = text.size();
-		entry.data_expression = std::make_unique<DataExpression>(String(in_text.begin() + begin_name, in_text.begin() + end_name));
+		entry.data_expression = MakeUnique<DataExpression>(String(in_text.begin() + begin_name, in_text.begin() + end_name));
 
 		if (entry.data_expression->Parse(expression_interface, false))
 			data_entries.push_back(std::move(entry));
@@ -336,8 +336,8 @@ StringList DataViewText::GetVariableNameList() const
 
 		StringList entry_list = entry.data_expression->GetVariableNameList();
 		full_list.insert(full_list.end(),
-			std::make_move_iterator(entry_list.begin()),
-			std::make_move_iterator(entry_list.end())
+			MakeMoveIterator(entry_list.begin()),
+			MakeMoveIterator(entry_list.end())
 		);
 	}
 

+ 1 - 1
Source/Core/DataViewDefault.h

@@ -142,7 +142,7 @@ private:
 	};
 
 	String text;
-	std::vector<DataEntry> data_entries;
+	Vector<DataEntry> data_entries;
 };
 
 

+ 1 - 1
Source/Core/DecoratorGradient.cpp

@@ -130,7 +130,7 @@ SharedPtr<Decorator> DecoratorGradientInstancer::InstanceDecorator(const String
 	Colourb start = properties_.GetProperty(ids.start)->Get<Colourb>();
 	Colourb stop = properties_.GetProperty(ids.stop)->Get<Colourb>();
 
-	auto decorator = std::make_shared<DecoratorGradient>();
+	auto decorator = MakeShared<DecoratorGradient>();
 	if (decorator->Initialise(dir, start, stop)) {
 		return decorator;
 	}

+ 6 - 7
Source/Core/DecoratorNinePatch.cpp

@@ -31,7 +31,6 @@
 #include "../../Include/RmlUi/Core/Geometry.h"
 #include "../../Include/RmlUi/Core/ElementUtilities.h"
 #include "../../Include/RmlUi/Core/PropertyDefinition.h"
-#include <array>
 
 namespace Rml {
 
@@ -43,13 +42,13 @@ DecoratorNinePatch::~DecoratorNinePatch()
 {
 }
 
-bool DecoratorNinePatch::Initialise(const Rectangle& _rect_outer, const Rectangle& _rect_inner, const std::array<Property, 4>* _edges, const Texture& _texture)
+bool DecoratorNinePatch::Initialise(const Rectangle& _rect_outer, const Rectangle& _rect_inner, const Array<Property, 4>* _edges, const Texture& _texture)
 {
 	rect_outer = _rect_outer;
 	rect_inner = _rect_inner;
 
 	if (_edges)
-		edges = std::make_unique< std::array<Property, 4> >(*_edges);
+		edges = MakeUnique< Array<Property, 4> >(*_edges);
 
 	int texture_index = AddTexture(_texture);
 	return (texture_index >= 0);
@@ -128,8 +127,8 @@ DecoratorDataHandle DecoratorNinePatch::GenerateElementData(Element* element) co
 
 	/* Now we have all the coordinates we need. Expand the diagonal vertices to the 16 individual vertices. */
 
-	std::vector<Vertex>& vertices = data->GetVertices();
-	std::vector<int>& indices = data->GetIndices();
+	Vector<Vertex>& vertices = data->GetVertices();
+	Vector<int>& indices = data->GetIndices();
 
 	vertices.resize(4 * 4);
 
@@ -202,7 +201,7 @@ SharedPtr<Decorator> DecoratorNinePatchInstancer::InstanceDecorator(const String
 	RMLUI_UNUSED(name);
 
 	bool edges_set = false;
-	std::array<Property,4> edges;
+	Array<Property,4> edges;
 	for (int i = 0; i < 4; i++)
 	{
 		edges[i] = *properties.GetProperty(edge_ids[i]);
@@ -240,7 +239,7 @@ SharedPtr<Decorator> DecoratorNinePatchInstancer::InstanceDecorator(const String
 		return nullptr;
 	}
 
-	auto decorator = std::make_shared<DecoratorNinePatch>();
+	auto decorator = MakeShared<DecoratorNinePatch>();
 
 	if (!decorator->Initialise(sprite_outer->rectangle, sprite_inner->rectangle, (edges_set ? &edges : nullptr), sprite_outer->sprite_sheet->texture))
 		return nullptr;

+ 2 - 2
Source/Core/DecoratorNinePatch.h

@@ -42,7 +42,7 @@ public:
 	DecoratorNinePatch();
 	virtual ~DecoratorNinePatch();
 
-	bool Initialise(const Rectangle& rect_outer, const Rectangle& rect_inner, const std::array<Property, 4>* _edges, const Texture& texture);
+	bool Initialise(const Rectangle& rect_outer, const Rectangle& rect_inner, const Array<Property, 4>* _edges, const Texture& texture);
 
 	DecoratorDataHandle GenerateElementData(Element* element) const override;
 	void ReleaseElementData(DecoratorDataHandle element_data) const override;
@@ -51,7 +51,7 @@ public:
 
 private:
 	Rectangle rect_outer, rect_inner;
-	UniquePtr<std::array<Property,4>> edges;
+	UniquePtr<Array<Property,4>> edges;
 };
 
 

+ 1 - 1
Source/Core/DecoratorTiled.cpp

@@ -106,7 +106,7 @@ Vector2f DecoratorTiled::Tile::GetDimensions(Element* element) const
 }
 
 // Generates geometry to render this tile across a surface.
-void DecoratorTiled::Tile::GenerateGeometry(std::vector< Vertex >& vertices, std::vector< int >& indices, Element* element, const Vector2f& surface_origin, const Vector2f& surface_dimensions, const Vector2f& tile_dimensions) const
+void DecoratorTiled::Tile::GenerateGeometry(Vector< Vertex >& vertices, Vector< int >& indices, Element* element, const Vector2f& surface_origin, const Vector2f& surface_dimensions, const Vector2f& tile_dimensions) const
 {
 	if (surface_dimensions.x <= 0 || surface_dimensions.y <= 0)
 		return;

+ 1 - 1
Source/Core/DecoratorTiled.h

@@ -94,7 +94,7 @@ public:
 		/// @param[in] surface_origin The starting point of the first tile to generate.
 		/// @param[in] surface_dimensions The dimensions of the surface to be tiled.
 		/// @param[in] tile_dimensions The dimensions to render this tile at.
-		void GenerateGeometry(std::vector< Vertex >& vertices, std::vector< int >& indices, Element* element, const Vector2f& surface_origin, const Vector2f& surface_dimensions, const Vector2f& tile_dimensions) const;
+		void GenerateGeometry(Vector< Vertex >& vertices, Vector< int >& indices, Element* element, const Vector2f& surface_origin, const Vector2f& surface_dimensions, const Vector2f& tile_dimensions) const;
 
 		struct TileData
 		{

+ 1 - 1
Source/Core/DecoratorTiledBoxInstancer.cpp

@@ -65,7 +65,7 @@ SharedPtr<Decorator>DecoratorTiledBoxInstancer::InstanceDecorator(const String&
 	if (!GetTileProperties(tiles, textures, num_tiles, properties, interface))
 		return nullptr;
 
-	auto decorator = std::make_shared<DecoratorTiledBox>();
+	auto decorator = MakeShared<DecoratorTiledBox>();
 	if (!decorator->Initialise(tiles, textures))
 		return nullptr;
 

+ 1 - 1
Source/Core/DecoratorTiledHorizontalInstancer.cpp

@@ -55,7 +55,7 @@ SharedPtr<Decorator> DecoratorTiledHorizontalInstancer::InstanceDecorator(const
 	if (!GetTileProperties(tiles, textures, num_tiles, properties, interface))
 		return nullptr;
 
-	auto decorator = std::make_shared<DecoratorTiledHorizontal>();
+	auto decorator = MakeShared<DecoratorTiledHorizontal>();
 	if (!decorator->Initialise(tiles, textures))
 		return nullptr;
 

+ 1 - 1
Source/Core/DecoratorTiledImageInstancer.cpp

@@ -52,7 +52,7 @@ SharedPtr<Decorator> DecoratorTiledImageInstancer::InstanceDecorator(const Strin
 	if (!GetTileProperties(&tile, &texture, 1, properties, interface))
 		return nullptr;
 	
-	auto decorator = std::make_shared<DecoratorTiledImage>();
+	auto decorator = MakeShared<DecoratorTiledImage>();
 
 	if (!decorator->Initialise(tile, texture))
 		return nullptr;

+ 1 - 1
Source/Core/DecoratorTiledInstancer.h

@@ -64,7 +64,7 @@ private:
 		PropertyId src, fit, align_x, align_y, orientation;
 	};
 
-	std::vector<TilePropertyIds> tile_property_ids;
+	Vector<TilePropertyIds> tile_property_ids;
 };
 
 } // namespace Rml

+ 1 - 1
Source/Core/DecoratorTiledVerticalInstancer.cpp

@@ -55,7 +55,7 @@ SharedPtr<Decorator> DecoratorTiledVerticalInstancer::InstanceDecorator(const St
 	if (!GetTileProperties(tiles, textures, num_tiles, properties, interface))
 		return nullptr;
 
-	auto decorator = std::make_shared<DecoratorTiledVertical>();
+	auto decorator = MakeShared<DecoratorTiledVertical>();
 	if (!decorator->Initialise(tiles, textures))
 		return nullptr;
 

+ 1 - 1
Source/Core/DocumentHeader.h

@@ -33,7 +33,7 @@
 
 namespace Rml {
 
-using LineNumberList = std::vector<int>;
+using LineNumberList = Vector<int>;
 
 /**
 	The document header struct contains the

+ 8 - 8
Source/Core/Element.cpp

@@ -74,7 +74,7 @@ namespace Rml {
 class ElementSortZOrder
 {
 public:
-	bool operator()(const std::pair< Element*, float >& lhs, const std::pair< Element*, float >& rhs) const
+	bool operator()(const Pair< Element*, float >& lhs, const Pair< Element*, float >& rhs) const
 	{
 		return lhs.second < rhs.second;
 	}
@@ -775,7 +775,7 @@ bool Element::Project(Vector2f& point) const noexcept
 
 PropertiesIteratorView Element::IterateLocalProperties() const
 {
-	return PropertiesIteratorView(std::make_unique<PropertiesIterator>(meta->style.Iterate()));
+	return PropertiesIteratorView(MakeUnique<PropertiesIterator>(meta->style.Iterate()));
 }
 
 
@@ -2181,7 +2181,7 @@ void Element::BuildStackingContext(ElementList* new_stacking_context)
 	// Build the list of ordered children. Our child list is sorted within the stacking context so stacked elements
 	// will render in the right order; ie, positioned elements will render on top of inline elements, which will render
 	// on top of floated elements, which will render on top of block elements.
-	std::vector< std::pair< Element*, float > > ordered_children;
+	Vector< Pair< Element*, float > > ordered_children;
 	for (size_t i = 0; i < children.size(); ++i)
 	{
 		Element* child = children[i].get();
@@ -2189,7 +2189,7 @@ void Element::BuildStackingContext(ElementList* new_stacking_context)
 		if (!child->IsVisible())
 			continue;
 
-		std::pair< Element*, float > ordered_child;
+		Pair< Element*, float > ordered_child;
 		ordered_child.first = child;
 
 		if (child->GetPosition() != Style::Position::Static)
@@ -2521,8 +2521,8 @@ void Element::AdvanceAnimations()
 		// Move all completed animations to the end of the list
 		auto it_completed = std::partition(animations.begin(), animations.end(), [](const ElementAnimation& animation) { return !animation.IsComplete(); });
 
-		std::vector<Dictionary> dictionary_list;
-		std::vector<bool> is_transition;
+		Vector<Dictionary> dictionary_list;
+		Vector<bool> is_transition;
 		dictionary_list.reserve(animations.end() - it_completed);
 		is_transition.reserve(animations.end() - it_completed);
 
@@ -2606,7 +2606,7 @@ void Element::UpdateTransformState()
 			);
 
 			if (!transform_state)
-				transform_state = std::make_unique<TransformState>();
+				transform_state = MakeUnique<TransformState>();
 
 			perspective_or_transform_changed |= transform_state->SetLocalPerspective(&perspective);
 		}
@@ -2687,7 +2687,7 @@ void Element::UpdateTransformState()
 		if (have_transform)
 		{
 			if (!transform_state)
-				transform_state = std::make_unique<TransformState>();
+				transform_state = MakeUnique<TransformState>();
 
 			perspective_or_transform_changed |= transform_state->SetTransform(&transform);
 		}

+ 4 - 4
Source/Core/ElementAnimation.cpp

@@ -225,7 +225,7 @@ static PrepareTransformResult PrepareTransformPair(Transform& t0, Transform& t1,
 		auto& small = (prims0_smallest ? prims0 : prims1);
 		auto& big = (prims0_smallest ? prims1 : prims0);
 
-		std::vector<size_t> matching_indices; // Indices into 'big' for matching types
+		Vector<size_t> matching_indices; // Indices into 'big' for matching types
 		matching_indices.reserve(small.size() + 1);
 
 		size_t i_big = 0;
@@ -304,7 +304,7 @@ static PrepareTransformResult PrepareTransformPair(Transform& t0, Transform& t1,
 }
 
 
-static bool PrepareTransforms(std::vector<AnimationKey>& keys, Element& element, int start_index)
+static bool PrepareTransforms(Vector<AnimationKey>& keys, Element& element, int start_index)
 {
 	bool result = true;
 
@@ -315,7 +315,7 @@ static bool PrepareTransforms(std::vector<AnimationKey>& keys, Element& element,
 		RMLUI_ASSERT(property.value.GetType() == Variant::TRANSFORMPTR);
 
 		if (!property.value.GetReference<TransformPtr>())
-			property.value = std::make_shared<Transform>();
+			property.value = MakeShared<Transform>();
 
 		bool must_decompose = false;
 		Transform& transform = *property.value.GetReference<TransformPtr>();
@@ -346,7 +346,7 @@ static bool PrepareTransforms(std::vector<AnimationKey>& keys, Element& element,
 	int count_iterations = -1;
 	const int max_iterations = 3 * N;
 
-	std::vector<bool> dirty_list(N + 1, false);
+	Vector<bool> dirty_list(N + 1, false);
 	dirty_list[start_index] = true;
 
 	// For each pair of keys, match the transform primitives such that they can be interpolated during animation update

+ 1 - 1
Source/Core/ElementAnimation.h

@@ -57,7 +57,7 @@ private:
 	int num_iterations = 0;       // -1 for infinity
 	bool alternate_direction = 0; // between iterations
 
-	std::vector<AnimationKey> keys;
+	Vector<AnimationKey> keys;
 
 	double last_update_world_time = 0;
 	float time_since_iteration_start = 0;

+ 2 - 2
Source/Core/ElementBackground.cpp

@@ -97,8 +97,8 @@ void ElementBackground::GenerateBackground()
 			num_boxes++;
 	}
 
-	std::vector< Vertex >& vertices = geometry.GetVertices();
-	std::vector< int >& indices = geometry.GetIndices();
+	Vector< Vertex >& vertices = geometry.GetVertices();
+	Vector< int >& indices = geometry.GetIndices();
 
 	int index_offset = 0;
 	vertices.resize(4 * num_boxes);

+ 2 - 2
Source/Core/ElementBorder.cpp

@@ -78,8 +78,8 @@ void ElementBorder::GenerateBorder()
 		}
 	}
 
-	std::vector< Vertex >& vertices = geometry.GetVertices();
-	std::vector< int >& indices = geometry.GetIndices();
+	Vector< Vertex >& vertices = geometry.GetVertices();
+	Vector< int >& indices = geometry.GetIndices();
 
 	int index_offset = 0;
 	vertices.resize(4 * num_edges);

+ 1 - 1
Source/Core/ElementDecoration.h

@@ -70,7 +70,7 @@ private:
 		DecoratorDataHandle decorator_data;
 	};
 
-	using DecoratorHandleList = std::vector< DecoratorHandle >;
+	using DecoratorHandleList = Vector< DecoratorHandle >;
 
 	// The element this decorator belongs to
 	Element* element;

+ 1 - 1
Source/Core/ElementDefinition.cpp

@@ -32,7 +32,7 @@
 
 namespace Rml {
 
-ElementDefinition::ElementDefinition(const std::vector< const StyleSheetNode* >& style_sheet_nodes)
+ElementDefinition::ElementDefinition(const Vector< const StyleSheetNode* >& style_sheet_nodes)
 {
 	// Initialises the element definition from the list of style sheet nodes.
 	for (size_t i = 0; i < style_sheet_nodes.size(); ++i)

+ 1 - 1
Source/Core/ElementDefinition.h

@@ -47,7 +47,7 @@ class ElementDefinitionIterator;
 class ElementDefinition : public NonCopyMoveable
 {
 public:
-	ElementDefinition(const std::vector< const StyleSheetNode* >& style_sheet_nodes);
+	ElementDefinition(const Vector< const StyleSheetNode* >& style_sheet_nodes);
 
 	/// Returns a specific property from the element definition.
 	/// @param[in] id The id of the property to return.

+ 4 - 4
Source/Core/ElementDocument.cpp

@@ -104,8 +104,8 @@ void ElementDocument::ProcessHeader(const DocumentHeader* document_header)
 	{			
 		for (size_t i = 0;i < header.rcss_inline.size(); i++)
 		{			
-			UniquePtr<StyleSheet> inline_sheet = std::make_unique<StyleSheet>();
-			auto stream = std::make_unique<StreamMemory>((const byte*) header.rcss_inline[i].c_str(), header.rcss_inline[i].size());
+			UniquePtr<StyleSheet> inline_sheet = MakeUnique<StyleSheet>();
+			auto stream = MakeUnique<StreamMemory>((const byte*) header.rcss_inline[i].c_str(), header.rcss_inline[i].size());
 			stream->SetSourceURL(document_header->source);
 
 			if (inline_sheet->LoadStyleSheet(stream.get(), header.rcss_inline_line_numbers[i]))
@@ -132,7 +132,7 @@ void ElementDocument::ProcessHeader(const DocumentHeader* document_header)
 	// Load external scripts.
 	for (size_t i = 0; i < header.scripts_external.size(); i++)
 	{
-		auto stream = std::make_unique<StreamFile>();
+		auto stream = MakeUnique<StreamFile>();
 		if (stream->Open(header.scripts_external[i]))
 			LoadScript(stream.get(), header.scripts_external[i]);
 	}
@@ -140,7 +140,7 @@ void ElementDocument::ProcessHeader(const DocumentHeader* document_header)
 	// Load internal scripts.
 	for (size_t i = 0; i < header.scripts_inline.size(); i++)
 	{
-		auto stream = std::make_unique<StreamMemory>((const byte*) header.scripts_inline[i].c_str(), header.scripts_inline[i].size());
+		auto stream = MakeUnique<StreamMemory>((const byte*) header.scripts_inline[i].c_str(), header.scripts_inline[i].size());
 		LoadScript(stream.get(), "");
 	}
 

+ 1 - 1
Source/Core/ElementTextDefault.cpp

@@ -363,7 +363,7 @@ void ElementTextDefault::OnPropertyChange(const PropertyIdSet& changed_propertie
 		geometry_dirty = true;
 
 		// Re-colour the decoration geometry.
-		std::vector< Vertex >& vertices = decoration.GetVertices();
+		Vector< Vertex >& vertices = decoration.GetVertices();
 		for (size_t i = 0; i < vertices.size(); ++i)
 			vertices[i].colour = colour;
 

+ 1 - 1
Source/Core/ElementTextDefault.h

@@ -108,7 +108,7 @@ private:
 
 	String text;
 
-	typedef std::vector< Line > LineList;
+	typedef Vector< Line > LineList;
 	LineList lines;
 
 	bool dirty_layout_on_change;

+ 4 - 5
Source/Core/ElementUtilities.cpp

@@ -40,7 +40,6 @@
 #include "ElementStyle.h"
 #include "LayoutEngine.h"
 #include "TransformState.h"
-#include <queue>
 #include <limits>
 
 namespace Rml {
@@ -78,7 +77,7 @@ static void SetElementOffset(Element* element, const Vector2f& offset)
 Element* ElementUtilities::GetElementById(Element* root_element, const String& id)
 {
 	// Breadth first search on elements for the corresponding id
-	typedef std::queue<Element*> SearchQueue;
+	typedef Queue<Element*> SearchQueue;
 	SearchQueue search_queue;
 	search_queue.push(root_element);
 
@@ -103,7 +102,7 @@ Element* ElementUtilities::GetElementById(Element* root_element, const String& i
 void ElementUtilities::GetElementsByTagName(ElementList& elements, Element* root_element, const String& tag)
 {
 	// Breadth first search on elements for the corresponding id
-	typedef std::queue< Element* > SearchQueue;
+	typedef Queue< Element* > SearchQueue;
 	SearchQueue search_queue;
 	for (int i = 0; i < root_element->GetNumChildren(); ++i)
 		search_queue.push(root_element->GetChild(i));
@@ -125,7 +124,7 @@ void ElementUtilities::GetElementsByTagName(ElementList& elements, Element* root
 void ElementUtilities::GetElementsByClassName(ElementList& elements, Element* root_element, const String& class_name)
 {
 	// Breadth first search on elements for the corresponding id
-	typedef std::queue< Element* > SearchQueue;
+	typedef Queue< Element* > SearchQueue;
 	SearchQueue search_queue;
 	for (int i = 0; i < root_element->GetNumChildren(); ++i)
 		search_queue.push(root_element->GetChild(i));
@@ -404,7 +403,7 @@ static bool ApplyDataViewsControllersInternal(Element* element, const bool const
 		// Since data views and controllers may modify the element's attributes during initialization, we 
 		// need to iterate over all the attributes _before_ initializing any views or controllers. We store
 		// the information needed to initialize them in the following container.
-		std::vector<ViewControllerInitializer> initializer_list;
+		Vector<ViewControllerInitializer> initializer_list;
 
 		for (auto& attribute : element->GetAttributes())
 		{

+ 2 - 2
Source/Core/Elements/ElementImage.cpp

@@ -147,8 +147,8 @@ void ElementImage::GenerateGeometry()
 	// Release the old geometry before specifying the new vertices.
 	geometry.Release(true);
 
-	std::vector< Vertex >& vertices = geometry.GetVertices();
-	std::vector< int >& indices = geometry.GetIndices();
+	Vector< Vertex >& vertices = geometry.GetVertices();
+	Vector< int >& indices = geometry.GetIndices();
 
 	vertices.resize(4);
 	indices.resize(6);

+ 2 - 3
Source/Core/Elements/ElementProgressBar.cpp

@@ -36,7 +36,6 @@
 #include "../../../Include/RmlUi/Core/ElementUtilities.h"
 #include "../../../Include/RmlUi/Core/URL.h"
 #include <algorithm>
-#include <array>
 
 namespace Rml {
 
@@ -87,7 +86,7 @@ void ElementProgressBar::OnAttributeChange(const ElementAttributes& changed_attr
 
 	if (changed_attributes.find("direction") != changed_attributes.end())
 	{
-		using DirectionNameList = std::array<String, size_t(Direction::Count)>;
+		using DirectionNameList = Array<String, size_t(Direction::Count)>;
 		static const DirectionNameList names = { "top", "right", "bottom", "left", "clockwise", "counter-clockwise" };
 
 		direction = DefaultDirection;
@@ -104,7 +103,7 @@ void ElementProgressBar::OnAttributeChange(const ElementAttributes& changed_attr
 
 	if (changed_attributes.find("start-edge") != changed_attributes.end())
 	{
-		using StartEdgeNameList = std::array<String, size_t(StartEdge::Count)>;
+		using StartEdgeNameList = Array<String, size_t(StartEdge::Count)>;
 		static const StartEdgeNameList names = { "top", "right", "bottom", "left" };
 
 		start_edge = DefaultStartEdge;

+ 1 - 2
Source/Core/Elements/WidgetDropDown.h

@@ -31,7 +31,6 @@
 
 #include "../../../Include/RmlUi/Core/EventListener.h"
 #include "../../../Include/RmlUi/Core/Elements/SelectOption.h"
-#include <vector>
 
 namespace Rml {
 
@@ -102,7 +101,7 @@ public:
 	void ProcessEvent(Event& event) override;
 
 private:
-	typedef std::vector< SelectOption > OptionList;
+	typedef Vector< SelectOption > OptionList;
 
 	// Shows or hides the selection box.
 	void ShowSelectBox(bool show);

+ 7 - 7
Source/Core/Elements/WidgetTextInput.cpp

@@ -526,7 +526,7 @@ bool WidgetTextInput::AddCharacters(String string)
 
 	String value = GetElement()->GetAttribute< String >("value", "");
 	
-	value.insert(std::min(size_t(GetCursorIndex()), value.size()), string);
+	value.insert(std::min<size_t>(GetCursorIndex(), value.size()), string);
 
 	edit_index += (int)string.size();
 
@@ -563,7 +563,7 @@ bool WidgetTextInput::DeleteCharacters(CursorMovement direction)
 void WidgetTextInput::CopySelection()
 {
 	const String& value = GetElement()->GetAttribute< String >("value", "");
-	const String snippet = value.substr(std::min(size_t(selection_begin_index), value.size()), selection_length);
+	const String snippet = value.substr(std::min(size_t(selection_begin_index), size_t(value.size())), selection_length);
 	GetSystemInterface()->SetClipboardText(snippet);
 }
 
@@ -982,8 +982,8 @@ Vector2f WidgetTextInput::FormatText()
 	// Clear the selection background geometry, and get the vertices and indices so the new geo can
 	// be generated.
 	selection_geometry.Release(true);
-	std::vector< Vertex >& selection_vertices = selection_geometry.GetVertices();
-	std::vector< int >& selection_indices = selection_geometry.GetIndices();
+	Vector< Vertex >& selection_vertices = selection_geometry.GetVertices();
+	Vector< int >& selection_indices = selection_geometry.GetIndices();
 
 	// Determine the line-height of the text element.
 	float line_height = parent->GetLineHeight();
@@ -1114,10 +1114,10 @@ void WidgetTextInput::GenerateCursor()
 	// Generates the cursor.
 	cursor_geometry.Release();
 
-	std::vector< Vertex >& vertices = cursor_geometry.GetVertices();
+	Vector< Vertex >& vertices = cursor_geometry.GetVertices();
 	vertices.resize(4);
 
-	std::vector< int >& indices = cursor_geometry.GetIndices();
+	Vector< int >& indices = cursor_geometry.GetIndices();
 	indices.resize(6);
 
 	cursor_size.x = ElementUtilities::GetDensityIndependentPixelRatio(text_element);
@@ -1186,7 +1186,7 @@ void WidgetTextInput::DeleteSelection()
 	{
 		const String& value = GetElement()->GetAttribute< String >("value", "");
 
-		String new_value = value.substr(0, selection_begin_index) + value.substr(std::min(size_t(selection_begin_index + selection_length), value.size()));
+		String new_value = value.substr(0, selection_begin_index) + value.substr(std::min(size_t(selection_begin_index + selection_length), size_t(value.size())));
 		GetElement()->SetAttribute("value", new_value);
 
 		// Move the cursor to the beginning of the old selection.

+ 1 - 1
Source/Core/Elements/WidgetTextInput.h

@@ -196,7 +196,7 @@ private:
 	Vector2f internal_dimensions;
 	Vector2f scroll_offset;
 
-	typedef std::vector< Line > LineList;
+	typedef Vector< Line > LineList;
 	LineList lines;
 
 	// Length in number of characters.

+ 3 - 3
Source/Core/EventDispatcher.cpp

@@ -140,8 +140,8 @@ bool EventDispatcher::DispatchEvent(Element* target_element, const EventId id, c
 {
 	RMLUI_ASSERTMSG(!((int)default_action_phase & (int)EventPhase::Capture), "We assume here that the default action phases cannot include capture phase.");
 
-	std::vector<CollectedListener> listeners;
-	std::vector<ObserverPtr<Element>> default_action_elements;
+	Vector<CollectedListener> listeners;
+	Vector<ObserverPtr<Element>> default_action_elements;
 
 	const EventPhase phases_to_execute = EventPhase((int)EventPhase::Capture | (int)EventPhase::Target | (bubbles ? (int)EventPhase::Bubble : 0));
 	
@@ -226,7 +226,7 @@ bool EventDispatcher::DispatchEvent(Element* target_element, const EventId id, c
 }
 
 
-void EventDispatcher::CollectListeners(int dom_distance_from_target, const EventId event_id, const EventPhase event_executes_in_phases, std::vector<CollectedListener>& collect_listeners)
+void EventDispatcher::CollectListeners(int dom_distance_from_target, const EventId event_id, const EventPhase event_executes_in_phases, Vector<CollectedListener>& collect_listeners)
 {
 	// Find all the entries with a matching id, given that listeners are sorted by id first.
 	Listeners::iterator begin, end;

+ 2 - 2
Source/Core/EventDispatcher.h

@@ -98,11 +98,11 @@ private:
 
 	// Listeners are sorted first by (id, phase) and then by the order in which the listener was inserted.
 	// All listeners added are unique.
-	typedef std::vector< EventListenerEntry > Listeners;
+	typedef Vector< EventListenerEntry > Listeners;
 	Listeners listeners;
 
 	// Collect all the listeners from this dispatcher that are allowed to execute given the input arguments.
-	void CollectListeners(int dom_distance_from_target, EventId event_id, EventPhase phases_to_execute, std::vector<CollectedListener>& collect_listeners);
+	void CollectListeners(int dom_distance_from_target, EventId event_id, EventPhase phases_to_execute, Vector<CollectedListener>& collect_listeners);
 };
 
 

+ 1 - 1
Source/Core/EventSpecification.cpp

@@ -33,7 +33,7 @@
 namespace Rml {
 
 // An EventId is an index into the specifications vector.
-static std::vector<EventSpecification> specifications = { { EventId::Invalid, "invalid", false, false, DefaultActionPhase::None } };
+static Vector<EventSpecification> specifications = { { EventId::Invalid, "invalid", false, false, DefaultActionPhase::None } };
 
 // Reverse lookup map from event type to id.
 static UnorderedMap<String, EventId> type_lookup;

Some files were not shown because too many files changed in this diff