Browse Source

Remove the `<datagrid>` and `<dataselect>` elements, related utilities, and associated tutorials

Michael Ragazzon 2 years ago
parent
commit
df930e5653
71 changed files with 48 additions and 5889 deletions
  1. 0 34
      CMake/FileList.cmake
  2. 0 28
      CMake/SampleFileList.cmake
  3. 1 1
      CMake/gen_samplelists.sh
  4. 1 7
      CMakeLists.txt
  5. 0 6
      Include/RmlUi/Core.h
  6. 0 74
      Include/RmlUi/Core/Elements/DataFormatter.h
  7. 0 134
      Include/RmlUi/Core/Elements/DataQuery.h
  8. 0 110
      Include/RmlUi/Core/Elements/DataSource.h
  9. 0 89
      Include/RmlUi/Core/Elements/DataSourceListener.h
  10. 0 153
      Include/RmlUi/Core/Elements/ElementDataGrid.h
  11. 0 61
      Include/RmlUi/Core/Elements/ElementDataGridCell.h
  12. 0 52
      Include/RmlUi/Core/Elements/ElementDataGridExpandButton.h
  13. 0 169
      Include/RmlUi/Core/Elements/ElementDataGridRow.h
  14. 0 91
      Include/RmlUi/Core/Elements/ElementFormControlDataSelect.h
  15. 33 68
      Samples/assets/invader.rcss
  16. 1 6
      Samples/assets/rml.rcss
  17. 1 1
      Samples/basic/databinding/data/databinding.rml
  18. 1 1
      Samples/basic/demo/data/demo.rml
  19. 0 10
      Samples/tutorial/datagrid/data/high_score.txt
  20. 0 15
      Samples/tutorial/datagrid/data/template.rml
  21. 0 157
      Samples/tutorial/datagrid/data/tutorial.rcss
  22. 0 27
      Samples/tutorial/datagrid/data/tutorial.rml
  23. 0 64
      Samples/tutorial/datagrid/src/DecoratorDefender.cpp
  24. 0 46
      Samples/tutorial/datagrid/src/DecoratorDefender.h
  25. 0 41
      Samples/tutorial/datagrid/src/DecoratorInstancerDefender.cpp
  26. 0 35
      Samples/tutorial/datagrid/src/DecoratorInstancerDefender.h
  27. 0 115
      Samples/tutorial/datagrid/src/HighScores.cpp
  28. 0 50
      Samples/tutorial/datagrid/src/HighScores.h
  29. 0 97
      Samples/tutorial/datagrid/src/main.cpp
  30. 0 10
      Samples/tutorial/datagrid_tree/data/high_score.txt
  31. 0 15
      Samples/tutorial/datagrid_tree/data/template.rml
  32. 0 157
      Samples/tutorial/datagrid_tree/data/tutorial.rcss
  33. 0 138
      Samples/tutorial/datagrid_tree/data/tutorial.rml
  34. 0 64
      Samples/tutorial/datagrid_tree/src/DecoratorDefender.cpp
  35. 0 46
      Samples/tutorial/datagrid_tree/src/DecoratorDefender.h
  36. 0 41
      Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.cpp
  37. 0 35
      Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.h
  38. 0 177
      Samples/tutorial/datagrid_tree/src/HighScores.cpp
  39. 0 57
      Samples/tutorial/datagrid_tree/src/HighScores.h
  40. 0 34
      Samples/tutorial/datagrid_tree/src/HighScoresShipFormatter.cpp
  41. 0 31
      Samples/tutorial/datagrid_tree/src/HighScoresShipFormatter.h
  42. 0 101
      Samples/tutorial/datagrid_tree/src/main.cpp
  43. 0 75
      Source/Core/Elements/DataFormatter.cpp
  44. 0 160
      Source/Core/Elements/DataQuery.cpp
  45. 0 175
      Source/Core/Elements/DataSource.cpp
  46. 0 112
      Source/Core/Elements/DataSourceListener.cpp
  47. 0 280
      Source/Core/Elements/ElementDataGrid.cpp
  48. 0 60
      Source/Core/Elements/ElementDataGridCell.cpp
  49. 0 78
      Source/Core/Elements/ElementDataGridExpandButton.cpp
  50. 0 695
      Source/Core/Elements/ElementDataGridRow.cpp
  51. 0 1
      Source/Core/Elements/ElementForm.cpp
  52. 0 237
      Source/Core/Elements/ElementFormControlDataSelect.cpp
  53. 0 115
      Source/Core/Elements/XMLNodeHandlerDataGrid.cpp
  54. 0 58
      Source/Core/Elements/XMLNodeHandlerDataGrid.h
  55. 0 19
      Source/Core/Factory.cpp
  56. 0 112
      Source/Lua/Elements/DataFormatter.cpp
  57. 0 56
      Source/Lua/Elements/DataFormatter.h
  58. 0 139
      Source/Lua/Elements/DataSource.cpp
  59. 0 59
      Source/Lua/Elements/DataSource.h
  60. 0 109
      Source/Lua/Elements/ElementDataGrid.cpp
  61. 0 59
      Source/Lua/Elements/ElementDataGrid.h
  62. 0 124
      Source/Lua/Elements/ElementDataGridRow.cpp
  63. 0 62
      Source/Lua/Elements/ElementDataGridRow.h
  64. 0 74
      Source/Lua/Elements/ElementFormControlDataSelect.cpp
  65. 0 53
      Source/Lua/Elements/ElementFormControlDataSelect.h
  66. 0 93
      Source/Lua/Elements/LuaDataFormatter.cpp
  67. 0 54
      Source/Lua/Elements/LuaDataFormatter.h
  68. 0 103
      Source/Lua/Elements/LuaDataSource.cpp
  69. 0 69
      Source/Lua/Elements/LuaDataSource.h
  70. 0 10
      Source/Lua/LuaPlugin.cpp
  71. 10 0
      changelog.md

+ 0 - 34
CMake/FileList.cmake

@@ -44,7 +44,6 @@ set(Core_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputMultiLine.h
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputSingleLine.h
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputSingleLinePassword.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerDataGrid.h
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerSelect.h
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerTabSet.h
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerTextArea.h
@@ -141,17 +140,8 @@ set(Core_PUB_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.inl
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementDocument.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/ElementInstancer.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/DataFormatter.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/DataQuery.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/DataSource.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/DataSourceListener.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementDataGrid.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementDataGridCell.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementDataGridExpandButton.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementDataGridRow.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementForm.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControl.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlDataSelect.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlInput.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlSelect.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Elements/ElementFormControlTextArea.h
@@ -269,17 +259,8 @@ set(Core_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/ElementDocument.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/ElementHandle.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/ElementInstancer.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/DataFormatter.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/DataQuery.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/DataSource.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/DataSourceListener.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementDataGrid.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementDataGridCell.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementDataGridExpandButton.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementDataGridRow.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementForm.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementFormControl.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementFormControlDataSelect.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementFormControlInput.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementFormControlSelect.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/ElementFormControlTextArea.cpp
@@ -301,7 +282,6 @@ set(Core_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputMultiLine.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputSingleLine.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/WidgetTextInputSingleLinePassword.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerDataGrid.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerSelect.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerTabSet.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Elements/XMLNodeHandlerTextArea.cpp
@@ -472,19 +452,12 @@ set(Lua_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Source/Lua/ElementChildNodesProxy.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/ElementInstancer.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/As.h
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/DataFormatter.h
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/DataSource.h
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementDataGrid.h
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementDataGridRow.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementForm.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControl.h
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlDataSelect.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlInput.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlSelect.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlTextArea.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementTabSet.h
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/LuaDataFormatter.h
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/LuaDataSource.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/SelectOptionsProxy.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/ElementStyleProxy.h
     ${PROJECT_SOURCE_DIR}/Source/Lua/ElementText.h
@@ -525,19 +498,12 @@ set(Lua_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Lua/ElementAttributesProxy.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/ElementChildNodesProxy.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/ElementInstancer.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/DataFormatter.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/DataSource.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementDataGrid.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementDataGridRow.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementForm.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControl.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlDataSelect.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlInput.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlSelect.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementFormControlTextArea.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/ElementTabSet.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/LuaDataFormatter.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/LuaDataSource.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/Elements/SelectOptionsProxy.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/ElementStyleProxy.cpp
     ${PROJECT_SOURCE_DIR}/Source/Lua/ElementText.cpp

+ 0 - 28
CMake/SampleFileList.cmake

@@ -117,34 +117,6 @@ set(tutorial_template_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Samples/tutorial/template/src/main.cpp
 )
 
-set(tutorial_datagrid_HDR_FILES
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/src/DecoratorDefender.h
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/src/DecoratorInstancerDefender.h
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/src/HighScores.h
-)
-
-set(tutorial_datagrid_SRC_FILES
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/src/DecoratorDefender.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/src/DecoratorInstancerDefender.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/src/HighScores.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/src/main.cpp
-)
-
-set(tutorial_datagrid_tree_HDR_FILES
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/src/DecoratorDefender.h
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.h
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/src/HighScores.h
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/src/HighScoresShipFormatter.h
-)
-
-set(tutorial_datagrid_tree_SRC_FILES
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/src/DecoratorDefender.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/src/HighScores.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/src/HighScoresShipFormatter.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/src/main.cpp
-)
-
 set(tutorial_drag_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Samples/tutorial/drag/src/Inventory.h
 )

+ 1 - 1
CMake/gen_samplelists.sh

@@ -9,7 +9,7 @@ srcpath=Samples
 samples=( 'shell'
 	'basic/animation' 'basic/benchmark' 'basic/bitmapfont' 'basic/customlog' 'basic/databinding' 'basic/demo' 'basic/drag' 'basic/loaddocument' 'basic/treeview' 'basic/transform'
 	'basic/lottie' 'basic/svg'
-	'tutorial/template' 'tutorial/datagrid' 'tutorial/datagrid_tree' 'tutorial/drag'
+	'tutorial/template' 'tutorial/drag'
 	'invaders' 'luainvaders'
 )
 

+ 1 - 7
CMakeLists.txt

@@ -815,7 +815,7 @@ endif()
 
 if(BUILD_SAMPLES)
 	set(samples treeview customlog drag loaddocument transform bitmapfont animation benchmark demo databinding)
-	set(tutorials template datagrid datagrid_tree drag)
+	set(tutorials template drag)
 
 	if(ENABLE_LOTTIE_PLUGIN)
 		list(APPEND samples "lottie")
@@ -937,12 +937,6 @@ if(BUILD_SAMPLES)
 	install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/template/data
 			DESTINATION ${SAMPLES_DIR}/tutorial/template
 	)
-	install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid/data
-			DESTINATION ${SAMPLES_DIR}/tutorial/datagrid
-	)
-	install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/datagrid_tree/data
-			DESTINATION ${SAMPLES_DIR}/tutorial/datagrid_tree
-	)
 	install(DIRECTORY ${PROJECT_SOURCE_DIR}/Samples/tutorial/drag/data
 			DESTINATION ${SAMPLES_DIR}/tutorial/drag
 	)

+ 0 - 6
Include/RmlUi/Core.h

@@ -92,14 +92,8 @@
 #include "Core/XMLNodeHandler.h"
 #include "Core/XMLParser.h"
 
-#include "Core/Elements/DataFormatter.h"
-#include "Core/Elements/ElementDataGrid.h"
-#include "Core/Elements/ElementDataGridCell.h"
-#include "Core/Elements/ElementDataGridExpandButton.h"
-#include "Core/Elements/ElementDataGridRow.h"
 #include "Core/Elements/ElementForm.h"
 #include "Core/Elements/ElementFormControl.h"
-#include "Core/Elements/ElementFormControlDataSelect.h"
 #include "Core/Elements/ElementFormControlInput.h"
 #include "Core/Elements/ElementFormControlSelect.h"
 #include "Core/Elements/ElementFormControlTextArea.h"

+ 0 - 74
Include/RmlUi/Core/Elements/DataFormatter.h

@@ -1,74 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_DATAFORMATTER_H
-#define RMLUI_CORE_ELEMENTS_DATAFORMATTER_H
-
-#include "../Types.h"
-#include "../ScriptInterface.h"
-#include "../Header.h"
-
-namespace Rml {
-
-/**
-	Abstract base class for a data formatter. A data formatter takes raw data
-	and processes it into a final string. They are usually used in conjunction
-	with a data source and a datagrid.
-
-	@author Robert Curry
- */
-
-class RMLUICORE_API DataFormatter
-{
-public:
-	DataFormatter(const String& name = "");
-	virtual ~DataFormatter();
-
-	/// Returns the name by which this data formatter is referenced by.
-	/// @return The name of this data formatter.
-	const String& GetDataFormatterName();
-	/// Returns a data formatter with the given name.
-	/// @parameter [in] data_formatter_name The name of the data formatter to
-	/// be returned.
-	/// @return If the data formatter with the specified name has been
-	/// constructed, a pointer to it will be returned. Otherwise, nullptr.
-	static DataFormatter* GetDataFormatter(const String& data_formatter_name);
-
-	/// Formats the raw results of a data source request into RML.
-	/// @param[out] formatted_data The formatted RML.
-	/// @param[in] raw_data A list of the raw data fields.
-	virtual void FormatData(String& formatted_data, const StringList& raw_data) = 0;
-
-	virtual void* GetScriptObject() const;
-
-private:
-	String name;
-};
-
-} // namespace Rml
-#endif

+ 0 - 134
Include/RmlUi/Core/Elements/DataQuery.h

@@ -1,134 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_DATAQUERY_H
-#define RMLUI_CORE_ELEMENTS_DATAQUERY_H
-
-#include "../Header.h"
-#include "../TypeConverter.h"
-#include "../Log.h"
-
-namespace Rml {
-
-class DataSource;
-
-/**
-	DataQuery
-	@author Robert Curry
-
-	Represents a request for information from an DataSource, encapsulates the result and offers
-	mechanisms to iterate through the returned rows.
-*/
-
-class RMLUICORE_API DataQuery
-{
-public:
-	DataQuery();
-	DataQuery(DataSource* data_source, const String& table, const String& fields, int offset = 0, int limit = -1, const String& order = "");
-	virtual ~DataQuery();
-
-	void ExecuteQuery(DataSource* data_source, const String& table, const String& fields, int offset = 0, int limit = -1, const String& order = "");
-	bool NextRow();
-
-	bool IsFieldSet(const String& field) const;
-
-	template< typename T >
-	T Get(const String& field_name, const T& default_value) const
-	{
-		FieldIndices::const_iterator itr = field_indices.find(field_name);
-		if (itr == field_indices.end())
-		{
-			Log::Message(Log::LT_ERROR, "Field %s not found in query", field_name.c_str());
-			return default_value;
-		}		
-		
-		T return_value = default_value;
-
-		GetInto((*itr).second, return_value);			
-
-		return return_value;
-	}
-
-	template< typename T >
-	bool GetInto(const String& field_name, T& value) const
-	{
-		FieldIndices::const_iterator itr = field_indices.find(field_name);
-		if (itr == field_indices.end())
-		{
-			Log::Message(Log::LT_ERROR, "Field %s not found in query", field_name.c_str());
-			return false;
-		}		
-
-		return GetInto((*itr).second, value);		
-	}	
-
-	template< typename T >
-	T Get(const size_t field_index, const T& default_value) const
-	{
-		T return_value = default_value;
-
-		GetInto(field_index, return_value);
-
-		return return_value;
-	}
-
-	template< typename T >
-	bool GetInto(const size_t field_index, T& value) const
-	{
-		if (field_index < rows[current_row].size())
-		{
-			return TypeConverter< String, T >::Convert(rows[current_row][field_index], value);
-		}
-
-		return false;
-	}
-
-	size_t GetNumFields()
-	{
-		return rows[current_row].size();
-	}
-
-private:
-	StringList fields;
-
-	DataSource* data_source;
-	String table;
-	int current_row;
-	int offset;
-	int limit;
-
-	typedef Vector< StringList > Rows;
-	Rows rows;    
-	typedef UnorderedMap< String, size_t > FieldIndices;
-	FieldIndices field_indices;
-	
-	void LoadRow();
-};
-
-} // namespace Rml
-#endif // RMLUI_CORE_ELEMENTS_DATAQUERY_H

+ 0 - 110
Include/RmlUi/Core/Elements/DataSource.h

@@ -1,110 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_DATASOURCE_H
-#define RMLUI_CORE_ELEMENTS_DATASOURCE_H
-
-#include "../Header.h"
-#include "../Types.h"
-#include "../ObserverPtr.h"
-
-namespace Rml {
-
-class DataSourceListener;
-
-/**
-	Generic object that provides a database-like interface for requesting rows from a table.
-	@author Robert Curry
- */
-
-class RMLUICORE_API DataSource
-{
-	public:
-		DataSource(const String& name = "");
-		virtual ~DataSource();
-
-		const String& GetDataSourceName();
-		static DataSource* GetDataSource(const String& data_source_name);
-
-		/// Fetches the contents of one row of a table within the data source.
-		/// @param[out] row The list of values in the table.
-		/// @param[in] table The name of the table to query.
-		/// @param[in] row_index The index of the desired row.
-		/// @param[in] columns The list of desired columns within the row.
-		virtual void GetRow(StringList& row, const String& table, int row_index, const StringList& columns) = 0;
-		/// Fetches the number of rows within one of this data source's tables.
-		/// @param[in] table The name of the table to query.
-		/// @return The number of rows within the specified table.
-		virtual int GetNumRows(const String& table) = 0;
-
-		void AttachListener(DataSourceListener* listener);
-		void DetachListener(DataSourceListener* listener);
-
-		virtual void* GetScriptObject() const;
-
-		static const String CHILD_SOURCE;
-		static const String DEPTH;
-		static const String NUM_CHILDREN;
-
-	protected:
-		/// Tells all attached listeners that one or more rows have been added to the data source.
-		/// @param[in] table The name of the table to have rows added to it.
-		/// @param[in] first_row_added The index of the first row added.
-		/// @param[in] num_rows_added The number of rows added (including the first row).
-		void NotifyRowAdd(const String& table, int first_row_added, int num_rows_added);
-
-		/// Tells all attached listeners that one or more rows have been removed from the data source.
-		/// @param[in] table The name of the table to have rows removed from it.
-		/// @param[in] first_row_removed The index of the first row removed.
-		/// @param[in] num_rows_removed The number of rows removed (including the first row).
-		void NotifyRowRemove(const String& table, int first_row_removed, int num_rows_removed);
-
-		/// Tells all attached listeners that one or more rows have been changed in the data source.
-		/// @param[in] table The name of the table to have rows changed in it.
-		/// @param[in] first_row_changed The index of the first row changed.
-		/// @param[in] num_rows_changed The number of rows changed (including the first row).
-		void NotifyRowChange(const String& table, int first_row_changed, int num_rows_changed);
-
-		/// Tells all attached listeners that the row structure has completely changed in the data source.
-		/// @param[in] table The name of the table to have rows changed in it.
-		void NotifyRowChange(const String& table);
-
-		/// Helper function for building a result set.
-		typedef UnorderedMap< String, String > RowMap;
-		void BuildRowEntries(StringList& row, const RowMap& row_map, const StringList& columns);
-
-	private:
-		String name;
-
-		using ListenerList = Vector< ObserverPtr<DataSourceListener> >;
-		ListenerList listeners;
-};
-
-} // namespace Rml
-#endif // RMLUI_CORE_ELEMENTS_DATASOURCE_H
-

+ 0 - 89
Include/RmlUi/Core/Elements/DataSourceListener.h

@@ -1,89 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_DATASOURCELISTENER_H
-#define RMLUI_CORE_ELEMENTS_DATASOURCELISTENER_H
-
-#include "../Header.h"
-#include "../Types.h"
-#include "../ObserverPtr.h"
-
-namespace Rml {
-
-class DataSource;
-
-/**
-	Interface for objects wishing to listen to data source events. Listeners should use the
-	AttachListener() on DataSource to begin observing a data source.
-
-	@author Robert Curry
- */
-
-class RMLUICORE_API DataSourceListener : public EnableObserverPtr<DataSourceListener>
-{
-public:
-	DataSourceListener();
-	virtual ~DataSourceListener();
-
-	/// Notification of the destruction of an observed data source.
-	/// @param[in] data_source Data source being destroyed.
-	virtual void OnDataSourceDestroy(DataSource* data_source);
-	/// Notification of the addition of one or more rows to an observed data source's table.
-	/// @param[in] data_source Data source being changed.
-	/// @param[in] table The name of the changing table within the data source.
-	/// @param[in] first_row_added Index of the first new row.
-	/// @param[in] num_rows_added Number of new sequential rows being added.
-	virtual void OnRowAdd(DataSource* data_source, const String& table, int first_row_added, int num_rows_added);
-	/// Notification of the removal of one or more rows from an observed data source's table.
-	/// @param[in] data_source Data source being changed.
-	/// @param[in] table The name of the changing table within the data source.
-	/// @param[in] first_row_removed Index of the first removed row.
-	/// @param[in] num_rows_removed Number of new sequential rows being removed.
-	virtual void OnRowRemove(DataSource* data_source, const String& table, int first_row_removed, int num_rows_removed);
-	/// Notification of the changing of one or more rows from an observed data source's table.
-	/// @param[in] data_source Data source being changed.
-	/// @param[in] table The name of the changing table within the data source.
-	/// @param[in] first_row_removed Index of the first changed row.
-	/// @param[in] num_rows_removed Number of new sequential rows being changed.
-	virtual void OnRowChange(DataSource* data_source, const String& table, int first_row_changed, int num_rows_changed);
-	/// Notification of the change of all of the data of an observed data source's table.
-	/// @param[in] data_source Data source being changed.
-	/// @param[in] table The name of the changing table within the data source.
-	virtual void OnRowChange(DataSource* data_source, const String& table);
-
-protected:
-	/// Sets up data source and table from a given String.
-	/// @param[out] data_source A pointer to a data_source that gets loaded with the specified data source.
-	/// @param[out] table_name A reference to an String that gets loaded with the specified data table.
-	/// @param[in] data_source_name The data source and table in SOURCE.TABLE format.
-	/// @return True if the data source name was in the correct format, and the data source was found.
-	bool ParseDataSource(DataSource*& data_source, String& table_name, const String& data_source_name);
-};
-
-} // namespace Rml
-#endif // RMLUI_CORE_ELEMENTS_DATASOURCELISTENER_H

+ 0 - 153
Include/RmlUi/Core/Elements/ElementDataGrid.h

@@ -1,153 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_ELEMENTDATAGRID_H
-#define RMLUI_CORE_ELEMENTS_ELEMENTDATAGRID_H
-
-#include "../Header.h"
-#include "../Element.h"
-#include "DataSourceListener.h"
-
-namespace Rml {
-
-class DataFormatter;
-class ElementDataGridRow;
-
-/**
-	A table driven from a data source.
-
-	@author Robert Curry
- */
-
-class RMLUICORE_API ElementDataGrid : public Element, public DataSourceListener
-{
-public:
-	RMLUI_RTTI_DefineWithParent(ElementDataGrid, Element)
-
-	ElementDataGrid(const String& tag);
-	virtual ~ElementDataGrid();
-
-	/// Sets a new data source for the contents of the data grid.
-	/// @param[in] data_source_name The name of the new data source.
-	void SetDataSource(const String& data_source_name);
-
-	/**
-		A column inside a table.
-
-		@author Robert Curry
-	 */
-	struct Column
-	{
-		/// The list of fields that this column reads from the data source for
-		/// each row.
-		StringList fields;
-
-		/// The data formatter this is used to process the field information
-		/// into what is finally displayed in the data grid.
-		DataFormatter* formatter;
-		/// The header that is displayed at the top of the column, in the
-		/// header row.
-		Element* header;
-
-		/// The width of this column.
-		float current_width;
-
-		/// Whether this column has a forced refresh when a child node changes.
-		/// This is to allow the expand/collapse buttons to be added or removed
-		/// when a child node is added.
-		bool refresh_on_child_change;
-	};
-
-	/// Adds a column to the table.
-	/// @param[in] fields A comma-separated list of fields that this column reads from the data source.
-	/// @param[in] formatter The name of the data formatter to be used to format the raw column data into RML.
-	/// @param[in] initial_width The initial width, in pixels, of the column.
-	/// @param[in] header_rml The RML to use as the column header.
-	/// @return True if the column was added successfully, false if not.
-	bool AddColumn(const String& fields, const String& formatter, float initial_width, const String& header_rml);
-	/// Adds a column to the table.
-	/// @param[in] fields A comma-separated list of fields that this column reads from the data source.
-	/// @param[in] formatter The name of the data formatter to be used to format the raw column data into RML.
-	/// @param[in] initial_width The initial width, in pixels, of the column.
-	/// @param[in] header_element The element hierarchy to use as the column header.
-	void AddColumn(const String& fields, const String& formatter, float initial_width, ElementPtr header_element);
-	/// Returns the number of columns in this table
-	int GetNumColumns();
-	/// Returns the column at the specified index.
-	const Column* GetColumn(int column_index);
-	/// Returns a CSV string containing all the fields that each column requires, in order.
-	const String& GetAllColumnFields();
-
-	/// Adds a new row to the table. This is only called from child rows.
-	/// @param[in] parent The parent row that the row is being added under.
-	/// @param[in] index The index of the child, relative to its parent.
-	/// @return A pointer to the newly created row.
-	ElementDataGridRow* AddRow(ElementDataGridRow* parent, int index);
-	/// Removes a series of rows from the table.
-	/// @param[in] index The index of the first row, relative to the table.
-	/// @param[in] num_rows The number of rows to remove. Defaults to one.
-	void RemoveRows(int index, int num_rows = 1);
-
-	/// Returns the number of rows in the table
-	int GetNumRows() const;
-	/// Returns the row at the given index in the table.
-	/// @param[in] index The index of the row, relative to the table.
-	ElementDataGridRow* GetRow(int index) const;
-
-protected:
-	void OnUpdate() override;
-
-	void OnResize() override;
-
-	/// Gets the markup and content of the element.
-	/// @param content[out] The content of the element.
-	void GetInnerRML(String& content) const override;
-
-private:
-	typedef Vector< Column > ColumnList;
-	typedef Vector< ElementDataGridRow* > RowList;
-
-	ColumnList columns;
-	String column_fields;
-
-	// The row that contains the header elements of the table.
-	ElementDataGridRow* header;
-
-	// The root row, all the top level rows are children under this. Not
-	// actually rendered, has "display: none".
-	ElementDataGridRow* root;
-	// If this is non-empty, then in the previous update the data source was set
-	// and we must set it this update.
-	String new_data_source;
-
-	// The block element that contains all our rows. Only used for applying styles.
-	Element* body;
-};
-
-} // namespace Rml
-#endif

+ 0 - 61
Include/RmlUi/Core/Elements/ElementDataGridCell.h

@@ -1,61 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_ELEMENTDATAGRIDCELL_H
-#define RMLUI_CORE_ELEMENTS_ELEMENTDATAGRIDCELL_H
-
-#include "../Element.h"
-#include "../EventListener.h"
-#include "../Header.h"
-
-namespace Rml {
-
-/**
-	The class for cells inside a data table row.
-
-	@author Robert Curry
- */
-
-class RMLUICORE_API ElementDataGridCell : public Element
-{
-public:
-	RMLUI_RTTI_DefineWithParent(ElementDataGridCell, Element)
-
-	ElementDataGridCell(const String& tag);
-	virtual ~ElementDataGridCell();
-
-	void Initialise(int column, Element* header);
-	int GetColumn();
-	
-private:
-	int column;
-	Element* header;
-};
-
-} // namespace Rml
-#endif

+ 0 - 52
Include/RmlUi/Core/Elements/ElementDataGridExpandButton.h

@@ -1,52 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_ELEMENTDATAGRIDEXPANDBUTTON_H
-#define RMLUI_CORE_ELEMENTS_ELEMENTDATAGRIDEXPANDBUTTON_H
-
-#include "../Element.h"
-#include "../Header.h"
-
-namespace Rml {
-
-/**
-	@author Robert Curry
- */
-
-class RMLUICORE_API ElementDataGridExpandButton : public Element
-{
-public:
-	ElementDataGridExpandButton(const String& tag);
-	virtual ~ElementDataGridExpandButton();
-
-protected:
-	void ProcessDefaultAction(Event& event) override;
-};
-
-} // namespace Rml
-#endif

+ 0 - 169
Include/RmlUi/Core/Elements/ElementDataGridRow.h

@@ -1,169 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_ELEMENTDATAGRIDROW_H
-#define RMLUI_CORE_ELEMENTS_ELEMENTDATAGRIDROW_H
-
-#include "../Header.h"
-#include "../Element.h"
-#include "DataSourceListener.h"
-#include "DataQuery.h"
-
-namespace Rml {
-
-class ElementDataGrid;
-
-/**
-	Class for rows inside a data table. Used for both the header and the individual rows.
-
-	@author Robert Curry
- */
-
-class RMLUICORE_API ElementDataGridRow : public Element, public DataSourceListener
-{
-friend class Rml::ElementDataGrid;
-
-public:
-	RMLUI_RTTI_DefineWithParent(ElementDataGridRow, Element)
-
-	ElementDataGridRow(const String& tag);
-	virtual ~ElementDataGridRow();
-
-	void Initialise(ElementDataGrid* parent_grid, ElementDataGridRow* parent_row = nullptr, int child_index = -1, ElementDataGridRow* header_row = nullptr, int depth = -1);
-	void SetChildIndex(int child_index);
-	int GetDepth();
-
-	void SetDataSource(const String& data_source_name);
-
-	/// Checks dirty children and cells, and loads them if necessary.
-	/// @return True if any children were updated.
-	bool UpdateChildren();
-
-	/// Returns the number of children that aren't dirty (have been loaded)
-	int GetNumLoadedChildren();
-
-	/// Removes all the child cells and fetches them again from the data source.
-	void RefreshRows();
-
-	/// Returns whether this row is expanded or not.
-	bool IsRowExpanded();
-	/// Shows all of this row's descendants.
-	void ExpandRow();
-	/// Hides all of this row's descendants.
-	void CollapseRow();
-	/// Expands the row if collapsed, or collapses the row if expanded.
-	void ToggleRow();
-
-	/// Returns the index of this row, relative to its parent.
-	int GetParentRelativeIndex();
-	/// Returns the index of this row, relative to the table rather than its parent.
-	int GetTableRelativeIndex();
-	/// Returns the parent row of this row.
-	ElementDataGridRow* GetParentRow();
-	/// Returns the grid that this row belongs to.
-	ElementDataGrid* GetParentGrid();
-
-protected:
-	void OnDataSourceDestroy(DataSource* data_source) override;
-	void OnRowAdd(DataSource* data_source, const String& table, int first_row_added, int num_rows_added) override;
-	void OnRowRemove(DataSource* data_source, const String& table, int first_row_removed, int num_rows_removed) override;
-	void OnRowChange(DataSource* data_source, const String& table, int first_row_changed, int num_rows_changed) override;
-	void OnRowChange(DataSource* data_source, const String& table) override;
-
-private:
-	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
-	// children.
-	void ChildChanged(int child_index);
-	// Checks if any columns are dependent on the number of children
-	// present, and refreshes them from the data source if they are.
-	void RefreshChildDependentCells();
-
-	// Forces the row to recalculate its relative table index the next time
-	// it is requested.
-	void DirtyTableRelativeIndex();
-	// Works out what the table relative index is for a given child.
-	int GetChildTableRelativeIndex(int child_index);
-
-	// Adds children underneath this row, and fetches their contents (and
-	// possible children) from the row's data source. If first_row is left
-	// as the default -1, the rows are appended at the end of the list.
-	void AddChildren(int first_row_added = -1, int num_rows_added = 1);
-	// Removes this rows children, and their children, etc, from the table.
-	// If the num_rows_removed parameter is left as the -1 default, it'll
-	// default to the rest of the children after the first row.
-	void RemoveChildren(int first_row_removed = 0, int num_rows_removed = -1);
-	// Marks children as dirty and dispatches the event.
-	void ChangeChildren(int first_row_changed = 0, int num_rows_changed = -1);
-	// Returns the number of rows under this row (children, grandchildren, etc)
-	int GetNumDescendants();
-
-	// Adds or refreshes the cell contents, and undirties the row's cells.
-	void Load(const DataQuery& row_information);
-	// Finds all children that have cell information missing (either though being
-	// refreshed or not being loaded yet) and reloads them.
-	void LoadChildren(float time_slice);
-	// Loads a specific set of children. Called by the above function.
-	void LoadChildren(int first_row_to_load, int num_rows_to_load, double time_slice);
-
-	// Sets the dirty_cells flag on this row, and lets our ancestors know.
-	void DirtyCells();
-	// Sets the dirty children flag on this row and the row's ancestors.
-	void DirtyRow();
-	// This row has one or more cells that need loading.
-	bool dirty_cells;
-	// This row has one or more children that have either dirty flag set.
-	bool dirty_children;
-
-	// Shows this row, and, if this was was expanded before it was hidden, its children as well.
-	void Show();
-	// Hides this row and all descendants.
-	void Hide();
-	bool row_expanded;
-
-	int table_relative_index;
-	bool table_relative_index_dirty;
-
-	ElementDataGrid* parent_grid;
-
-	ElementDataGridRow* parent_row;
-	int child_index;
-	int depth;
-
-	RowList children;
-
-	// The data source and table that the children are fetched from.
-	DataSource* data_source;
-	String data_table;
-};
-
-} // namespace Rml
-#endif

+ 0 - 91
Include/RmlUi/Core/Elements/ElementFormControlDataSelect.h

@@ -1,91 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_ELEMENTFORMCONTROLDATASELECT_H
-#define RMLUI_CORE_ELEMENTS_ELEMENTFORMCONTROLDATASELECT_H
-
-#include "../Header.h"
-#include "ElementFormControlSelect.h"
-#include "DataSourceListener.h"
-
-namespace Rml {
-
-	
-class DataSource;
-
-/**
-	A drop-down select form control driven from a data source.
-
-	@author Peter Curry
- */
-
-class RMLUICORE_API ElementFormControlDataSelect : public ElementFormControlSelect, public DataSourceListener
-{
-public:
-	/// Constructs a new ElementFormControlDataSelect. This should not be called directly; use the
-	/// Factory instead.
-	/// @param[in] tag The tag the element was declared as in RML.
-	ElementFormControlDataSelect(const String& tag);
-	virtual ~ElementFormControlDataSelect();
-
-	/// Sets the data source the control's options are driven from.
-	/// @param[in] data_source The name of the new data source.
-	void SetDataSource(const String& data_source);
-
-protected:
-	/// If a new data source has been set on the control, this will attach to it and build the
-	/// initial options.
-	void OnUpdate() override;
-
-	/// Checks for changes to the data source or formatting attributes.
-	/// @param[in] changed_attributes List of changed attributes on the element.
-	void OnAttributeChange(const ElementAttributes& changed_attributes) override;
-
-	/// Detaches from the data source and rebuilds the options.
-	void OnDataSourceDestroy(DataSource* data_source) override;
-	/// Rebuilds the available options from the data source.
-	void OnRowAdd(DataSource* data_source, const String& table, int first_row_added, int num_rows_added) override;
-	/// Rebuilds the available options from the data source.
-	void OnRowRemove(DataSource* data_source, const String& table, int first_row_removed, int num_rows_removed) override;
-	/// Rebuilds the available options from the data source.
-	void OnRowChange(DataSource* data_source, const String& table, int first_row_changed, int num_rows_changed) override;
-	/// Rebuilds the available options from the data source.
-	void OnRowChange(DataSource* data_source, const String& table) override;
-
-private:
-	// Builds the option list from the data source.
-	void BuildOptions();
-
-	DataSource* data_source;
-	String data_table;
-
-	bool initialised;
-};
-
-} // namespace Rml
-#endif

+ 33 - 68
Samples/assets/invader.rcss

@@ -80,16 +80,16 @@
 	checkbox-checked-hover: 437px 90px 30px 30px;
 	checkbox-checked-active: 467px 90px 30px 30px;
 	
-	datagridheader-l: 127px 192px 16px 31px;
-	datagridheader-c: 143px 192px 2px 31px;
-	datagridheader-r: 145px 192px 15px 31px;
+	tableheader-l: 127px 192px 16px 31px;
+	tableheader-c: 143px 192px 2px 31px;
+	tableheader-r: 145px 192px 15px 31px;
 	
-	datagridexpand: 3px 232px 17px 17px;
-	datagridexpand-hover: 21px 232px 17px 17px;
-	datagridexpand-active: 39px 232px 17px 17px;
-	datagridexpand-collapsed: 3px 250px 17px 17px;
-	datagridexpand-collapsed-hover: 21px 250px 17px 17px;
-	datagridexpand-collapsed-active: 39px 250px 17px 17px;
+	expand: 3px 232px 17px 17px;
+	expand-hover: 21px 232px 17px 17px;
+	expand-active: 39px 232px 17px 17px;
+	expand-collapsed: 3px 250px 17px 17px;
+	expand-collapsed-hover: 21px 250px 17px 17px;
+	expand-collapsed-active: 39px 250px 17px 17px;
 	
 	slidertrack-t: 70px 199px 27px 2px;
 	slidertrack-c: 70px 201px 27px 1px;
@@ -241,8 +241,7 @@ h1
 
 
 input,
-select,
-dataselect
+select
 {
 	margin-left: 20dp;
 }
@@ -316,14 +315,13 @@ textarea
 input.text,
 input.password,
 select,
-dataselect,
 textarea
 {
 	color: #333;
 	font-size: 13dp;
 }
 
-datagrid input.text, table input.text
+table input.text
 {
 	box-sizing: border-box;
 	width: 100%;
@@ -343,15 +341,13 @@ datagrid input.text, table input.text
 
 
 
-select,
-dataselect
+select
 {
 	width: 175dp;
 	height: 37dp;
 }
 
-select selectvalue,
-dataselect selectvalue
+select selectvalue
 {
 	width: auto;
 	margin-right: 30dp;
@@ -362,8 +358,7 @@ dataselect selectvalue
 	decorator: image( selectvalue  );
 }
 
-select selectarrow,
-dataselect selectarrow
+select selectarrow
 {
 	width: 30dp;
 	height: 37dp;
@@ -371,22 +366,18 @@ dataselect selectarrow
 	decorator: image( selectarrow );
 }
 
-select:hover selectarrow,
-dataselect:hover selectarrow
+select:hover selectarrow
 {
 	decorator: image( selectarrow-hover );
 }
 
 select:active selectarrow,
-select selectarrow:checked,
-dataselect:active selectarrow,
-dataselect selectarrow:checked
+select selectarrow:checked
 {
 	decorator: image( selectarrow-active );
 }
 
-select selectbox,
-dataselect selectbox
+select selectbox
 {
 	margin-left: 1dp;
 	margin-top: -7dp;
@@ -396,8 +387,6 @@ dataselect selectbox
 }
 
 select selectbox,
-dataselect selectbox,
-datagrid datagridbody,
 tbody
 {
 	decorator: tiled-box(
@@ -407,8 +396,7 @@ tbody
 	);
 }
 
-select selectbox option,
-dataselect selectbox option
+select selectbox option
 {
 	width: auto;
 	padding: 3dp 0 3dp 6dp;
@@ -416,19 +404,15 @@ dataselect selectbox option
 }
 
 select selectbox option:nth-child(even),
-dataselect selectbox option:nth-child(even),
-datagrid datagridrow:nth-child(even),
 tr:nth-child(even)
 {
 	background: #FFFFFFA0;
 }
-select selectbox option:checked,
-dataselect selectbox option:checked
+select selectbox option:checked
 {
 	font-weight: bold;
 }
-select selectbox option:hover,
-dataselect selectbox option:hover
+select selectbox option:hover
 {
 	background: #FF5D5D;
 }
@@ -543,7 +527,7 @@ input.range sliderarrowinc:active { decorator: image( range-inc-active ); }
 
 thead tr {
 	height: 35dp;
-	decorator: tiled-horizontal( datagridheader-l, datagridheader-c, datagridheader-r );
+	decorator: tiled-horizontal( tableheader-l, tableheader-c, tableheader-r );
 }
 thead td {
 	padding-top: 11dp;
@@ -563,27 +547,8 @@ tbody tr {
 	color: black;
 }
 
-datagrid datagridheader
-{
-	width: auto;
-	height: 25dp;
-	padding: 5dp 10dp 0 10dp;
-
-	decorator: tiled-horizontal( datagridheader-l, datagridheader-c, datagridheader-r );
-}
-
-datagrid datagridbody
-{
-	color: black;
-
-	margin-left: 4dp;
-	margin-right: 3dp;
-	padding: 0 4dp 4dp 4dp;
-}
-
-
 
-datagridexpand, expand
+expand
 {
 	display: block;
 	
@@ -591,32 +556,32 @@ datagridexpand, expand
 	height: 17dp;
 	width: 17dp;
 	
-	decorator: image( datagridexpand );
+	decorator: image( expand );
 }
 
-datagridexpand:hover, expand:hover
+expand:hover
 {
-	decorator: image( datagridexpand-hover );
+	decorator: image( expand-hover );
 }
 
-datagridexpand:active, expand:active
+expand:active
 {
-	decorator: image( datagridexpand-active  );
+	decorator: image( expand-active  );
 }
 
-datagridexpand.collapsed, expand.collapsed
+expand.collapsed
 {
-	decorator: image( datagridexpand-collapsed );
+	decorator: image( expand-collapsed );
 }
 
-datagridexpand.collapsed:hover, expand.collapsed:hover
+expand.collapsed:hover
 {
-	decorator: image( datagridexpand-collapsed-hover );
+	decorator: image( expand-collapsed-hover );
 }
 
-datagridexpand.collapsed:active, expand.collapsed:active
+expand.collapsed:active
 {
-	decorator: image( datagridexpand-collapsed-active  );
+	decorator: image( expand-collapsed-active  );
 }
 
 

+ 1 - 6
Samples/assets/rml.rcss

@@ -27,12 +27,7 @@ strong
 	font-weight: bold;
 }
 
-datagrid
-{
-	display: block;
-}
-
-select, dataselect, datacombo
+select
 {
 	text-align: left;
 }

+ 1 - 1
Samples/basic/databinding/data/databinding.rml

@@ -47,7 +47,7 @@ tab
 	color: #ddd;
 	text-align: center;
 	
-	decorator: tiled-horizontal( datagridheader-l, datagridheader-c, datagridheader-r );
+	decorator: tiled-horizontal( tableheader-l, tableheader-c, tableheader-r );
 	image-color: #cffc;
 }
 tab:hover

+ 1 - 1
Samples/basic/demo/data/demo.rml

@@ -81,7 +81,7 @@ tab
 	color: #ddd;
 	text-align: center;
 	
-	decorator: tiled-horizontal( datagridheader-l, datagridheader-c, datagridheader-r );
+	decorator: tiled-horizontal( tableheader-l, tableheader-c, tableheader-r );
 	image-color: #cffc;
 }
 tab:hover

+ 0 - 10
Samples/tutorial/datagrid/data/high_score.txt

@@ -1,10 +0,0 @@
-Rml	233, 116, 81, 255	1	1000
-Ui	127, 255, 0, 255	1	900
-middleware	21, 96, 189, 255	1	800
-for	246, 74, 138, 255	1	700
-all	255, 0, 255, 255	1	600
-your	218, 165, 32, 255	1	500
-game	255, 255, 240, 255	1	400
-interface	233, 116, 81, 255	1	300
-needs	127, 255, 0, 255	1	200
-:)	21, 96, 189, 255	1	100

+ 0 - 15
Samples/tutorial/datagrid/data/template.rml

@@ -1,15 +0,0 @@
-<template name="window" content="content">
-<head>
-	<link type="text/css" href="../../../assets/rml.rcss"/>
-	<link type="text/css" href="tutorial.rcss"/>
-</head>
-<body class="window">
-	<div id="title-bar">
-		<handle move_target="#document">
-			<span id="title">Dummy Title</span>
-		</handle>
-	</div>
-	<div id="content">
-	</div>
-</body>
-</template>

+ 0 - 157
Samples/tutorial/datagrid/data/tutorial.rcss

@@ -1,157 +0,0 @@
-@spritesheet theme 
-{
-	src: /assets/invader.tga;
-
-	title-bar-l: 147px 0px 82px 85px;
-	title-bar-c: 229px 0px  1px 85px;
-	title-bar-r: 231px 0px 15px 85px;
-	
-	window-tl: 0px 0px 133px 140px;
-	window-t:  134px 0px 1px 140px;
-	window-tr: 136px 0px 10px 140px;
-	window-l:  0px 139px 10px 1px;
-	window-c:  11px 139px 1px 1px;
-	window-r:  10px 139px -10px 1px; /* mirrored left */
-	window-bl: 0px 140px 11px 11px;
-	window-b:  11px 140px 1px 11px;
-	window-br: 136px 140px 10px 11px;
-	
-	slidertrack-t: 70px 199px 27px 2px;
-	slidertrack-c: 70px 201px 27px 1px;
-	slidertrack-b: 70px 202px 27px 2px;
-	
-	sliderbar-t:         56px 152px 23px 23px;
-	sliderbar-c:         56px 175px 23px 1px;
-	sliderbar-b:         56px 176px 23px 22px;
-	sliderbar-hover-t:   80px 152px 23px 23px;
-	sliderbar-hover-c:   80px 175px 23px 1px;
-	sliderbar-hover-b:   80px 176px 23px 22px;
-	sliderbar-active-t: 104px 152px 23px 23px;
-	sliderbar-active-c: 104px 175px 23px 1px;
-	sliderbar-active-b: 104px 176px 23px 22px;
-	 
-	sliderarrowdec: 0px 152px 27px 24px;
-	sliderarrowdec-hover: 0px 177px 27px 24px;
-	sliderarrowdec-active: 0px 202px 27px 24px;
-	
-	sliderarrowinc: 28px 152px 27px 24px;
-	sliderarrowinc-hover: 28px 177px 27px 24px;
-	sliderarrowinc-active: 28px 202px 27px 24px;
-}
-
-body
-{
-	font-family: LatoLatin;
-	font-weight: normal;
-	font-style: normal;
-	font-size: 15dp;
-	color: white;
-}
-
-body.window
-{
-	padding: 10dp 15dp;
-	
-	decorator: tiled-box(
-		window-tl, window-t, window-tr, 
-		window-l, window-c, window-r,
-		window-bl, window-b, window-br
-	);
-}
-div#title-bar
-{
-	position: absolute;
-	top: -40dp;
-}
-
-div#title-bar span
-{
-	padding-left: 85dp;
-	padding-right: 25dp;
-	padding-top: 17dp;
-	padding-bottom: 48dp;
-
-	font-size: 20dp;
-	font-weight: bold;
-
-	font-effect: glow(2dp 2dp 0dp 1dp #1117);
-	
-	decorator: tiled-horizontal( title-bar-l, title-bar-c, title-bar-r );
-}
-
-div#content
-{
-	height: 100%;
-	overflow: auto;
-
-	z-index: 1;
-}
-
-scrollbarvertical
-{
-	margin-top: -6dp;
-	margin-bottom: -6dp;
-	margin-right: -11dp;
-	width: 27dp;
-}
-
-scrollbarvertical slidertrack
-{
-	decorator: tiled-vertical( slidertrack-t, slidertrack-c, slidertrack-b );
-}
-scrollbarvertical slidertrack:active
-{
-	image-color: #aaa;
-}
-
-scrollbarvertical sliderbar
-{
-	margin-left: 4dp;
-	width: 23dp;
-	min-height: 46dp;
-
-	decorator: tiled-vertical( sliderbar-t, sliderbar-c, sliderbar-b );
-}
-
-scrollbarvertical sliderbar:hover
-{
-	decorator: tiled-vertical( sliderbar-hover-t, sliderbar-hover-c, sliderbar-hover-b );
-}
-
-scrollbarvertical sliderbar:active
-{
-	decorator: tiled-vertical( sliderbar-active-t, sliderbar-active-c, sliderbar-active-b );
-}
-
-scrollbarvertical sliderarrowdec,
-scrollbarvertical sliderarrowinc
-{
-	width: 27dp;
-	height: 24dp;
-}
-
-scrollbarvertical sliderarrowdec
-{
-	decorator: image( sliderarrowdec );
-}
-scrollbarvertical sliderarrowdec:hover
-{
-	decorator: image( sliderarrowdec-hover );
-}
-scrollbarvertical sliderarrowdec:active
-{
-	decorator: image( sliderarrowdec-active );
-}
-
-scrollbarvertical sliderarrowinc
-{
-	decorator: image( sliderarrowinc );
-}
-scrollbarvertical sliderarrowinc:hover
-{
-	decorator: image( sliderarrowinc-hover );
-}
-scrollbarvertical sliderarrowinc:active
-{
-	decorator: image( sliderarrowinc-active );
-}

+ 0 - 27
Samples/tutorial/datagrid/data/tutorial.rml

@@ -1,27 +0,0 @@
-<rml>
-<head>
-	<link type="text/template" href="template.rml"/>
-	<title>Datagrid Tutorial</title>
-	<style>
-		body
-		{
-			width: 400dp;
-			height: 300dp;
-
-			margin: auto;
-		}
-    
-		defender
-		{
-				display: block;
-				width: 64dp;
-				height: 16dp;
-
-				decorator: defender( ../../../assets/high_scores_defender.tga );
-		}
-	</style>
-</head>
-<body template="window">
-	Insert high scores here.
-</body>
-</rml>

+ 0 - 64
Samples/tutorial/datagrid/src/DecoratorDefender.cpp

@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#include "DecoratorDefender.h"
-#include <RmlUi/Core/Element.h>
-#include <RmlUi/Core/GeometryUtilities.h>
-#include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/RenderInterface.h>
-#include <RmlUi/Core/Texture.h>
-
-DecoratorDefender::~DecoratorDefender() {}
-
-bool DecoratorDefender::Initialise(const Rml::Texture& texture)
-{
-	image_index = AddTexture(texture);
-	if (image_index == -1)
-	{
-		return false;
-	}
-
-	return true;
-}
-
-/// Called on a decorator to generate any required per-element data for a newly decorated element.
-Rml::DecoratorDataHandle DecoratorDefender::GenerateElementData(Rml::Element* RMLUI_UNUSED_PARAMETER(element)) const
-{
-	RMLUI_UNUSED(element);
-
-	return Rml::Decorator::INVALID_DECORATORDATAHANDLE;
-}
-
-// Called to release element data generated by this decorator.
-void DecoratorDefender::ReleaseElementData(Rml::DecoratorDataHandle RMLUI_UNUSED_PARAMETER(element_data)) const
-{
-	RMLUI_UNUSED(element_data);
-}
-
-// Called to render the decorator on an element.
-void DecoratorDefender::RenderElement(Rml::Element* element, Rml::DecoratorDataHandle RMLUI_UNUSED_PARAMETER(element_data)) const
-{
-	RMLUI_UNUSED(element_data);
-
-	Rml::Vector2f position = element->GetAbsoluteOffset(Rml::Box::PADDING);
-	Rml::Vector2f size = element->GetBox().GetSize(Rml::Box::PADDING);
-
-	if (Rml::RenderInterface* render_interface = element->GetRenderInterface())
-	{
-		Rml::TextureHandle texture = GetTexture(image_index)->GetHandle(render_interface);
-
-		Rml::Vertex vertices[4];
-		int indices[6];
-		Rml::GeometryUtilities::GenerateQuad(vertices, indices, position, size, Rml::Colourb(255));
-
-		render_interface->RenderGeometry(vertices, 4, indices, 6, texture, Rml::Vector2f(0.f));
-	}
-}

+ 0 - 46
Samples/tutorial/datagrid/src/DecoratorDefender.h

@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#ifndef DECORATORDEFENDER_H
-#define DECORATORDEFENDER_H
-
-#include <RmlUi/Core/Decorator.h>
-
-/**
-	A decorator that displays the defender in the colour of its "colour" property.
-	@author Robert Curry
- */
-
-class DecoratorDefender : public Rml::Decorator
-{
-public:
-	virtual ~DecoratorDefender();
-
-	bool Initialise(const Rml::Texture& texture);
-
-	/// Called on a decorator to generate any required per-element data for a newly decorated element.
-	/// @param element[in] The newly decorated element.
-	/// @return A handle to a decorator-defined data handle, or nullptr if none is needed for the element.
-	Rml::DecoratorDataHandle GenerateElementData(Rml::Element* element) const override;
-	/// Called to release element data generated by this decorator.
-	/// @param element_data[in] The element data handle to release.
-	void ReleaseElementData(Rml::DecoratorDataHandle element_data) const override;
-
-	/// Called to render the decorator on an element.
-	/// @param element[in] The element to render the decorator on.
-	/// @param element_data[in] The handle to the data generated by the decorator for the element.
-	void RenderElement(Rml::Element* element, Rml::DecoratorDataHandle element_data) const override;
-
-private:
-	int image_index;
-};
-
-#endif

+ 0 - 41
Samples/tutorial/datagrid/src/DecoratorInstancerDefender.cpp

@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#include "DecoratorInstancerDefender.h"
-#include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/Types.h>
-#include <RmlUi/Core/PropertyDefinition.h>
-#include "DecoratorDefender.h"
-
-DecoratorInstancerDefender::DecoratorInstancerDefender()
-{
-	id_image_src = RegisterProperty("image-src", "").AddParser("string").GetId();
-	RegisterShorthand("decorator", "image-src", Rml::ShorthandType::FallThrough);
-}
-
-DecoratorInstancerDefender::~DecoratorInstancerDefender()
-{
-}
-
-// Instances a decorator given the property tag and attributes from the RCSS file.
-Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
-	const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& instancer_interface)
-{
-	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
-	Rml::String image_source = image_source_property->Get< Rml::String >();
-	Rml::Texture texture = instancer_interface.GetTexture(image_source);
-
-	auto decorator = Rml::MakeShared<DecoratorDefender>();
-	if (decorator->Initialise(texture))
-		return decorator;
-
-	return nullptr;
-}

+ 0 - 35
Samples/tutorial/datagrid/src/DecoratorInstancerDefender.h

@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#ifndef DECORATORINSTANCERDEFENDER_H
-#define DECORATORINSTANCERDEFENDER_H
-
-#include <RmlUi/Core/DecoratorInstancer.h>
-
-/**
-	Decorator instancer for the Defender decorator.
-	@author Robert Curry
- */
-
-class DecoratorInstancerDefender : public Rml::DecoratorInstancer
-{
-public:
-	DecoratorInstancerDefender();
-	virtual ~DecoratorInstancerDefender();
-
-	/// Instances a decorator given the property tag and attributes from the RCSS file.
-	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& instancer_interface) override;
-
-private:
-	Rml::PropertyId id_image_src;
-};
-
-#endif

+ 0 - 115
Samples/tutorial/datagrid/src/HighScores.cpp

@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#include "HighScores.h"
-#include <RmlUi/Core/StringUtilities.h>
-#include <RmlUi/Core/TypeConverter.h>
-#include <RmlUi/Core.h>
-#include <stdio.h>
-
-HighScores* HighScores::instance = nullptr;
-
-HighScores::HighScores()
-{
-	RMLUI_ASSERT(instance == nullptr);
-	instance = this;
-
-	for (int i = 0; i < NUM_SCORES; i++)
-	{
-		scores[i].score = -1;
-	}
-
-	LoadScores();
-}
-
-HighScores::~HighScores()
-{
-	RMLUI_ASSERT(instance == this);
-	instance = nullptr;
-}
-
-void HighScores::Initialise()
-{
-	new HighScores();
-}
-
-void HighScores::Shutdown()
-{
-	delete instance;
-}
-
-void HighScores::SubmitScore(const Rml::String& name, const Rml::Colourb& colour, int wave, int score)
-{
-	for (size_t i = 0; i < NUM_SCORES; i++)
-	{
-		if (score > scores[i].score)
-		{
-			// Push down all the other scores.
-			for (size_t j = NUM_SCORES - 1; j > i; j--)
-			{
-				scores[j] = scores[j - 1];
-			}
-
-			// Insert our new score.
-			scores[i].name = name;
-			scores[i].colour = colour;
-			scores[i].wave = wave;
-			scores[i].score = score;
-
-			return;
-		}
-	}
-}
-
-void HighScores::LoadScores()
-{
-	// Open and read the high score file.
-	Rml::FileInterface* file_interface = Rml::GetFileInterface();
-	Rml::FileHandle scores_file = file_interface->Open("tutorial/datagrid/data/high_score.txt");
-	
-	if (scores_file)
-	{
-		file_interface->Seek(scores_file, 0, SEEK_END);
-		size_t scores_length = file_interface->Tell(scores_file);
-		file_interface->Seek(scores_file, 0, SEEK_SET);
-
-		if (scores_length > 0)
-		{
-			char* buffer = new char[scores_length + 1];
-			file_interface->Read(buffer, scores_length, scores_file);
-			file_interface->Close(scores_file);
-			buffer[scores_length] = 0;
-
-			Rml::StringList score_lines;
-			Rml::StringUtilities::ExpandString(score_lines, buffer, '\n');
-			delete[] buffer;
-			
-			for (size_t i = 0; i < score_lines.size(); i++)
-			{
-				Rml::StringList score_parts;
-				Rml::StringUtilities::ExpandString(score_parts, score_lines[i], '\t');
-				if (score_parts.size() == 4)
-				{
-					Rml::Colourb colour;
-					int wave;
-					int score;
-
-					if (Rml::TypeConverter< Rml::String , Rml::Colourb >::Convert(score_parts[1], colour) &&
-						Rml::TypeConverter< Rml::String, int >::Convert(score_parts[2], wave) &&
-						Rml::TypeConverter< Rml::String, int >::Convert(score_parts[3], score))
-					{
-						SubmitScore(score_parts[0], colour, wave, score);
-					}
-				}
-			}
-		}
-	}
-}

+ 0 - 50
Samples/tutorial/datagrid/src/HighScores.h

@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#ifndef HIGHSCORES_H
-#define HIGHSCORES_H
-
-#include <RmlUi/Core/Types.h>
-
-const int NUM_SCORES = 10;
-
-/**
-	This class stores a list of high scores, and loads the high scores list from a file upon initialisation.
-	@author Robert Curry
- */
-
-class HighScores
-{
-public:
-	static void Initialise();
-	static void Shutdown();
-
-private:
-	HighScores();
-	~HighScores();
-
-	static HighScores* instance;
-
-	void SubmitScore(const Rml::String& name, const Rml::Colourb& colour, int wave, int score);
-	void LoadScores();
-
-	struct Score
-	{
-		Rml::String name;
-		Rml::Colourb colour;
-		int score;
-		int wave;
-	};
-
-	Score scores[NUM_SCORES];
-};
-
-#endif

+ 0 - 97
Samples/tutorial/datagrid/src/main.cpp

@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#include "DecoratorInstancerDefender.h"
-#include "HighScores.h"
-#include <RmlUi/Core.h>
-#include <RmlUi/Debugger.h>
-#include <RmlUi_Backend.h>
-#include <Shell.h>
-
-#if defined RMLUI_PLATFORM_WIN32
-	#include <RmlUi_Include_Windows.h>
-int APIENTRY WinMain(HINSTANCE /*instance_handle*/, HINSTANCE /*previous_instance_handle*/, char* /*command_line*/, int /*command_show*/)
-#else
-int main(int /*argc*/, char** /*argv*/)
-#endif
-{
-	int window_width = 1024;
-	int window_height = 768;
-
-	// Initializes the shell which provides common functionality used by the included samples.
-	if (!Shell::Initialize())
-		return -1;
-
-	// Constructs the system and render interfaces, creates a window, and attaches the renderer.
-	if (!Backend::Initialize("Datagrid Tutorial", window_width, window_height, true))
-	{
-		Shell::Shutdown();
-		return -1;
-	}
-
-	// Install the custom interfaces constructed by the backend before initializing RmlUi.
-	Rml::SetSystemInterface(Backend::GetSystemInterface());
-	Rml::SetRenderInterface(Backend::GetRenderInterface());
-
-	// RmlUi initialisation.
-	Rml::Initialise();
-
-	// Create the main RmlUi context.
-	Rml::Context* context = Rml::CreateContext("main", Rml::Vector2i(window_width, window_height));
-	if (!context)
-	{
-		Rml::Shutdown();
-		Backend::Shutdown();
-		Shell::Shutdown();
-		return -1;
-	}
-
-	Rml::Debugger::Initialise(context);
-	Shell::LoadFonts();
-
-	// Load the defender decorator.
-	DecoratorInstancerDefender decorator_instancer_defender;
-	Rml::Factory::RegisterDecoratorInstancer("defender", &decorator_instancer_defender);
-
-	// Construct the high scores.
-	HighScores::Initialise();
-
-	// Load and show the tutorial document.
-	Rml::ElementDocument* document = context->LoadDocument("tutorial/datagrid/data/tutorial.rml");
-	if (document)
-	{
-		document->GetElementById("title")->SetInnerRML(document->GetTitle());
-		document->Show();
-	}
-
-	bool running = true;
-	while (running)
-	{
-		running = Backend::ProcessEvents(context, &Shell::ProcessKeyDownShortcuts, true);
-
-		context->Update();
-
-		Backend::BeginFrame();
-		context->Render();
-		Backend::PresentFrame();
-	}
-
-	// Shut down the high scores.
-	HighScores::Shutdown();
-
-	// Shutdown RmlUi.
-	Rml::Shutdown();
-
-	Backend::Shutdown();
-	Shell::Shutdown();
-
-	return 0;
-}

+ 0 - 10
Samples/tutorial/datagrid_tree/data/high_score.txt

@@ -1,10 +0,0 @@
-Rml	233, 116, 81, 255	1	1000	36	12	10
-Ui	127, 255, 0, 255	1	900	30	12	9
-middleware	21, 96, 189, 255	1	800	28	10	8
-for	246, 74, 138, 255	1	700	26	10	7
-all	255, 0, 255, 255	1	600	24	10	5
-your	218, 165, 32, 255	1	500	30	6	2
-game	255, 255, 240, 255	1	400	24	4	2
-interface	233, 116, 81, 255	1	300	12	3	3
-needs	127, 255, 0, 255	1	200	8	2	2
-:)	21, 96, 189, 255	1	100	4	3	0

+ 0 - 15
Samples/tutorial/datagrid_tree/data/template.rml

@@ -1,15 +0,0 @@
-<template name="window" content="content">
-<head>
-	<link type="text/css" href="../../../assets/rml.rcss"/>
-	<link type="text/css" href="tutorial.rcss"/>
-</head>
-<body class="window">
-	<div id="title-bar">
-		<handle move_target="#document">
-			<span id="title">Dummy Title</span>
-		</handle>
-	</div>
-	<div id="content">
-	</div>
-</body>
-</template>

+ 0 - 157
Samples/tutorial/datagrid_tree/data/tutorial.rcss

@@ -1,157 +0,0 @@
-@spritesheet theme 
-{
-	src: /assets/invader.tga;
-
-	title-bar-l: 147px 0px 82px 85px;
-	title-bar-c: 229px 0px  1px 85px;
-	title-bar-r: 231px 0px 15px 85px;
-	
-	window-tl: 0px 0px 133px 140px;
-	window-t:  134px 0px 1px 140px;
-	window-tr: 136px 0px 10px 140px;
-	window-l:  0px 139px 10px 1px;
-	window-c:  11px 139px 1px 1px;
-	window-r:  10px 139px -10px 1px; /* mirrored left */
-	window-bl: 0px 140px 11px 11px;
-	window-b:  11px 140px 1px 11px;
-	window-br: 136px 140px 10px 11px;
-	
-	slidertrack-t: 70px 199px 27px 2px;
-	slidertrack-c: 70px 201px 27px 1px;
-	slidertrack-b: 70px 202px 27px 2px;
-	
-	sliderbar-t:         56px 152px 23px 23px;
-	sliderbar-c:         56px 175px 23px 1px;
-	sliderbar-b:         56px 176px 23px 22px;
-	sliderbar-hover-t:   80px 152px 23px 23px;
-	sliderbar-hover-c:   80px 175px 23px 1px;
-	sliderbar-hover-b:   80px 176px 23px 22px;
-	sliderbar-active-t: 104px 152px 23px 23px;
-	sliderbar-active-c: 104px 175px 23px 1px;
-	sliderbar-active-b: 104px 176px 23px 22px;
-	 
-	sliderarrowdec: 0px 152px 27px 24px;
-	sliderarrowdec-hover: 0px 177px 27px 24px;
-	sliderarrowdec-active: 0px 202px 27px 24px;
-	
-	sliderarrowinc: 28px 152px 27px 24px;
-	sliderarrowinc-hover: 28px 177px 27px 24px;
-	sliderarrowinc-active: 28px 202px 27px 24px;
-}
-
-body
-{
-	font-family: LatoLatin;
-	font-weight: normal;
-	font-style: normal;
-	font-size: 15dp;
-	color: white;
-}
-
-body.window
-{
-	padding: 10dp 15dp;
-	
-	decorator: tiled-box(
-		window-tl, window-t, window-tr, 
-		window-l, window-c, window-r,
-		window-bl, window-b, window-br
-	);
-}
-div#title-bar
-{
-	position: absolute;
-	top: -40dp;
-}
-
-div#title-bar span
-{
-	padding-left: 85dp;
-	padding-right: 25dp;
-	padding-top: 17dp;
-	padding-bottom: 48dp;
-
-	font-size: 20dp;
-	font-weight: bold;
-
-	font-effect: glow(2dp 2dp 0dp 1dp #1117);
-	
-	decorator: tiled-horizontal( title-bar-l, title-bar-c, title-bar-r );
-}
-
-div#content
-{
-	height: 100%;
-	overflow: auto;
-
-	z-index: 1;
-}
-
-scrollbarvertical
-{
-	margin-top: -6dp;
-	margin-bottom: -6dp;
-	margin-right: -11dp;
-	width: 27dp;
-}
-
-scrollbarvertical slidertrack
-{
-	decorator: tiled-vertical( slidertrack-t, slidertrack-c, slidertrack-b );
-}
-scrollbarvertical slidertrack:active
-{
-	image-color: #aaa;
-}
-
-scrollbarvertical sliderbar
-{
-	margin-left: 4dp;
-	width: 23dp;
-	min-height: 46dp;
-
-	decorator: tiled-vertical( sliderbar-t, sliderbar-c, sliderbar-b );
-}
-
-scrollbarvertical sliderbar:hover
-{
-	decorator: tiled-vertical( sliderbar-hover-t, sliderbar-hover-c, sliderbar-hover-b );
-}
-
-scrollbarvertical sliderbar:active
-{
-	decorator: tiled-vertical( sliderbar-active-t, sliderbar-active-c, sliderbar-active-b );
-}
-
-scrollbarvertical sliderarrowdec,
-scrollbarvertical sliderarrowinc
-{
-	width: 27dp;
-	height: 24dp;
-}
-
-scrollbarvertical sliderarrowdec
-{
-	decorator: image( sliderarrowdec );
-}
-scrollbarvertical sliderarrowdec:hover
-{
-	decorator: image( sliderarrowdec-hover );
-}
-scrollbarvertical sliderarrowdec:active
-{
-	decorator: image( sliderarrowdec-active );
-}
-
-scrollbarvertical sliderarrowinc
-{
-	decorator: image( sliderarrowinc );
-}
-scrollbarvertical sliderarrowinc:hover
-{
-	decorator: image( sliderarrowinc-hover );
-}
-scrollbarvertical sliderarrowinc:active
-{
-	decorator: image( sliderarrowinc-active );
-}

+ 0 - 138
Samples/tutorial/datagrid_tree/data/tutorial.rml

@@ -1,138 +0,0 @@
-<rml>
-<head>
-	<link type="text/template" href="template.rml"/>
-	<title>Datagrid Tutorial</title>
-	<style>
-		@spritesheet datagrid-theme
-		{
-			src: ../../../assets/invader.tga;
-			
-			datagridbody-tl: 281px 275px 11px 9px;
-			datagridbody-t:  292px 275px 1px 9px;
-			datagridbody-tr: 294px 275px 11px 9px;
-			datagridbody-l:  281px 283px 11px 1px;
-			datagridbody-c:  292px 283px 1px 1px;
-			datagridbody-bl: 281px 285px 11px 11px;
-			datagridbody-b:  292px 285px 1px 11px;
-			datagridbody-br: 294px 285px 11px 11px;
-			
-			datagridheader-l: 127px 192px 16px 31px;
-			datagridheader-c: 143px 192px 2px 31px;
-			datagridheader-r: 145px 192px 15px 31px;
-			
-			datagridexpand: 3px 232px 17px 17px;
-			datagridexpand-hover: 21px 232px 17px 17px;
-			datagridexpand-active: 39px 232px 17px 17px;
-			datagridexpand-collapsed: 3px 250px 17px 17px;
-			datagridexpand-collapsed-hover: 21px 250px 17px 17px;
-			datagridexpand-collapsed-active: 39px 250px 17px 17px;
-		}
-	
-		body
-		{
-			width: 400dp;
-			height: 300dp;
-
-			margin: auto;
-		}
-		
-		defender
-		{
-			display: block;
-			width: 64dp;
-			height: 16dp;
-			
-			decorator: defender( ../../../assets/high_scores_defender.tga );
-		}
-		
-		defender.alien_1
-		{
-			decorator: defender( ../../../assets/high_scores_alien_1.tga );
-		}
-		
-		defender.alien_2
-		{
-			decorator: defender( ../../../assets/high_scores_alien_2.tga );
-		}
-		
-		defender.alien_3
-		{
-			decorator: defender( ../../../assets/high_scores_alien_3.tga );
-		}
-		
-		datagridheader
-		{
-			width: auto;
-			height: 25dp;
-			padding: 5dp 10dp 0dp 10dp;
-		
-			decorator: tiled-horizontal( datagridheader-l, datagridheader-c, datagridheader-r );
-		}
-		
-		datagridbody
-		{
-			color: black;
-			text-align: center;
-			
-			margin-left: 4dp;
-			margin-right: 3dp;
-			padding: 0dp 4dp 4dp 4dp;
-			
-			decorator: tiled-box(
-				datagridbody-tl, datagridbody-t, datagridbody-tr, 
-				datagridbody-l, datagridbody-c, auto,  /* auto mirrors left */
-				datagridbody-bl, datagridbody-b, datagridbody-br
-			);
-		}
-		
-		datagrid datagridrow:nth-child(even)
-		{
-			background: #FFFFFFA0;
-		}
-		
-		datagridexpand
-		{
-			display: block;
-			
-			margin: 1dp 0dp 1dp 5dp;
-			height: 17dp;
-			width: 17dp;
-			
-			decorator: image( datagridexpand );
-		}
-
-		datagridexpand:hover
-		{
-			decorator: image( datagridexpand-hover );
-		}
-
-		datagridexpand:active
-		{
-			decorator: image( datagridexpand-active  );
-		}
-
-		datagridexpand.collapsed
-		{
-			decorator: image( datagridexpand-collapsed );
-		}
-
-		datagridexpand.collapsed:hover
-		{
-			decorator: image( datagridexpand-collapsed-hover );
-		}
-
-		datagridexpand.collapsed:active
-		{
-			decorator: image( datagridexpand-collapsed-active  );
-		}
-	</style>
-</head>
-<body template="window">
-	<datagrid source="high_scores.scores">
-		<col fields="name" width="40%">Pilot:</col>
-		<col fields="colour" formatter="ship" width="20%">Ship:</col>
-		<col fields="wave" width="20%">Wave:</col>
-		<col fields="score" width="20%">Score:</col>
-	</datagrid>
-</body>
-</rml>

+ 0 - 64
Samples/tutorial/datagrid_tree/src/DecoratorDefender.cpp

@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#include "DecoratorDefender.h"
-#include <RmlUi/Core/Element.h>
-#include <RmlUi/Core/GeometryUtilities.h>
-#include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/RenderInterface.h>
-#include <RmlUi/Core/Texture.h>
-
-DecoratorDefender::~DecoratorDefender() {}
-
-bool DecoratorDefender::Initialise(const Rml::Texture& texture)
-{
-	image_index = AddTexture(texture);
-	if (image_index == -1)
-	{
-		return false;
-	}
-
-	return true;
-}
-
-/// Called on a decorator to generate any required per-element data for a newly decorated element.
-Rml::DecoratorDataHandle DecoratorDefender::GenerateElementData(Rml::Element* RMLUI_UNUSED_PARAMETER(element)) const
-{
-	RMLUI_UNUSED(element);
-
-	return Rml::Decorator::INVALID_DECORATORDATAHANDLE;
-}
-
-// Called to release element data generated by this decorator.
-void DecoratorDefender::ReleaseElementData(Rml::DecoratorDataHandle RMLUI_UNUSED_PARAMETER(element_data)) const
-{
-	RMLUI_UNUSED(element_data);
-}
-
-// Called to render the decorator on an element.
-void DecoratorDefender::RenderElement(Rml::Element* element, Rml::DecoratorDataHandle RMLUI_UNUSED_PARAMETER(element_data)) const
-{
-	RMLUI_UNUSED(element_data);
-
-	Rml::Vector2f position = element->GetAbsoluteOffset(Rml::Box::PADDING);
-	Rml::Vector2f size = element->GetBox().GetSize(Rml::Box::PADDING);
-
-	if (Rml::RenderInterface* render_interface = element->GetRenderInterface())
-	{
-		Rml::TextureHandle texture = GetTexture(image_index)->GetHandle(render_interface);
-
-		Rml::Vertex vertices[4];
-		int indices[6];
-		Rml::GeometryUtilities::GenerateQuad(vertices, indices, position, size, Rml::Colourb(255));
-
-		render_interface->RenderGeometry(vertices, 4, indices, 6, texture, Rml::Vector2f(0.f));
-	}
-}

+ 0 - 46
Samples/tutorial/datagrid_tree/src/DecoratorDefender.h

@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#ifndef DECORATORDEFENDER_H
-#define DECORATORDEFENDER_H
-
-#include <RmlUi/Core/Decorator.h>
-
-/**
-	A decorator that displays the defender in the colour of its "colour" property.
-	@author Robert Curry
- */
-
-class DecoratorDefender : public Rml::Decorator
-{
-public:
-	virtual ~DecoratorDefender();
-
-	bool Initialise(const Rml::Texture& texture);
-
-	/// Called on a decorator to generate any required per-element data for a newly decorated element.
-	/// @param element[in] The newly decorated element.
-	/// @return A handle to a decorator-defined data handle, or nullptr if none is needed for the element.
-	Rml::DecoratorDataHandle GenerateElementData(Rml::Element* element) const override;
-	/// Called to release element data generated by this decorator.
-	/// @param element_data[in] The element data handle to release.
-	void ReleaseElementData(Rml::DecoratorDataHandle element_data) const override;
-
-	/// Called to render the decorator on an element.
-	/// @param element[in] The element to render the decorator on.
-	/// @param element_data[in] The handle to the data generated by the decorator for the element.
-	void RenderElement(Rml::Element* element, Rml::DecoratorDataHandle element_data) const override;
-
-private:
-	int image_index;
-};
-
-#endif

+ 0 - 41
Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.cpp

@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#include "DecoratorInstancerDefender.h"
-#include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/PropertyDefinition.h>
-#include <RmlUi/Core/Types.h>
-#include "DecoratorDefender.h"
-
-DecoratorInstancerDefender::DecoratorInstancerDefender()
-{
-	id_image_src = RegisterProperty("image-src", "").AddParser("string").GetId();
-	RegisterShorthand("decorator", "image-src", Rml::ShorthandType::FallThrough);
-}
-
-DecoratorInstancerDefender::~DecoratorInstancerDefender()
-{
-}
-
-// Instances a decorator given the property tag and attributes from the RCSS file.
-Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/,
-	const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& instancer_interface)
-{
-	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
-	Rml::String image_source = image_source_property->Get< Rml::String >();
-	Rml::Texture texture = instancer_interface.GetTexture(image_source);
-
-	auto decorator = Rml::MakeShared<DecoratorDefender>();
-	if (decorator->Initialise(texture))
-		return decorator;
-
-	return nullptr;
-}

+ 0 - 35
Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.h

@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#ifndef DECORATORINSTANCERDEFENDER_H
-#define DECORATORINSTANCERDEFENDER_H
-
-#include <RmlUi/Core/DecoratorInstancer.h>
-
-/**
-	Decorator instancer for the Defender decorator.
-	@author Robert Curry
- */
-
-class DecoratorInstancerDefender : public Rml::DecoratorInstancer
-{
-public:
-	DecoratorInstancerDefender();
-	virtual ~DecoratorInstancerDefender();
-
-	/// Instances a decorator given the property tag and attributes from the RCSS file.
-	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties, const Rml::DecoratorInstancerInterface& instancer_interface) override;
-
-private:
-	Rml::PropertyId id_image_src;
-};
-
-#endif

+ 0 - 177
Samples/tutorial/datagrid_tree/src/HighScores.cpp

@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#include "HighScores.h"
-#include <RmlUi/Core/StringUtilities.h>
-#include <RmlUi/Core/TypeConverter.h>
-#include <RmlUi/Core.h>
-#include <stdio.h>
-
-HighScores* HighScores::instance = nullptr;
-
-HighScores::HighScores() : Rml::DataSource("high_scores")
-{
-	RMLUI_ASSERT(instance == nullptr);
-	instance = this;
-
-	for (int i = 0; i < NUM_SCORES; i++)
-	{
-		scores[i].score = -1;
-	}
-
-	LoadScores();
-}
-
-HighScores::~HighScores()
-{
-	RMLUI_ASSERT(instance == this);
-	instance = nullptr;
-}
-
-void HighScores::Initialise()
-{
-	new HighScores();
-}
-
-void HighScores::Shutdown()
-{
-	delete instance;
-}
-
-void HighScores::GetRow(Rml::StringList& row, const Rml::String& table, int row_index, const Rml::StringList& columns)
-{
-	if (table == "scores")
-	{
-		for (size_t i = 0; i < columns.size(); i++)
-		{
-			if (columns[i] == "name")
-			{
-				row.push_back(scores[row_index].name);
-			}
-			else if (columns[i] == "score")
-			{
-				row.push_back(Rml::CreateString(32, "%d", scores[row_index].score));
-			}
-			else if (columns[i] == "colour")
-			{
-				Rml::String colour_string;
-				Rml::TypeConverter< Rml::Colourb, Rml::String >::Convert(scores[row_index].colour, colour_string);
-				row.push_back(colour_string);
-			}
-			else if (columns[i] == "wave")
-			{
-				row.push_back(Rml::CreateString(8, "%d", scores[row_index].wave));
-			}
-		}
-	}
-}
-
-int HighScores::GetNumRows(const Rml::String& table)
-{
-	if (table == "scores")
-	{
-		for (int i = 0; i < NUM_SCORES; i++)
-		{
-			if (scores[i].score == -1)
-			{
-				return i;
-			}
-		}
-
-		return NUM_SCORES;
-	}
-
-	return 0;
-}
-
-void HighScores::SubmitScore(const Rml::String& name, const Rml::Colourb& colour, int wave, int score, int alien_kills[])
-{
-	for (size_t i = 0; i < NUM_SCORES; i++)
-	{
-		if (score > scores[i].score)
-		{
-			// Push down all the other scores.
-			for (size_t j = NUM_SCORES - 1; j > i; j--)
-			{
-				scores[j] = scores[j - 1];
-			}
-
-			// Insert our new score.
-			scores[i].name = name;
-			scores[i].colour = colour;
-			scores[i].wave = wave;
-			scores[i].score = score;
-
-			for (int j = 0; j < NUM_ALIEN_TYPES; j++)
-			{
-				scores[i].alien_kills[j] = alien_kills[j];
-			}
-
-			NotifyRowAdd("scores", (int)i, 1);
-
-			return;
-		}
-	}
-}
-
-void HighScores::LoadScores()
-{
-	// Open and read the high score file.
-	Rml::FileInterface* file_interface = Rml::GetFileInterface();
-	Rml::FileHandle scores_file = file_interface->Open("tutorial/datagrid_tree/data/high_score.txt");
-	
-	if (scores_file)
-	{
-		file_interface->Seek(scores_file, 0, SEEK_END);
-		size_t scores_length = file_interface->Tell(scores_file);
-		file_interface->Seek(scores_file, 0, SEEK_SET);
-
-		if (scores_length > 0)
-		{
-			char* buffer = new char[scores_length + 1];
-			file_interface->Read(buffer, scores_length, scores_file);
-			file_interface->Close(scores_file);
-			buffer[scores_length] = 0;
-
-			Rml::StringList score_lines;
-			Rml::StringUtilities::ExpandString(score_lines, buffer, '\n');
-			delete[] buffer;
-
-			for (size_t i = 0; i < score_lines.size(); i++)
-			{
-				Rml::StringList score_parts;
-				Rml::StringUtilities::ExpandString(score_parts, score_lines[i], '\t');
-				if (score_parts.size() == 4 + NUM_ALIEN_TYPES)
-				{
-					Rml::Colourb colour;
-					int wave;
-					int score;
-					int alien_kills[NUM_ALIEN_TYPES];
-
-					if (Rml::TypeConverter< Rml::String , Rml::Colourb >::Convert(score_parts[1], colour) &&
-						Rml::TypeConverter< Rml::String, int >::Convert(score_parts[2], wave) &&
-						Rml::TypeConverter< Rml::String, int >::Convert(score_parts[3], score))
-					{
-						for (int j = 0; j < NUM_ALIEN_TYPES; j++)
-						{
-							if (!Rml::TypeConverter< Rml::String, int >::Convert(score_parts[4 + j], alien_kills[j]))
-							{
-								break;
-							}
-						}
-
-						SubmitScore(score_parts[0], colour, wave, score, alien_kills);
-					}
-				}
-			}
-		}
-	}
-}

+ 0 - 57
Samples/tutorial/datagrid_tree/src/HighScores.h

@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#ifndef HIGHSCORES_H
-#define HIGHSCORES_H
-
-#include <RmlUi/Core/Types.h>
-#include <RmlUi/Core/Elements/DataSource.h>
-
-const int NUM_SCORES = 10;
-const int NUM_ALIEN_TYPES = 3;
-
-/**
-	This class stores a list of high scores, and loads the high scores list from a file upon initialisation.
-	@author Robert Curry
- */
-
-class HighScores : public Rml::DataSource
-{
-public:
-	static void Initialise();
-	static void Shutdown();
-
-	void GetRow(Rml::StringList& row, const Rml::String& table, int row_index, const Rml::StringList& columns);
-	int GetNumRows(const Rml::String& table);
-
-private:
-	HighScores();
-	~HighScores();
-
-	static HighScores* instance;
-
-	void SubmitScore(const Rml::String& name, const Rml::Colourb& colour, int wave, int score, int alien_kills[]);
-	void LoadScores();
-
-	struct Score
-	{
-		Rml::String name;
-		Rml::Colourb colour;
-		int score;
-		int wave;
-
-		int alien_kills[NUM_ALIEN_TYPES];
-	};
-
-	Score scores[NUM_SCORES];
-};
-
-#endif

+ 0 - 34
Samples/tutorial/datagrid_tree/src/HighScoresShipFormatter.cpp

@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#include "HighScoresShipFormatter.h"
-#include <RmlUi/Core/TypeConverter.h>
-
-HighScoresShipFormatter::HighScoresShipFormatter() : Rml::DataFormatter("ship")
-{
-}
-
-HighScoresShipFormatter::~HighScoresShipFormatter()
-{
-}
-
-void HighScoresShipFormatter::FormatData(Rml::String& formatted_data, const Rml::StringList& raw_data)
-{
-	// Data format:
-	// raw_data[0] is the colour, in "%d, %d, %d, %d" format.
-
-	Rml::Colourb ship_colour;
-	Rml::TypeConverter< Rml::String, Rml::Colourb >::Convert(raw_data[0], ship_colour);
-
-	Rml::String colour_string = Rml::CreateString(32, "%d,%d,%d", ship_colour.red, ship_colour.green, ship_colour.blue);
-
-	formatted_data = "<defender style=\"color: rgb(" + colour_string + ");\" />";
-}

+ 0 - 31
Samples/tutorial/datagrid_tree/src/HighScoresShipFormatter.h

@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#ifndef HIGHSCORESSHIPFORMATTER_H
-#define HIGHSCORESSHIPFORMATTER_H
-
-#include <RmlUi/Core/Elements/DataFormatter.h>
-
-/**
-	Formats the colour of the player's ship to a <defender> tag, which is linked to the defender decorator.
-	@author Robert Curry
- */
-
-class HighScoresShipFormatter : public Rml::DataFormatter
-{
-	public:
-		HighScoresShipFormatter();
-		~HighScoresShipFormatter();
-
-		void FormatData(Rml::String& formatted_data, const Rml::StringList& raw_data);
-};
-
-#endif

+ 0 - 101
Samples/tutorial/datagrid_tree/src/main.cpp

@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2006 - 2008
- * Wandering Monster Studios Limited
- *
- * Any use of this program is governed by the terms of Wandering Monster
- * Studios Limited's Licence Agreement included with this program, a copy
- * of which can be obtained by contacting Wandering Monster Studios
- * Limited at [email protected].
- *
- */
-
-#include "DecoratorInstancerDefender.h"
-#include "HighScores.h"
-#include "HighScoresShipFormatter.h"
-#include <RmlUi/Core.h>
-#include <RmlUi/Debugger.h>
-#include <RmlUi_Backend.h>
-#include <Shell.h>
-
-#if defined RMLUI_PLATFORM_WIN32
-	#include <RmlUi_Include_Windows.h>
-int APIENTRY WinMain(HINSTANCE /*instance_handle*/, HINSTANCE /*previous_instance_handle*/, char* /*command_line*/, int /*command_show*/)
-#else
-int main(int /*argc*/, char** /*argv*/)
-#endif
-{
-	int window_width = 1024;
-	int window_height = 768;
-
-	// Initializes the shell which provides common functionality used by the included samples.
-	if (!Shell::Initialize())
-		return -1;
-
-	// Constructs the system and render interfaces, creates a window, and attaches the renderer.
-	if (!Backend::Initialize("Datagrid Tree Tutorial", window_width, window_height, true))
-	{
-		Shell::Shutdown();
-		return -1;
-	}
-
-	// Install the custom interfaces constructed by the backend before initializing RmlUi.
-	Rml::SetSystemInterface(Backend::GetSystemInterface());
-	Rml::SetRenderInterface(Backend::GetRenderInterface());
-
-	// RmlUi initialisation.
-	Rml::Initialise();
-
-	// Create the main RmlUi context.
-	Rml::Context* context = Rml::CreateContext("main", Rml::Vector2i(window_width, window_height));
-	if (!context)
-	{
-		Rml::Shutdown();
-		Backend::Shutdown();
-		Shell::Shutdown();
-		return -1;
-	}
-
-	Rml::Debugger::Initialise(context);
-	Shell::LoadFonts();
-
-	// Load the defender decorator.
-	DecoratorInstancerDefender decorator_instancer_defender;
-	Rml::Factory::RegisterDecoratorInstancer("defender", &decorator_instancer_defender);
-
-	// Add the ship formatter.
-	HighScoresShipFormatter ship_formatter;
-
-	// Construct the high scores.
-	HighScores::Initialise();
-
-	// Load and show the tutorial document.
-	Rml::ElementDocument* document = context->LoadDocument("tutorial/datagrid_tree/data/tutorial.rml");
-	if (document)
-	{
-		document->GetElementById("title")->SetInnerRML(document->GetTitle());
-		document->Show();
-	}
-
-	bool running = true;
-	while (running)
-	{
-		running = Backend::ProcessEvents(context, &Shell::ProcessKeyDownShortcuts, true);
-
-		context->Update();
-
-		Backend::BeginFrame();
-		context->Render();
-		Backend::PresentFrame();
-	}
-
-	// Shut down the high scores.
-	HighScores::Shutdown();
-
-	// Shutdown RmlUi.
-	Rml::Shutdown();
-
-	Backend::Shutdown();
-	Shell::Shutdown();
-
-	return 0;
-}

+ 0 - 75
Source/Core/Elements/DataFormatter.cpp

@@ -1,75 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "../../../Include/RmlUi/Core/Elements/DataFormatter.h"
-#include "../../../Include/RmlUi/Core/StringUtilities.h"
-
-namespace Rml {
-
-typedef UnorderedMap< String, DataFormatter* > DataFormatterMap;
-static DataFormatterMap data_formatters;
-
-DataFormatter::DataFormatter(const String& _name)
-{
-	if (!_name.empty())
-	{
-		name = _name;
-	}
-	else
-	{
-		name = CreateString(64, "%p", (void*)this);
-	}
-	data_formatters[name] = this;
-}
-
-DataFormatter::~DataFormatter()
-{
-}
-
-const String& DataFormatter::GetDataFormatterName()
-{
-	return name;
-}
-
-DataFormatter* DataFormatter::GetDataFormatter(const String& data_formatter_name)
-{
-	DataFormatterMap::iterator i = data_formatters.find(data_formatter_name);
-	if (i == data_formatters.end())
-	{
-		return nullptr;
-	}
-
-	return (*i).second;
-}
-
-void* DataFormatter::GetScriptObject() const
-{
-	return nullptr;
-}
-
-} // namespace Rml

+ 0 - 160
Source/Core/Elements/DataQuery.cpp

@@ -1,160 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "../../../Include/RmlUi/Core/Elements/DataQuery.h"
-#include "../../../Include/RmlUi/Core/Elements/DataSource.h"
-#include <algorithm>
-
-namespace Rml {
-
-class DataQuerySort
-{
-	public:
-		DataQuerySort(const StringList& _order_parameters)
-		{
-			order_parameters = _order_parameters;
-		}
-
-		bool operator()(const StringList& RMLUI_UNUSED_PARAMETER(left), const StringList& RMLUI_UNUSED_PARAMETER(right))
-		{
-			RMLUI_UNUSED(left);
-			RMLUI_UNUSED(right);
-
-			return false;
-		}
-
-	private:
-		StringList order_parameters;
-};
-
-
-
-DataQuery::DataQuery(DataSource* data_source, const String& table, const String& _fields, int offset, int limit, const String& order)
-{
-	ExecuteQuery(data_source, table, _fields, offset, limit, order);
-}
-
-
-
-DataQuery::DataQuery()
-{
-	data_source = nullptr;
-	table = "";
-	offset = -1;
-	limit = -1;
-	current_row = -1;
-}
-
-
-
-DataQuery::~DataQuery()
-{
-}
-
-
-
-void DataQuery::ExecuteQuery(DataSource* _data_source, const String& _table, const String& _fields, int _offset, int _limit, const String& order)
-{
-	data_source = _data_source;
-	table = _table;
-	offset = _offset;
-	limit = _limit;
-
-	// Set up the field list and field index cache.
-	StringUtilities::ExpandString(fields, _fields);
-	for (size_t i = 0; i < fields.size(); i++)
-	{
-		field_indices[fields[i]] = i;
-	}
-
-	// Initialise the row pointer.
-	current_row = -1;
-
-	// If limit is -1, then we fetch to the end of the data source.
-	if (limit == -1)
-	{
-		limit = data_source->GetNumRows(table) - offset;
-	}
-
-	if (!order.empty())
-	{
-		// Fetch the rows from offset to limit.
-		rows.resize(limit);
-		for (int i = 0; i < limit; i++)
-		{
-			data_source->GetRow(rows[i], table, offset + i, fields);
-		}
-
-		// Now sort the rows, based on the ordering requirements.
-		StringList order_parameters;
-		StringUtilities::ExpandString(order_parameters, order);
-		std::sort(rows.begin(), rows.end(), DataQuerySort(order_parameters));
-	}
-}
-
-
-
-bool DataQuery::NextRow()
-{
-	current_row++;
-
-	if (current_row >= limit)
-	{
-		return false;
-	}
-
-	LoadRow();
-	return true;
-}
-
-
-
-bool DataQuery::IsFieldSet(const String& field) const
-{
-	FieldIndices::const_iterator itr = field_indices.find(field);
-	if (itr == field_indices.end() || (*itr).second >= rows[current_row].size())
-	{
-		return false;
-	}
-
-	return true;
-}
-
-
-
-void DataQuery::LoadRow()
-{
-	RMLUI_ASSERT(current_row <= (int)rows.size());
-	if (current_row >= (int)rows.size())
-	{
-		rows.push_back(StringList());
-		data_source->GetRow(rows[current_row], table, offset + current_row, fields);
-	}
-}
-
-} // namespace Rml

+ 0 - 175
Source/Core/Elements/DataSource.cpp

@@ -1,175 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "../../../Include/RmlUi/Core/Elements/DataSource.h"
-#include "../../../Include/RmlUi/Core/Elements/DataSourceListener.h"
-#include "../../../Include/RmlUi/Core/StringUtilities.h"
-#include "../../../Include/RmlUi/Core/Log.h"
-#include <algorithm>
-
-namespace Rml {
-
-const String DataSource::CHILD_SOURCE("#child_data_source");
-const String DataSource::DEPTH("#depth");
-const String DataSource::NUM_CHILDREN("#num_children");
-
-typedef UnorderedMap< String, DataSource* > DataSourceMap;
-static DataSourceMap data_sources;
-
-DataSource::DataSource(const String& _name)
-{
-	if (!_name.empty())
-	{
-		name = _name;
-	}
-	else
-	{
-		name = CreateString(64, "%p", (void*)this);
-	}
-	data_sources[name] = this;
-}
-
-DataSource::~DataSource()
-{
-	ListenerList listeners_copy = listeners;
-	for (auto& listener : listeners_copy)
-	{
-		if (listener)
-			listener->OnDataSourceDestroy(this);
-	}
-
-	DataSourceMap::iterator iterator = data_sources.find(name);
-	if (iterator != data_sources.end() &&
-		iterator->second == this)
-	{
-		data_sources.erase(name);
-	}
-}
-
-const String& DataSource::GetDataSourceName()
-{
-	return name;
-}
-
-DataSource* DataSource::GetDataSource(const String& data_source_name)
-{
-	DataSourceMap::iterator i = data_sources.find(data_source_name);
-	if (i == data_sources.end())
-	{
-		return nullptr;
-	}
-
-	return (*i).second;
-}
-
-void DataSource::AttachListener(DataSourceListener* listener)
-{
-	if (std::find(listeners.begin(), listeners.end(), listener) != listeners.end())
-	{
-		RMLUI_ERROR;
-		return;
-	}
-	listeners.push_back(listener->GetObserverPtr());
-}
-
-void DataSource::DetachListener(DataSourceListener* listener)
-{
-	ListenerList::iterator i = std::find(listeners.begin(), listeners.end(), listener);
-	RMLUI_ASSERT(i != listeners.end());
-	if (i != listeners.end())
-	{
-		listeners.erase(i);
-	}
-}
-
-void* DataSource::GetScriptObject() const
-{
-	return nullptr;
-}
-
-void DataSource::NotifyRowAdd(const String& table, int first_row_added, int num_rows_added)
-{
-	ListenerList listeners_copy = listeners;
-	for (auto& listener : listeners_copy)
-	{
-		if (listener)
-			listener->OnRowAdd(this, table, first_row_added, num_rows_added);
-	}
-}
-
-void DataSource::NotifyRowRemove(const String& table, int first_row_removed, int num_rows_removed)
-{
-	ListenerList listeners_copy = listeners;
-	for (auto& listener : listeners_copy)
-	{
-		if (listener)
-			listener->OnRowRemove(this, table, first_row_removed, num_rows_removed);
-	}
-}
-
-void DataSource::NotifyRowChange(const String& table, int first_row_changed, int num_rows_changed)
-{
-	ListenerList listeners_copy = listeners;
-	for (auto& listener : listeners_copy)
-	{
-		if (listener)
-			listener->OnRowChange(this, table, first_row_changed, num_rows_changed);
-	}
-}
-
-void DataSource::NotifyRowChange(const String& table)
-{
-	ListenerList listeners_copy = listeners;
-	for (auto& listener : listeners_copy)
-	{
-		if (listener)
-			listener->OnRowChange(this, table);
-	}
-}
-
-void DataSource::BuildRowEntries(StringList& row, const RowMap& row_map, const StringList& columns)
-{
-	// Reserve the number of entries.
-	row.resize(columns.size());
-	for (size_t i = 0; i < columns.size(); i++)
-	{
-		// Look through our row_map for each entry and add it to the result set
-		RowMap::const_iterator itr = row_map.find(columns[i]);
-		if (itr != row_map.end())
-		{
-			row[i] = (*itr).second;
-		}
-		else
-		{
-			row[i] = "";
-			Log::Message(Log::LT_ERROR, "Failed to find required data source column %s", columns[i].c_str());
-		}
-	}
-}
-
-} // namespace Rml

+ 0 - 112
Source/Core/Elements/DataSourceListener.cpp

@@ -1,112 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "../../../Include/RmlUi/Core/Elements/DataSourceListener.h"
-#include "../../../Include/RmlUi/Core/Elements/DataSource.h"
-#include "../../../Include/RmlUi/Core/StringUtilities.h"
-#include "../../../Include/RmlUi/Core/Log.h"
-
-namespace Rml {
-
-DataSourceListener::DataSourceListener()
-{
-}
-
-DataSourceListener::~DataSourceListener()
-{
-}
-
-// Notification of the destruction of an observed data source.
-void DataSourceListener::OnDataSourceDestroy(DataSource* RMLUI_UNUSED_PARAMETER(data_source))
-{
-	RMLUI_UNUSED(data_source);
-}
-
-// Notification of the addition of one or more rows to an observed data source's table.
-void DataSourceListener::OnRowAdd(DataSource* RMLUI_UNUSED_PARAMETER(data_source), const String& RMLUI_UNUSED_PARAMETER(table), int RMLUI_UNUSED_PARAMETER(first_row_added), int RMLUI_UNUSED_PARAMETER(num_rows_added))
-{
-	RMLUI_UNUSED(data_source);
-	RMLUI_UNUSED(table);
-	RMLUI_UNUSED(first_row_added);
-	RMLUI_UNUSED(num_rows_added);
-}
-
-// Notification of the removal of one or more rows from an observed data source's table.
-void DataSourceListener::OnRowRemove(DataSource* RMLUI_UNUSED_PARAMETER(data_source), const String& RMLUI_UNUSED_PARAMETER(table), int RMLUI_UNUSED_PARAMETER(first_row_removed), int RMLUI_UNUSED_PARAMETER(num_rows_removed))
-{
-	RMLUI_UNUSED(data_source);
-	RMLUI_UNUSED(table);
-	RMLUI_UNUSED(first_row_removed);
-	RMLUI_UNUSED(num_rows_removed);
-}
-
-// Notification of the changing of one or more rows from an observed data source's table.
-void DataSourceListener::OnRowChange(DataSource* RMLUI_UNUSED_PARAMETER(data_source), const String& RMLUI_UNUSED_PARAMETER(table), int RMLUI_UNUSED_PARAMETER(first_row_changed), int RMLUI_UNUSED_PARAMETER(num_rows_changed))
-{
-	RMLUI_UNUSED(data_source);
-	RMLUI_UNUSED(table);
-	RMLUI_UNUSED(first_row_changed);
-	RMLUI_UNUSED(num_rows_changed);
-}
-
-// Notification of the change of all of the data of an observed data source's table.
-void DataSourceListener::OnRowChange(DataSource* RMLUI_UNUSED_PARAMETER(data_source), const String& RMLUI_UNUSED_PARAMETER(table))
-{
-	RMLUI_UNUSED(data_source);
-	RMLUI_UNUSED(table);
-}
-
-// Sets up data source and table from a given string.
-bool DataSourceListener::ParseDataSource(DataSource*& data_source, String& table_name, const String& data_source_name)
-{
-	if (data_source_name.size() == 0)
-	{
-		data_source = nullptr;
-		table_name = "";
-		return false;
-	}
-
-	StringList data_source_parts;
-	StringUtilities::ExpandString(data_source_parts, data_source_name, '.');
-
-	DataSource* new_data_source = DataSource::GetDataSource(data_source_parts[0]);
-
-	if (data_source_parts.size() != 2 || !new_data_source)
-	{
-		Log::Message(Log::LT_ERROR, "Bad data source name %s", data_source_name.c_str());
-		data_source = nullptr;
-		table_name = "";
-		return false;
-	}
-
-	data_source = new_data_source;
-	table_name = data_source_parts[1];
-	return true;
-}
-
-} // namespace Rml

+ 0 - 280
Source/Core/Elements/ElementDataGrid.cpp

@@ -1,280 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGrid.h"
-#include "../../../Include/RmlUi/Core/Elements/DataSource.h"
-#include "../../../Include/RmlUi/Core/Math.h"
-#include "../../../Include/RmlUi/Core/XMLParser.h"
-#include "../../../Include/RmlUi/Core/Event.h"
-#include "../../../Include/RmlUi/Core/ElementDocument.h"
-#include "../../../Include/RmlUi/Core/Factory.h"
-#include "../../../Include/RmlUi/Core/Property.h"
-#include "../../../Include/RmlUi/Core/Elements/DataFormatter.h"
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGridRow.h"
-
-namespace Rml {
-
-ElementDataGrid::ElementDataGrid(const String& tag) : Element(tag)
-{
-	XMLAttributes attributes;
-
-	// Create the row for the column headers:
-	ElementPtr element = Factory::InstanceElement(this, "#rmlctl_datagridrow", "datagridheader", attributes);
-	header = static_cast<ElementDataGridRow*>(element.get());
-	header->SetProperty(PropertyId::Display, Property(Style::Display::Block));
-	header->Initialise(this);
-	AppendChild(std::move(element));
-
-	element = Factory::InstanceElement(this, "*", "datagridbody", attributes);
-	body = element.get();
-	body->SetProperty(PropertyId::Display, Property(Style::Display::Block));
-	body->SetProperty(PropertyId::Width, Property(Style::Width::Auto));
-	AppendChild(std::move(element));
-
-	element = Factory::InstanceElement(this, "#rmlctl_datagridrow", "datagridroot", attributes);
-	root = static_cast<ElementDataGridRow*>(element.get());
-	root->SetProperty(PropertyId::Display, Property(Style::Display::None));
-	root->Initialise(this);
-	AppendChild(std::move(element), false);
-
-	SetProperty(PropertyId::OverflowX, Property(Style::Overflow::Auto));
-	SetProperty(PropertyId::OverflowY, Property(Style::Overflow::Auto));
-
-	new_data_source = "";
-}
-
-ElementDataGrid::~ElementDataGrid()
-{
-}
-
-void ElementDataGrid::SetDataSource(const String& data_source_name)
-{
-	new_data_source = data_source_name;
-}
-
-// Adds a column to the table.
-bool ElementDataGrid::AddColumn(const String& fields, const String& formatter, float initial_width, const String& header_rml)
-{
-	ElementPtr header_element = Factory::InstanceElement(this, "datagridcolumn", "datagridcolumn", XMLAttributes());
-	if (!header_element)
-		return false;
-
-	if (!Factory::InstanceElementText(header_element.get(), header_rml))
-	{
-		return false;
-	}
-
-	AddColumn(fields, formatter, initial_width, std::move(header_element));
-	return true;
-}
-
-// Adds a column to the table.
-void ElementDataGrid::AddColumn(const String& fields, const String& formatter, float initial_width, ElementPtr header_element)
-{
-	Column column;
-	StringUtilities::ExpandString(column.fields, fields);
-	column.formatter = DataFormatter::GetDataFormatter(formatter);
-	column.header = header;
-	column.current_width = initial_width;
-	column.refresh_on_child_change = false;
-
-	// The header elements are added to the header row at the top of the table.
-	if (header_element)
-	{
-		header_element->SetProperty(PropertyId::Display, Property(Style::Display::InlineBlock));
-
-		// Push all the width properties from the column onto the header element.
-		String width = header_element->GetAttribute<String>("width", "100%");
-		header_element->SetProperty("width", width);
-
-		header->AppendChild(std::move(header_element));
-	}
-
-	// Add the fields that this column requires to the concatenated string of all column fields.
-	for (size_t i = 0; i < column.fields.size(); i++)
-	{
-		// Don't append the depth or num_children fields, as they're handled by the row.
-		if (column.fields[i] == DataSource::NUM_CHILDREN)
-		{
-			column.refresh_on_child_change = true;
-		}
-		else if (column.fields[i] != DataSource::DEPTH)
-		{
-			if (!column_fields.empty())
-			{
-				column_fields += ",";
-			}
-			column_fields += column.fields[i];
-		}
-	}
-
-	columns.push_back(column);
-
-	Dictionary parameters;
-	parameters["index"] = (int)(columns.size() - 1);
-	if (DispatchEvent(EventId::Columnadd, parameters))
-	{
-		root->RefreshRows();
-		DirtyLayout();
-	}
-}
-
-// Returns the number of columns in this table
-int ElementDataGrid::GetNumColumns()
-{
-	return (int)columns.size();
-}
-
-// Returns the column at the specified index.
-const ElementDataGrid::Column* ElementDataGrid::GetColumn(int column_index)
-{
-	if (column_index < 0 || column_index >= (int)columns.size())
-	{
-		RMLUI_ERROR;
-		return nullptr;
-	}
-
-	return &columns[column_index];
-}
-
-/// Returns a CSV string containing all the fields that each column requires, in order.
-const String& ElementDataGrid::GetAllColumnFields()
-{
-	return column_fields;
-}
-
-// Adds a new row to the table - usually only called by child rows.
-ElementDataGridRow* ElementDataGrid::AddRow(ElementDataGridRow* parent, int index)
-{
-	// Now we make a new row at the right place then return it.
-	XMLAttributes attributes;
-	ElementPtr element = Factory::InstanceElement(this, "#rmlctl_datagridrow", "datagridrow", attributes);
-	ElementDataGridRow* new_row = rmlui_dynamic_cast< ElementDataGridRow* >(element.get());
-
-	new_row->Initialise(this, parent, index, header, parent->GetDepth() + 1);
-
-	// We need to work out the table-specific row.
-	int table_relative_index = parent->GetChildTableRelativeIndex(index);
-
-	Element* child_to_insert_before = nullptr;
-	if (table_relative_index < body->GetNumChildren())
-	{
-		child_to_insert_before = body->GetChild(table_relative_index);
-	}
-	body->InsertBefore(std::move(element), child_to_insert_before);
-
-	// As the rows have changed, we need to lay out the document again.
-	DirtyLayout();
-
-	return new_row;
-}
-
-// Removes a row from the table.
-void ElementDataGrid::RemoveRows(int index, int num_rows)
-{
-	for (int i = 0; i < num_rows; i++)
-	{
-		ElementDataGridRow* row = GetRow(index);
-		row->SetDataSource("");
-		body->RemoveChild(row);
-	}
-
-	// As the rows have changed, we need to lay out the document again.
-	DirtyLayout();
-}
-
-// Returns the number of rows in the table
-int ElementDataGrid::GetNumRows() const
-{
-	return body->GetNumChildren();
-}
-
-// Returns the row at the given index in the table.
-ElementDataGridRow* ElementDataGrid::GetRow(int index) const
-{
-	// We need to add two to the index, to skip the header row.
-	ElementDataGridRow* row = rmlui_dynamic_cast< ElementDataGridRow* >(body->GetChild(index));
-	return row;
-}
-
-void ElementDataGrid::OnUpdate()
-{
-	if (!new_data_source.empty())
-	{
-		root->SetDataSource(new_data_source);
-		new_data_source = "";
-	}
-
-	bool any_new_children = root->UpdateChildren();
-	if (any_new_children)
-	{
-		DispatchEvent(EventId::Rowupdate, Dictionary());
-	}
-}
-
-
-void ElementDataGrid::OnResize()
-{
-	SetScrollTop(GetScrollHeight() - GetClientHeight());
-
-	for (int i = 0; i < header->GetNumChildren(); i++)
-	{
-		Element* child = header->GetChild(i);
-		columns[i].current_width = child->GetBox().GetSize(Box::MARGIN).x;
-	}
-}
-
-// Gets the markup and content of the element.
-void ElementDataGrid::GetInnerRML(String& content) const
-{
-	// The only content we have is the columns, and inside them the header elements.
-	for (size_t i = 0; i < columns.size(); i++)
-	{
-		Element* header_element = header->GetChild((int)i);
-
-		String column_fields;
-		for (size_t j = 0; j < columns[i].fields.size(); j++)
-		{
-			if (j != columns[i].fields.size() - 1)
-			{
-				column_fields += ",";
-			}
-			column_fields += columns[i].fields[j];
-		}
-		String width_attribute = header_element->GetAttribute<String>("width", "");
-
-		content += CreateString(column_fields.size() + 32, "<col fields=\"%s\"", column_fields.c_str());
-		if (!width_attribute.empty())
-			content += CreateString(width_attribute.size() + 32, " width=\"%s\"", width_attribute.c_str());
-		content += ">";
-		header_element->GetInnerRML(content);
-		content += "</col>";
-	}
-}
-
-} // namespace Rml

+ 0 - 60
Source/Core/Elements/ElementDataGridCell.cpp

@@ -1,60 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGridCell.h"
-#include "../../../Include/RmlUi/Core/Event.h"
-#include "../../../Include/RmlUi/Core/Property.h"
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGrid.h"
-
-namespace Rml {
-
-ElementDataGridCell::ElementDataGridCell(const String& tag) : Element(tag), column(0), header(nullptr)
-{
-}
-
-ElementDataGridCell::~ElementDataGridCell()
-{
-}
-
-void ElementDataGridCell::Initialise(int _column, Element* _header)
-{
-	column = _column;
-	header = _header;
-	if (header)
-	{
-		if(auto p = header->GetLocalProperty("width"))
-			SetProperty(PropertyId::Width, *p);
-	}
-}
-
-int ElementDataGridCell::GetColumn()
-{
-	return column;
-}
-
-} // namespace Rml

+ 0 - 78
Source/Core/Elements/ElementDataGridExpandButton.cpp

@@ -1,78 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGridExpandButton.h"
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGridRow.h"
-
-namespace Rml {
-
-ElementDataGridExpandButton::ElementDataGridExpandButton(const String& tag) : Element(tag)
-{
-	SetClass("collapsed", true);
-}
-
-ElementDataGridExpandButton::~ElementDataGridExpandButton()
-{
-}
-
-void ElementDataGridExpandButton::ProcessDefaultAction(Event& event)
-{
-	Element::ProcessDefaultAction(event);
-
-	if (event == EventId::Click && event.GetCurrentElement() == this)
-	{
-		// Look for the first data grid row above us, and toggle their on/off
-		// state.
-		Element* parent = GetParentNode();
-		ElementDataGridRow* parent_row;
-		do
-		{
-			parent_row = rmlui_dynamic_cast< ElementDataGridRow* >(parent);
-			parent = parent->GetParentNode();
-		}
-		while (parent && !parent_row);
-
-		if (parent_row)
-		{
-			parent_row->ToggleRow();
-
-			if (parent_row->IsRowExpanded())
-			{
-				SetClass("collapsed", false);
-				SetClass("expanded", true);
-			}
-			else
-			{
-				SetClass("collapsed", true);
-				SetClass("expanded", false);
-			}
-		}
-	}
-}
-
-} // namespace Rml

+ 0 - 695
Source/Core/Elements/ElementDataGridRow.cpp

@@ -1,695 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGridRow.h"
-#include "../../../Include/RmlUi/Core/Elements/DataSource.h"
-#include "../../../Include/RmlUi/Core/Elements/DataFormatter.h"
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGrid.h"
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGridCell.h"
-#include "../../../Include/RmlUi/Core/Factory.h"
-#include "../../../Include/RmlUi/Core/Types.h"
-#include "../Clock.h"
-
-namespace Rml {
-
-static const float MAX_UPDATE_TIME = 0.001f;
-
-ElementDataGridRow::ElementDataGridRow(const String& tag) : Element(tag)
-{
-	parent_grid = nullptr;
-	parent_row = nullptr;
-	child_index = -1;
-	depth = -1;
-
-	data_source = nullptr;
-
-	table_relative_index = -1;
-	table_relative_index_dirty = true;
-	dirty_cells = true;
-	dirty_children = false;
-	row_expanded = true;
-
-	SetProperty(PropertyId::WhiteSpace, Property(Style::WhiteSpace::Nowrap));
-	SetProperty(PropertyId::Display, Property(Style::Display::InlineBlock));
-}
-
-ElementDataGridRow::~ElementDataGridRow()
-{
-	if (data_source)
-	{
-		data_source->DetachListener(this);
-		data_source = nullptr;
-	}
-}
-
-void ElementDataGridRow::Initialise(ElementDataGrid* _parent_grid, ElementDataGridRow* _parent_row, int _child_index, ElementDataGridRow* header_row, int _depth)
-{
-	parent_grid = _parent_grid;
-	parent_row = _parent_row;
-	child_index = _child_index;
-	depth = _depth;
-
-	// We start all the rows collapsed, except for the root row.
-	if (child_index != -1)
-	{
-		row_expanded = false;
-	}
-
-	int num_columns = parent_grid->GetNumColumns();
-	XMLAttributes cell_attributes;
-	for (int i = 0; i < num_columns; i++)
-	{
-		ElementPtr element = Factory::InstanceElement(this, "#rmlctl_datagridcell", "datagridcell", cell_attributes);
-		ElementDataGridCell* cell = rmlui_dynamic_cast< ElementDataGridCell* >(element.get());
-		cell->Initialise(i, header_row->GetChild(i));
-		cell->SetProperty(PropertyId::Display, Property(Style::Display::InlineBlock));
-		AppendChild(std::move(element));
-	}
-}
-
-void ElementDataGridRow::SetChildIndex(int _child_index)
-{
-	if (child_index != _child_index)
-	{	
-		child_index = _child_index;
-
-		if (parent_row)
-		{
-			parent_row->ChildChanged(child_index);
-		}
-	}
-}
-
-int ElementDataGridRow::GetDepth()
-{
-	return depth;
-}
-
-void ElementDataGridRow::SetDataSource(const String& data_source_name)
-{
-	if (data_source != nullptr)
-	{
-		data_source->DetachListener(this);
-		data_source = nullptr;
-	}
-
-	if (ParseDataSource(data_source, data_table, data_source_name))
-	{
-		data_source->AttachListener(this);
-		RefreshRows();
-	}
-}
-
-bool ElementDataGridRow::UpdateChildren()
-{
-	if (dirty_children)
-	{
-		double start_time = Clock::GetElapsedTime();
-		
-		RowQueue dirty_rows;
-		dirty_rows.push(this);
-
-		while (!dirty_rows.empty())
-		{
-			ElementDataGridRow* dirty_row = dirty_rows.front();
-			dirty_rows.pop();
-			
-			float time_slice = MAX_UPDATE_TIME - float(Clock::GetElapsedTime() - start_time);
-			if (time_slice <= 0.0f)
-				break;
-
-			dirty_row->LoadChildren(time_slice);
-			for (size_t i = 0; i < dirty_row->children.size(); i++)
-			{
-				if (dirty_row->children[i]->dirty_cells || dirty_row->children[i]->dirty_children)
-				{
-					dirty_rows.push(dirty_row->children[i]);
-				}
-			}
-		}
-
-		return true;
-	}
-	
-	return false;
-}
-
-// Returns the number of children that aren't dirty (have been loaded)
-int ElementDataGridRow::GetNumLoadedChildren()
-{
-	int num_loaded_children = 0;
-	for (size_t i = 0; i < children.size(); i++)
-	{
-		if (!children[i]->dirty_cells)
-		{
-			num_loaded_children++;
-		}
-		num_loaded_children += children[i]->GetNumLoadedChildren();
-	}
-
-	return num_loaded_children;
-}
-
-bool ElementDataGridRow::IsRowExpanded()
-{
-	return row_expanded;
-}
-
-void ElementDataGridRow::ExpandRow()
-{
-	row_expanded = true;
-
-	for (size_t i = 0; i < children.size(); i++)
-	{
-		children[i]->Show();
-	}
-
-	DirtyLayout();
-}
-
-void ElementDataGridRow::CollapseRow()
-{
-	row_expanded = false;
-
-	for (size_t i = 0; i < children.size(); i++)
-	{
-		children[i]->Hide();
-	}
-
-	DirtyLayout();
-}
-
-void ElementDataGridRow::ToggleRow()
-{
-	if (row_expanded)
-	{
-		CollapseRow();
-	}
-	else
-	{
-		ExpandRow();
-	}
-}
-
-// Returns the index of this row, relative to its parent.
-int ElementDataGridRow::GetParentRelativeIndex()
-{
-	return child_index;
-}
-
-// Returns the index of this row, relative to the table rather than its parent.
-int ElementDataGridRow::GetTableRelativeIndex()
-{
-	if (!parent_row)
-	{
-		return -1;
-	}
-
-	if (table_relative_index_dirty)
-	{
-		table_relative_index = parent_row->GetChildTableRelativeIndex(child_index);
-		table_relative_index_dirty = false;
-	}
-
-	return table_relative_index;
-}
-
-// Returns the parent row of this row.
-ElementDataGridRow* ElementDataGridRow::GetParentRow()
-{
-	return parent_row;
-}
-
-// Returns the grid that this row belongs to.
-ElementDataGrid* ElementDataGridRow::GetParentGrid()
-{
-	return parent_grid;
-}
-
-void ElementDataGridRow::OnDataSourceDestroy(DataSource* /*data_source*/)
-{
-	if(data_source != nullptr)
-	{
-		data_source->DetachListener(this);
-		data_source = nullptr;
-	}
-	RemoveChildren();
-}
-
-void ElementDataGridRow::OnRowAdd(DataSource* _data_source, const String& _data_table, int first_row_added, int num_rows_added)
-{
-	if (_data_source == data_source && _data_table == data_table)
-		AddChildren(first_row_added, num_rows_added);
-}
-
-void ElementDataGridRow::OnRowRemove(DataSource* _data_source, const String& _data_table, int first_row_removed, int num_rows_removed)
-{
-	if (_data_source == data_source && _data_table == data_table)
-		RemoveChildren(first_row_removed, num_rows_removed);
-}
-
-void ElementDataGridRow::OnRowChange(DataSource* _data_source, const String& _data_table, int first_row_changed, int num_rows_changed)
-{
-	if (_data_source == data_source && _data_table == data_table)
-		ChangeChildren(first_row_changed, num_rows_changed);
-}
-
-void ElementDataGridRow::OnRowChange(DataSource* _data_source, const String& _data_table)
-{
-	if (_data_source == data_source && _data_table == data_table)
-		RefreshRows();
-}
-
-// Removes all the child cells and fetches them again from the data source.
-void ElementDataGridRow::RefreshRows()
-{
-	// Remove all our child rows from the table.
-	RemoveChildren();
-
-	// Load the children from the data source.
-	if (data_source != nullptr)
-	{
-		int num_rows = data_source->GetNumRows(data_table);
-		if (num_rows > 0)
-		{
-			AddChildren(0, num_rows);
-		}
-	}
-}
-
-// Called when a row change (addition or removal) occurs in one of our
-// children.
-void ElementDataGridRow::ChildChanged(int child_row_index)
-{
-	for (int i = child_row_index + 1; i < (int)children.size(); i++)
-	{
-		children[i]->DirtyTableRelativeIndex();
-	}
-
-	if (parent_row)
-	{
-		parent_row->ChildChanged(child_index);
-	}
-}
-
-// Checks if any columns are dependent on the number of children present, and
-// refreshes them from the data source if they are.
-void ElementDataGridRow::RefreshChildDependentCells()
-{
-	if (child_index != -1)
-	{
-		for (int i = 0; i < parent_grid->GetNumColumns(); i++)
-		{
-			const ElementDataGrid::Column* column = parent_grid->GetColumn(i);
-			if (column->refresh_on_child_change)
-			{
-				DirtyCells();
-			}
-		}
-	}
-}
-
-// Called whenever a row is added or removed above ours.
-void ElementDataGridRow::DirtyTableRelativeIndex()
-{
-	if (table_relative_index_dirty)
-		return;
-
-	for (size_t i = 0; i < children.size(); i++)
-	{
-		children[i]->DirtyTableRelativeIndex();
-	}
-
-	table_relative_index_dirty = true;
-}
-
-int ElementDataGridRow::GetChildTableRelativeIndex(int child_index)
-{
-	// We start with our index, then count down each of the children until we
-	// reach child_index. For each child we skip by add one (for the child
-	// itself) and all of its descendants.
-	int child_table_index = GetTableRelativeIndex() + 1;
-
-	for (int i = 0; i < child_index; i++)
-	{
-		child_table_index++;
-		child_table_index += children[i]->GetNumDescendants();
-	}
-
-	return child_table_index;
-}
-
-// Adds children underneath this row, and fetches their contents (and possible
-// children) from the row's data source.
-void ElementDataGridRow::AddChildren(int first_row_added, int num_rows_added)
-{
-	if (first_row_added == -1)
-	{
-		first_row_added = (int)children.size();
-	}
-
-	// We need to make a row for each new child, then pass through the cell
-	// information and the child's data source (if one exists.)
-	if (data_source != nullptr)
-	{
-		for (int i = 0; i < num_rows_added; i++)
-		{
-			int row_index = first_row_added + i;
-
-			// Make a new row:
-			ElementDataGridRow* new_row = parent_grid->AddRow(this, row_index);
-			children.insert(children.begin() + row_index, new_row);
-
-			if (!row_expanded)
-			{
-				new_row->SetProperty(PropertyId::Display, Property(Style::Display::None));
-			}
-		}
-
-		for (int i = first_row_added + num_rows_added; i < (int)children.size(); i++)
-		{
-			children[i]->SetChildIndex(i);
-			children[i]->DirtyTableRelativeIndex();
-		}
-
-		if (parent_row)
-		{
-			parent_row->ChildChanged(child_index);
-		}
-	}
-
-	RefreshChildDependentCells();
-	DirtyRow();
-
-	Dictionary parameters;
-	parameters["first_row_added"] = GetChildTableRelativeIndex(first_row_added);
-	parameters["num_rows_added"] = num_rows_added;
-	
-	parent_grid->DispatchEvent(EventId::Rowadd, parameters);
-}
-
-void ElementDataGridRow::RemoveChildren(int first_row_removed, int num_rows_removed)
-{
-	if (num_rows_removed == -1)
-		num_rows_removed = (int)children.size() - first_row_removed;
-
-	for (int i = num_rows_removed - 1; i >= 0; i--)
-	{
-		children[first_row_removed + i]->RemoveChildren();
-		parent_grid->RemoveRows(children[first_row_removed + i]->GetTableRelativeIndex());
-	}
-
-	children.erase(children.begin() + first_row_removed, children.begin() + (first_row_removed + num_rows_removed));
-    for (int i = first_row_removed; i < (int) children.size(); i++)
-	{
-		children[i]->SetChildIndex(i);
-		children[i]->DirtyTableRelativeIndex();
-	}
-
-	Dictionary parameters;
-	parameters["first_row_removed"] = GetChildTableRelativeIndex(first_row_removed);
-	parameters["num_rows_removed"] = num_rows_removed;
-	
-	parent_grid->DispatchEvent(EventId::Rowremove, parameters);
-}
-
-void ElementDataGridRow::ChangeChildren(int first_row_changed, int num_rows_changed)
-{
-	for (int i = first_row_changed; i < first_row_changed + num_rows_changed; i++)
-		children[i]->DirtyCells();
-
-	Dictionary parameters;
-	parameters["first_row_changed"] = GetChildTableRelativeIndex(first_row_changed);
-	parameters["num_rows_changed"] = num_rows_changed;
-	
-	parent_grid->DispatchEvent(EventId::Rowchange, parameters);
-}
-
-// Returns the number of rows under this row (children, grandchildren, etc)
-int ElementDataGridRow::GetNumDescendants()
-{
-	int num_descendants = (int)children.size();
-
-	for (size_t i = 0; i < children.size(); i++)
-		num_descendants += children[i]->GetNumDescendants();
-
-	return num_descendants;
-}
-
-// Adds the cell contents, and marks the row as loaded.
-void ElementDataGridRow::Load(const DataQuery& row_information)
-{
-	// Check for a data source. If they're both set then we set
-	// ourselves up with it.
-	if (row_information.IsFieldSet(DataSource::CHILD_SOURCE))
-	{
-		String data_source = row_information.Get< String >(DataSource::CHILD_SOURCE, "");
-		if (!data_source.empty())
-		{
-			SetDataSource(data_source);
-		}
-		else
-		{
-			// If we've no data source, then we should remove any children.
-			RemoveChildren();
-		}
-	}
-
-	// Now load our cells.
-	for (int i = 0; i < parent_grid->GetNumColumns(); i++)
-	{
-		Element* cell = GetChild(i);
-
-		if (cell)
-		{
-			// Fetch the column:
-			const ElementDataGrid::Column* column = parent_grid->GetColumn(i);
-
-			// Now we use the column's formatter to process the raw data into the
-			// XML string, and parse that into the actual Elements. If there is
-			// no formatter, then we just send through the raw text, in CVS form.
-			StringList raw_data;
-			raw_data.reserve(column->fields.size());
-			size_t raw_data_total_len = 0;
-			for (size_t j = 0; j < column->fields.size(); j++)
-			{
-				if (column->fields[j] == DataSource::DEPTH)
-				{
-					raw_data.push_back(CreateString(8, "%d", depth));
-					raw_data_total_len += raw_data.back().length();
-				}
-				else if (column->fields[j] == DataSource::NUM_CHILDREN)
-				{
-					raw_data.push_back(CreateString(8, "%zu", children.size()));
-					raw_data_total_len += raw_data.back().length();
-				}
-				else
-				{
-					raw_data.push_back(row_information.Get< String >(column->fields[j], ""));
-					raw_data_total_len += raw_data.back().length();
-				}
-			}
-
-			String cell_string;
-			if (column->formatter)
-			{
-				column->formatter->FormatData(cell_string, raw_data);
-			}
-			else
-			{
-				cell_string.reserve(raw_data_total_len + raw_data.size() + 1);
-				for (size_t j = 0; j < raw_data.size(); j++)
-				{
-					if (j > 0)
-					{
-						cell_string += ",";
-					}
-					cell_string += raw_data[j];
-				}
-			}
-
-			// Remove all the cell's current contents.
-			while (cell->GetNumChildren(true) > 0)
-			{
-				cell->RemoveChild(cell->GetChild(0));
-			}
-
-			// Add the new contents to the cell.
-			Factory::InstanceElementText(cell, cell_string);
-		}
-		else
-		{
-			RMLUI_ERROR;
-		}
-	}
-
-	dirty_cells = false;
-}
-
-// Instantiates the children that haven't been fully loaded yet.
-void ElementDataGridRow::LoadChildren(float time_slice)
-{
-	double start_time = Clock::GetElapsedTime();
-
-	int data_query_offset = -1;
-	int data_query_limit = -1;
-
-	// Iterate through the list of children and find the holes of unloaded
-	// rows.
-	//  - If we find an unloaded element, and we haven't set the offset
-	//    (beginning of the hole), then we've hit a new hole. We set the offset
-	//    to the current index and the limit (size of the hole) to 1. If we've
-	//    found a hole already and we find an unloaded element, then we
-	//    increase the size of the hole.
-	//  - The end of a hole is either a loaded element or the end of the list.
-	//    In either case, we check if we have a hole that's unfilled, and if
-	//    so, we fill it.
-	bool any_dirty_children = false;
-	for (size_t i = 0; i < children.size() && float(Clock::GetElapsedTime() - start_time) < time_slice; i++)
-	{
-		if (children[i]->dirty_cells)
-		{
-			any_dirty_children = true;
-			if (data_query_offset == -1)
-			{
-				data_query_offset = (int)i;
-				data_query_limit = 1;
-			}
-			else
-			{
-				data_query_limit++;
-			}
-		}
-		else if (children[i]->dirty_children)
-		{
-			any_dirty_children = true;
-		}
-
-		bool end_of_list = i == children.size() - 1;
-		bool unfilled_hole = data_query_offset != -1;
-		bool end_of_hole_found = !children[i]->dirty_cells;
-
-		// If this is the last element and we've found no holes (or filled them
-		// all in) then all our children are loaded.
-		if (end_of_list && !unfilled_hole)
-		{
-			if (!any_dirty_children)
-			{
-				dirty_children = false;
-			}
-		}
-		// Otherwise, if we have a hole outstanding and we've either hit the
-		// end of the list or the end of the hole, fill the hole.
-		else if (unfilled_hole && (end_of_list || end_of_hole_found))
-		{
-			float load_time_slice = time_slice - float(Clock::GetElapsedTime() - start_time);
-			LoadChildren(data_query_offset, data_query_limit, load_time_slice);
-			data_query_offset =  -1;
-			data_query_limit = -1;
-		}
-	}
-
-	if (children.empty())
-	{
-		dirty_children = false;
-	}
-}
-
-void ElementDataGridRow::LoadChildren(int first_row_to_load, int num_rows_to_load, double time_slice)
-{
-	double start_time = Clock::GetElapsedTime();
-
-	// Now fetch these new children from the data source, pass them
-	// through each column's data formatter, and add them as our new
-	// child rows.
-	String column_query = parent_grid->GetAllColumnFields() + "," + DataSource::CHILD_SOURCE;
-	DataQuery query(data_source, data_table, column_query, first_row_to_load, num_rows_to_load);
-
-	for (int i = 0; i < num_rows_to_load; i++)
-	{
-		int index = first_row_to_load + i;
-
-		if (!query.NextRow())
-		{
-			Log::Message(Log::LT_WARNING, "Failed to load row %d from data source %s", i, data_table.c_str());
-		}
-
-		// Now load the child with the row in the query.
-		children[index]->Load(query);
-
-		if (float(Clock::GetElapsedTime() - start_time) > time_slice)
-		{
-			break;
-		}
-	}
-}
-
-void ElementDataGridRow::DirtyCells()
-{
-	dirty_cells = true;
-	if (parent_row)
-	{
-		parent_row->DirtyRow();
-	}
-}
-
-void ElementDataGridRow::DirtyRow()
-{
-	dirty_children = true;
-	if (parent_row)
-	{
-		parent_row->DirtyRow();
-	}
-}
-
-// Sets this row's child rows to be visible.
-void ElementDataGridRow::Show()
-{
-	SetProperty(PropertyId::Display, Property(Style::Display::InlineBlock));
-
-	if (row_expanded)
-	{
-		for (size_t i = 0; i < children.size(); i++)
-		{
-			children[i]->Show();
-		}
-	}
-}
-
-// Sets this row's children to be invisible.
-void ElementDataGridRow::Hide()
-{
-	SetProperty(PropertyId::Display, Property(Style::Display::None));
-
-	for (size_t i = 0; i < children.size(); i++)
-	{
-		children[i]->Hide();
-	}
-}
-
-} // namespace Rml

+ 0 - 1
Source/Core/Elements/ElementForm.cpp

@@ -55,7 +55,6 @@ void ElementForm::Submit(const String& name, const String& submit_value)
 	ElementUtilities::GetElementsByTagName(form_controls, this, "input");
 	ElementUtilities::GetElementsByTagName(form_controls, this, "textarea");
 	ElementUtilities::GetElementsByTagName(form_controls, this, "select");
-	ElementUtilities::GetElementsByTagName(form_controls, this, "dataselect");
 
 	for (size_t i = 0; i < form_controls.size(); i++)
 	{

+ 0 - 237
Source/Core/Elements/ElementFormControlDataSelect.cpp

@@ -1,237 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "../../../Include/RmlUi/Core/Elements/ElementFormControlDataSelect.h"
-#include "../../../Include/RmlUi/Core/Elements/DataQuery.h"
-#include "../../../Include/RmlUi/Core/Elements/DataSource.h"
-#include "../../../Include/RmlUi/Core/Elements/DataFormatter.h"
-#include "WidgetDropDown.h"
-
-namespace Rml {
-
-// Constructs a new ElementFormControlDataSelect.
-ElementFormControlDataSelect::ElementFormControlDataSelect(const String& tag) : ElementFormControlSelect(tag)
-{
-	data_source = nullptr;
-	initialised = false;
-}
-
-ElementFormControlDataSelect::~ElementFormControlDataSelect()
-{
-	if (data_source != nullptr) {
-		data_source->DetachListener(this);
-		data_source = nullptr;
-	}
-}
-
-// Sets the data source the control's options are driven from.
-void ElementFormControlDataSelect::SetDataSource(const String& _data_source)
-{
-	SetAttribute("source", _data_source);
-}
-
-// If a new data source has been set on the control, this will attach to it and build the initial
-// options.
-void ElementFormControlDataSelect::OnUpdate()
-{
-	if (!initialised)
-	{
-		initialised = true;
-
-		if (ParseDataSource(data_source, data_table, GetAttribute< String >("source", "")))
-		{
-			data_source->AttachListener(this);
-			BuildOptions();
-		}
-	}
-}
-
-// Checks for changes to the data source or formatting attributes.
-void ElementFormControlDataSelect::OnAttributeChange(const ElementAttributes& changed_attributes)
-{
-	ElementFormControlSelect::OnAttributeChange(changed_attributes);
-
-	if (changed_attributes.find("source") != changed_attributes.end())
-	{
-		if (data_source != nullptr) {
-			data_source->DetachListener(this);
-			data_source = nullptr;
-		}
-
-		initialised = false;
-	}
-	else if (changed_attributes.find("fields") != changed_attributes.end() ||
-			 changed_attributes.find("valuefield") != changed_attributes.end() ||
-			 changed_attributes.find("formatter") != changed_attributes.end())
-	{
-		BuildOptions();
-	}
-}
-
-// Detaches from the data source and rebuilds the options.
-void ElementFormControlDataSelect::OnDataSourceDestroy(DataSource* _data_source)
-{
-	if (data_source == _data_source)
-	{
-		data_source->DetachListener(this);
-		data_source = nullptr;
-		data_table = "";
-
-		BuildOptions();
-	}
-}
-
-// Rebuilds the available options from the data source.
-void ElementFormControlDataSelect::OnRowAdd(DataSource* RMLUI_UNUSED_PARAMETER(data_source), const String& table, int RMLUI_UNUSED_PARAMETER(first_row_added), int RMLUI_UNUSED_PARAMETER(num_rows_added))
-{
-	RMLUI_UNUSED(data_source);
-	RMLUI_UNUSED(first_row_added);
-	RMLUI_UNUSED(num_rows_added);
-
-	if (table == data_table)
-		BuildOptions();
-}
-
-// Rebuilds the available options from the data source.
-void ElementFormControlDataSelect::OnRowRemove(DataSource* RMLUI_UNUSED_PARAMETER(data_source), const String& table, int RMLUI_UNUSED_PARAMETER(first_row_removed), int RMLUI_UNUSED_PARAMETER(num_rows_removed))
-{
-	RMLUI_UNUSED(data_source);
-	RMLUI_UNUSED(first_row_removed);
-	RMLUI_UNUSED(num_rows_removed);
-	
-	if (table == data_table)
-		BuildOptions();
-}
-
-// Rebuilds the available options from the data source.
-void ElementFormControlDataSelect::OnRowChange(DataSource* RMLUI_UNUSED_PARAMETER(data_source), const String& table, int RMLUI_UNUSED_PARAMETER(first_row_changed), int RMLUI_UNUSED_PARAMETER(num_rows_changed))
-{
-	RMLUI_UNUSED(data_source);
-	RMLUI_UNUSED(first_row_changed);
-	RMLUI_UNUSED(num_rows_changed);
-	
-	if (table == data_table)
-		BuildOptions();
-}
-
-// Rebuilds the available options from the data source.
-void ElementFormControlDataSelect::OnRowChange(DataSource* RMLUI_UNUSED_PARAMETER(data_source), const String& table)
-{
-	RMLUI_UNUSED(data_source);
-
-	if (table == data_table)
-		BuildOptions();
-}
-
-// Builds the option list from the data source.
-void ElementFormControlDataSelect::BuildOptions()
-{
-	widget->ClearOptions();
-
-	if (data_source == nullptr)
-		return;
-
-	// Store the old selection value and index. These will be used to restore the selection to the
-	// most appropriate option after the options have been rebuilt.
-	String old_value = GetValue();
-	int old_selection = GetSelection();
-
-	String fields_attribute = GetAttribute<String>("fields", "");
-	String valuefield_attribute = GetAttribute<String>("valuefield", "");
-	String data_formatter_attribute = GetAttribute<String>("formatter", "");
-	DataFormatter* data_formatter = nullptr;
-
-	// Process the attributes.
-	if (fields_attribute.empty())
-	{
-		Log::Message(Log::LT_ERROR, "DataQuery failed, no fields specified for %s.", GetTagName().c_str());
-		return;
-	}
-
-	if (valuefield_attribute.empty())
-	{
-		valuefield_attribute = fields_attribute.substr(0, fields_attribute.find(','));
-	}
-
-	if (!data_formatter_attribute.empty())
-	{
-		data_formatter = DataFormatter::GetDataFormatter(data_formatter_attribute);
-		if (!data_formatter)
-			Log::Message(Log::LT_WARNING, "Unable to find data formatter named '%s', formatting skipped.", data_formatter_attribute.c_str());
-	}
-
-	// Build a list of attributes
-	String fields(valuefield_attribute);
-	fields += ",";
-	fields += fields_attribute;
-
-	DataQuery query(data_source, data_table, fields);
-	while (query.NextRow())
-	{
-		StringList fields_list;
-		String value = query.Get<String>(0, "");
-
-		for (size_t i = 1; i < query.GetNumFields(); ++i)
-			fields_list.push_back(query.Get< String>(i, ""));
-
-		String formatted;
-		if (fields_list.size() > 0)
-			formatted = fields_list[0];
-
-		if (data_formatter)
-			data_formatter->FormatData(formatted, fields_list);
-
-		// Add the data as an option.
-		widget->AddOption(formatted, value, -1, false);
-	}
-
-	// If an option was selected before, attempt to restore the selection to it.
-	if (old_selection > -1)
-	{
-		// Try to find a selection with the same value as the previous one.
-		for (int i = 0; i < GetNumOptions(); ++i)
-		{
-			Element* option = GetOption(i);
-			Variant* variant = option->GetAttribute("value");
-			if (variant && variant->Get<String>() == old_value)
-			{
-				widget->SetSelection(option, true);
-				return;
-			}
-		}
-
-		// Failed to find an option with the same value. Attempt to at least set the same index.
-		int new_selection = Math::Clamp(old_selection, 0, GetNumOptions() - 1);
-		if (GetNumOptions() == 0)
-			new_selection = -1;
-
-		widget->SetSelection(GetOption(new_selection), true);
-	}
-}
-
-} // namespace Rml

+ 0 - 115
Source/Core/Elements/XMLNodeHandlerDataGrid.cpp

@@ -1,115 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include "XMLNodeHandlerDataGrid.h"
-#include "../../../Include/RmlUi/Core/StreamMemory.h"
-#include "../../../Include/RmlUi/Core/Log.h"
-#include "../../../Include/RmlUi/Core/Factory.h"
-#include "../../../Include/RmlUi/Core/XMLParser.h"
-#include "../../../Include/RmlUi/Core/Elements/ElementDataGrid.h"
-
-namespace Rml {
-
-XMLNodeHandlerDataGrid::XMLNodeHandlerDataGrid()
-{
-}
-
-XMLNodeHandlerDataGrid::~XMLNodeHandlerDataGrid()
-{
-}
-
-Element* XMLNodeHandlerDataGrid::ElementStart(XMLParser* parser, const String& name, const XMLAttributes& attributes)
-{
-	Element* result = nullptr;
-	Element* parent = parser->GetParseFrame()->element;
-
-	RMLUI_ASSERT(name == "datagrid" || name == "col");
-
-	if (name == "datagrid")
-	{
-		// Attempt to instance the grid.
-		ElementPtr element = Factory::InstanceElement(parent, name, name, attributes);
-		ElementDataGrid* grid = rmlui_dynamic_cast< ElementDataGrid* >(element.get());
-		if (!grid)
-		{
-			element.reset();
-			Log::Message(Log::LT_ERROR, "Instancer failed to create data grid for tag %s.", name.c_str());
-			return nullptr;
-		}
-
-		// Set the data source and table on the data grid.
-		String data_source = Get<String>(attributes, "source", "");
-		grid->SetDataSource(data_source);
-
-		result = parent->AppendChild(std::move(element));
-
-		// Switch to this handler for all columns.
-		parser->PushHandler("datagrid");
-	}
-	else if (name == "col")
-	{
-		// Make a new node handler to handle the header elements.		
-		ElementPtr element = Factory::InstanceElement(parent, "datagridcolumn", "datagridcolumn", attributes);
-		if (!element)
-			return nullptr;
-
-		result = element.get();
-
-		ElementDataGrid* grid = rmlui_dynamic_cast< ElementDataGrid* >(parent);
-		if (grid)
-			grid->AddColumn(Get<String>(attributes, "fields", ""), Get<String>(attributes, "formatter", ""), Get(attributes, "width", 0.0f), std::move(element));
-
-		// Switch to element handler for all children.
-		parser->PushDefaultHandler();
-	}
-	else
-	{
-		RMLUI_ERROR;
-	}
-
-	return result;
-}
-
-bool XMLNodeHandlerDataGrid::ElementEnd(XMLParser* RMLUI_UNUSED_PARAMETER(parser), const String& RMLUI_UNUSED_PARAMETER(name))
-{
-	RMLUI_UNUSED(parser);
-	RMLUI_UNUSED(name);
-
-	return true;
-}
-
-bool XMLNodeHandlerDataGrid::ElementData(XMLParser* parser, const String& data, XMLDataType RMLUI_UNUSED_PARAMETER(type))
-{
-	RMLUI_UNUSED(type);
-	Element* parent = parser->GetParseFrame()->element;
-
-	// Parse the text into the parent element.
-	return Factory::InstanceElementText(parent, data);
-}
-
-} // namespace Rml

+ 0 - 58
Source/Core/Elements/XMLNodeHandlerDataGrid.h

@@ -1,58 +0,0 @@
-/*
- * 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_CORE_ELEMENTS_XMLNODEHANDLERDATAGRID_H
-#define RMLUI_CORE_ELEMENTS_XMLNODEHANDLERDATAGRID_H
-
-#include "../../../Include/RmlUi/Core/Types.h"
-#include "../../../Include/RmlUi/Core/XMLNodeHandler.h"
-
-namespace Rml {
-
-/**
-	Node handler for the construction of a data grid.
-
-	@author Robert Curry
- */
-
-class XMLNodeHandlerDataGrid : public XMLNodeHandler
-{
-public:
-	XMLNodeHandlerDataGrid();
-	virtual ~XMLNodeHandlerDataGrid();
-
-	/// Called when a new element is opened.
-	Element* ElementStart(XMLParser* parser, const String& name, const XMLAttributes& attributes) override;
-	/// Called when an element is closed.
-	bool ElementEnd(XMLParser* parser, const String& name) override;
-	/// Called for element data.
-	bool ElementData(XMLParser* parser, const String& data, XMLDataType type) override;
-};
-
-} // namespace Rml
-#endif

+ 0 - 19
Source/Core/Factory.cpp

@@ -42,16 +42,11 @@
 
 #include "../../Include/RmlUi/Core/Elements/ElementForm.h"
 #include "../../Include/RmlUi/Core/Elements/ElementFormControlInput.h"
-#include "../../Include/RmlUi/Core/Elements/ElementFormControlDataSelect.h"
 #include "../../Include/RmlUi/Core/Elements/ElementFormControlSelect.h"
 #include "../../Include/RmlUi/Core/Elements/ElementFormControlSelect.h"
 #include "../../Include/RmlUi/Core/Elements/ElementFormControlTextArea.h"
 #include "../../Include/RmlUi/Core/Elements/ElementTabSet.h"
 #include "../../Include/RmlUi/Core/Elements/ElementProgress.h"
-#include "../../Include/RmlUi/Core/Elements/ElementDataGrid.h"
-#include "../../Include/RmlUi/Core/Elements/ElementDataGridExpandButton.h"
-#include "../../Include/RmlUi/Core/Elements/ElementDataGridCell.h"
-#include "../../Include/RmlUi/Core/Elements/ElementDataGridRow.h"
 
 #include "ContextInstancerDefault.h"
 #include "DataControllerDefault.h"
@@ -81,7 +76,6 @@
 #include "Elements/ElementImage.h"
 #include "Elements/ElementLabel.h"
 #include "Elements/ElementTextSelection.h"
-#include "Elements/XMLNodeHandlerDataGrid.h"
 #include "Elements/XMLNodeHandlerSelect.h"
 #include "Elements/XMLNodeHandlerTabSet.h"
 #include "Elements/XMLNodeHandlerTextArea.h"
@@ -142,7 +136,6 @@ struct DefaultInstancers {
 	// Control elements
 	ElementInstancerGeneric<ElementForm> form;
 	ElementInstancerGeneric<ElementFormControlInput> input;
-	ElementInstancerGeneric<ElementFormControlDataSelect> dataselect;
 	ElementInstancerGeneric<ElementFormControlSelect> select;
 	ElementInstancerGeneric<ElementLabel> element_label;
 
@@ -152,11 +145,6 @@ struct DefaultInstancers {
 
 	ElementInstancerGeneric<ElementProgress> progress;
 
-	ElementInstancerGeneric<ElementDataGrid> datagrid;
-	ElementInstancerGeneric<ElementDataGridExpandButton> datagrid_expand;
-	ElementInstancerGeneric<ElementDataGridCell> datagrid_cell;
-	ElementInstancerGeneric<ElementDataGridRow> datagrid_row;
-
 	// Decorators
 	DecoratorTiledHorizontalInstancer decorator_tiled_horizontal;
 	DecoratorTiledVerticalInstancer decorator_tiled_vertical;
@@ -235,7 +223,6 @@ bool Factory::Initialise()
 	// Control element instancers
 	RegisterElementInstancer("form", &default_instancers->form);
 	RegisterElementInstancer("input", &default_instancers->input);
-	RegisterElementInstancer("dataselect", &default_instancers->dataselect);
 	RegisterElementInstancer("select", &default_instancers->select);
 	RegisterElementInstancer("label", &default_instancers->element_label);
 
@@ -246,11 +233,6 @@ bool Factory::Initialise()
 	RegisterElementInstancer("progress", &default_instancers->progress);
 	RegisterElementInstancer("progressbar", &default_instancers->progress);
 
-	RegisterElementInstancer("datagrid", &default_instancers->datagrid);
-	RegisterElementInstancer("datagridexpand", &default_instancers->datagrid_expand);
-	RegisterElementInstancer("#rmlctl_datagridcell", &default_instancers->datagrid_cell);
-	RegisterElementInstancer("#rmlctl_datagridrow", &default_instancers->datagrid_row);
-
 	// Decorator instancers
 	RegisterDecoratorInstancer("tiled-horizontal", &default_instancers->decorator_tiled_horizontal);
 	RegisterDecoratorInstancer("tiled-vertical", &default_instancers->decorator_tiled_vertical);
@@ -291,7 +273,6 @@ bool Factory::Initialise()
 	XMLParser::RegisterNodeHandler("template", MakeShared<XMLNodeHandlerTemplate>());
 
 	// XML node handlers for control elements
-	XMLParser::RegisterNodeHandler("datagrid", MakeShared<XMLNodeHandlerDataGrid>());
 	XMLParser::RegisterNodeHandler("tabset", MakeShared<XMLNodeHandlerTabSet>());
 	XMLParser::RegisterNodeHandler("textarea", MakeShared<XMLNodeHandlerTextArea>());
 	XMLParser::RegisterNodeHandler("select", MakeShared<XMLNodeHandlerSelect>());

+ 0 - 112
Source/Lua/Elements/DataFormatter.cpp

@@ -1,112 +0,0 @@
-/*
- * 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.
- *
- */
- 
-#include "DataFormatter.h"
-#include <RmlUi/Core/Log.h>
-
-
-namespace Rml {
-namespace Lua {
-//method
-int DataFormatternew(lua_State* L)
-{
-    DataFormatter* df = nullptr;
-    int ref = LUA_NOREF;
-    int top = lua_gettop(L);
-    if(top == 0)
-        df = new DataFormatter();
-    else if (top > 0) //at least one element means at least a name
-    {
-        if(top > 1) //if a function as well
-        {
-            if(lua_type(L,2) != LUA_TFUNCTION)
-            {
-                Log::Message(Log::LT_ERROR, "Lua: In DataFormatter.new, the second argument MUST be a function (or not exist). You passed in a %s.", lua_typename(L,lua_type(L,2)));
-            }
-            else //if it is a function
-            {
-                LuaDataFormatter::PushDataFormatterFunctionTable(L);
-                lua_pushvalue(L,2); //re-push the function so it is on the top of the stack
-                ref = luaL_ref(L,-2);
-                lua_pop(L,1); //pop the function table
-            }
-        }
-        df = new DataFormatter(luaL_checkstring(L,1));
-        df->ref_FormatData = ref; //will either be valid or LUA_NOREF
-    }
-    LuaType<DataFormatter>::push(L,df,true);
-    return 1;
-}
-
-//setter
-int DataFormatterSetAttrFormatData(lua_State* L)
-{
-    DataFormatter* obj = LuaType<DataFormatter>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-    int ref = LUA_NOREF;
-    if(lua_type(L,2) != LUA_TFUNCTION)
-    {
-        Log::Message(Log::LT_ERROR, "Lua: Setting DataFormatter.FormatData, the value must be a function. You passed in a %s.", lua_typename(L,lua_type(L,2)));
-    }
-    else //if it is a function
-    {
-        LuaDataFormatter::PushDataFormatterFunctionTable(L);
-        lua_pushvalue(L,2); //re-push the function so it is on the top of the stack
-        ref = luaL_ref(L,-2);
-        lua_pop(L,1); //pop the function table
-    }
-    obj->ref_FormatData = ref;
-    return 0;
-}
-
-RegType<DataFormatter> DataFormatterMethods[] =
-{
-    { nullptr, nullptr },
-};
-
-luaL_Reg DataFormatterGetters[] =
-{
-    { nullptr, nullptr },
-};
-
-luaL_Reg DataFormatterSetters[] =
-{
-    RMLUI_LUASETTER(DataFormatter,FormatData)
-    { nullptr, nullptr },
-};
-
-
-template<> void ExtraInit<DataFormatter>(lua_State* L, int metatable_index)
-{
-    lua_pushcfunction(L,DataFormatternew);
-    lua_setfield(L,metatable_index-1,"new");
-    return;
-}
-RMLUI_LUATYPE_DEFINE(DataFormatter)
-} // namespace Lua
-} // namespace Rml

+ 0 - 56
Source/Lua/Elements/DataFormatter.h

@@ -1,56 +0,0 @@
-/*
- * 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_LUA_ELEMENTS_DATAFORMATTER_H
-#define RMLUI_LUA_ELEMENTS_DATAFORMATTER_H
-
-
-#include <RmlUi/Lua/IncludeLua.h>
-#include <RmlUi/Lua/LuaType.h>
-#include "LuaDataFormatter.h"
-
-namespace Rml {
-namespace Lua {
-typedef LuaDataFormatter DataFormatter;
-//method
-int DataFormatternew(lua_State* L);
-
-//setter
-int DataFormatterSetAttrFormatData(lua_State* L);
-
-extern RegType<DataFormatter> DataFormatterMethods[];
-extern luaL_Reg DataFormatterGetters[];
-extern luaL_Reg DataFormatterSetters[];
-
-
-template<> void ExtraInit<DataFormatter>(lua_State* L, int metatable_index);
-RMLUI_LUATYPE_DECLARE(DataFormatter)
-} // namespace Lua
-} // namespace Rml
-
-#endif

+ 0 - 139
Source/Lua/Elements/DataSource.cpp

@@ -1,139 +0,0 @@
-/*
- * 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.
- *
- */
- 
-#include "DataSource.h"
-#include <RmlUi/Core/Log.h>
-
-namespace Rml {
-namespace Lua {
-typedef LuaDataSource DataSource;
-
-int DataSourcenew(lua_State* L)
-{
-    const char* name = luaL_checkstring(L,1);
-    LuaDataSource* ds = new LuaDataSource(name);
-    LuaType<DataSource>::push(L,ds,true);
-    return 1;
-}
-
-int DataSourceNotifyRowAdd(lua_State* L, DataSource* obj)
-{
-    RMLUI_CHECK_OBJ(obj);
-    const char* table_name = luaL_checkstring(L,1);
-    int first_row_added = (int)luaL_checkinteger(L,2);
-    int num_rows_added = (int)luaL_checkinteger(L,3);
-    obj->NotifyRowAdd(table_name,first_row_added,num_rows_added);
-    return 0;
-}
-
-int DataSourceNotifyRowRemove(lua_State* L, DataSource* obj)
-{
-    RMLUI_CHECK_OBJ(obj);
-    const char* table_name = luaL_checkstring(L,1);
-    int first_row_removed = (int)luaL_checkinteger(L,2);
-    int num_rows_removed = (int)luaL_checkinteger(L,3);
-    obj->NotifyRowRemove(table_name,first_row_removed,num_rows_removed);
-    return 0;
-}
-
-int DataSourceNotifyRowChange(lua_State* L, DataSource* obj)
-{
-    RMLUI_CHECK_OBJ(obj);
-    const char* table_name = luaL_checkstring(L,1);
-    if(lua_gettop(L) < 2)
-    {
-        obj->NotifyRowChange(table_name);
-    }
-    else
-    {
-        int first_row_changed = (int)luaL_checkinteger(L,2);
-        int num_rows_changed = (int)luaL_checkinteger(L,3);
-        obj->NotifyRowChange(table_name,first_row_changed,num_rows_changed);
-    }
-    return 0;
-}
-
-int DataSourceSetAttrGetNumRows(lua_State* L)
-{
-    DataSource* obj = LuaType<DataSource>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-    if(lua_type(L,2) == LUA_TFUNCTION)
-    {
-        lua_pushvalue(L,2); //copy of the function, so it is for sure at the top of the stack
-        obj->getNumRowsRef = luaL_ref(L, LUA_REGISTRYINDEX);
-    }
-    else
-        Log::Message(Log::LT_WARNING, "Lua: Must assign DataSource.GetNumRows as a function, value received was of %s type", lua_typename(L,2));
-    return 0;
-}
-
-int DataSourceSetAttrGetRow(lua_State* L)
-{
-    DataSource* obj = LuaType<DataSource>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-    if(lua_type(L,2) == LUA_TFUNCTION)
-    {
-        lua_pushvalue(L,2); //copy of the functions, so it is for sure at the top of the stack
-        obj->getRowRef = luaL_ref(L, LUA_REGISTRYINDEX);
-    }
-    else
-        Log::Message(Log::LT_WARNING, "Lua: Must assign DataSource.GetRow as a function, value received was of %s type", lua_typename(L,2));
-    return 0;
-}
-
-
-RegType<DataSource> DataSourceMethods[] =
-{
-    RMLUI_LUAMETHOD(DataSource,NotifyRowAdd)
-    RMLUI_LUAMETHOD(DataSource,NotifyRowRemove)
-    RMLUI_LUAMETHOD(DataSource,NotifyRowChange)
-    { nullptr, nullptr },
-};
-
-luaL_Reg DataSourceGetters[] =
-{
-    { nullptr, nullptr },
-};
-
-luaL_Reg DataSourceSetters[] =
-{
-    RMLUI_LUASETTER(DataSource,GetNumRows)
-    RMLUI_LUASETTER(DataSource,GetRow)
-    { nullptr, nullptr },
-};
-
-
-template<> void ExtraInit<LuaDataSource>(lua_State* L, int metatable_index) 
-{ 
-    lua_pushcfunction(L,DataSourcenew);
-    lua_setfield(L,metatable_index-1,"new");
-    return;
-}
-RMLUI_LUATYPE_DEFINE(DataSource)
-} // namespace Lua
-} // namespace Rml

+ 0 - 59
Source/Lua/Elements/DataSource.h

@@ -1,59 +0,0 @@
-/*
- * 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_LUA_ELEMENTS_DATASOURCE_H
-#define RMLUI_LUA_ELEMENTS_DATASOURCE_H
-
-#include <RmlUi/Lua/LuaType.h>
-#include <RmlUi/Lua/IncludeLua.h>
-#include "LuaDataSource.h"
-
-namespace Rml {
-namespace Lua {
-typedef LuaDataSource DataSource;
-
-int DataSourcenew(lua_State* L);
-
-int DataSourceNotifyRowAdd(lua_State* L, DataSource* obj);
-int DataSourceNotifyRowRemove(lua_State* L, DataSource* obj);
-int DataSourceNotifyRowChange(lua_State* L, DataSource* obj);
-
-int DataSourceSetAttrGetNumRows(lua_State* L);
-int DataSourceSetAttrGetRow(lua_State* L);
-
-extern RegType<DataSource> DataSourceMethods[];
-extern luaL_Reg DataSourceGetters[];
-extern luaL_Reg DataSourceSetters[];
-
-
-template<> void ExtraInit<LuaDataSource>(lua_State* L, int metatable_index);
-RMLUI_LUATYPE_DECLARE(DataSource)
-} // namespace Lua
-} // namespace Rml
-
-#endif

+ 0 - 109
Source/Lua/Elements/ElementDataGrid.cpp

@@ -1,109 +0,0 @@
-/*
- * 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.
- *
- */
- 
-#include "ElementDataGrid.h"
-#include <RmlUi/Core/Element.h>
-#include <RmlUi/Core/Elements/ElementDataGridRow.h>
-#include <RmlUi/Lua/Utilities.h>
-
-
-namespace Rml {
-namespace Lua {
-
-
-//methods
-int ElementDataGridAddColumn(lua_State* L, ElementDataGrid* obj)
-{
-    RMLUI_CHECK_OBJ(obj);
-    const char* fields = luaL_checkstring(L,1);
-    const char* formatter = luaL_checkstring(L,2);
-    float width = (float)luaL_checknumber(L,3);
-    const char* rml = luaL_checkstring(L,4);
-
-    obj->AddColumn(fields,formatter,width,rml);
-    return 0;
-}
-
-int ElementDataGridSetDataSource(lua_State* L, ElementDataGrid* obj)
-{
-    RMLUI_CHECK_OBJ(obj);
-    const char* source = luaL_checkstring(L,1);
-    
-    obj->SetDataSource(source);
-    return 0;
-}
-
-
-//getter
-int ElementDataGridGetAttrrows(lua_State* L)
-{
-    ElementDataGrid* obj = LuaType<ElementDataGrid>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-
-    lua_newtable(L);
-    int tbl = lua_gettop(L);
-    int numrows = obj->GetNumRows();
-    ElementDataGridRow* row;
-    for(int i = 0; i < numrows; i++)
-    {
-        row = obj->GetRow(i);
-        LuaType<ElementDataGridRow>::push(L,row,false);
-        lua_rawseti(L,tbl,i);
-    }
-    return 1;
-}
-
-
-RegType<ElementDataGrid> ElementDataGridMethods[] =
-{
-    RMLUI_LUAMETHOD(ElementDataGrid,AddColumn)
-    RMLUI_LUAMETHOD(ElementDataGrid,SetDataSource)
-    { nullptr, nullptr },
-};
-
-luaL_Reg ElementDataGridGetters[] =
-{
-    RMLUI_LUAGETTER(ElementDataGrid,rows)
-    { nullptr, nullptr },
-};
-
-luaL_Reg ElementDataGridSetters[] =
-{
-    { nullptr, nullptr },
-};
-
-
-template<> void ExtraInit<ElementDataGrid>(lua_State* L, int metatable_index)
-{
-    ExtraInit<Element>(L,metatable_index);
-    LuaType<Element>::_regfunctions(L,metatable_index,metatable_index-1);
-    AddTypeToElementAsTable<ElementDataGrid>(L);
-}
-RMLUI_LUATYPE_DEFINE(ElementDataGrid)
-} // namespace Lua
-} // namespace Rml

+ 0 - 59
Source/Lua/Elements/ElementDataGrid.h

@@ -1,59 +0,0 @@
-/*
- * 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_LUA_ELEMENTS_ELEMENTDATAGRID_H
-#define RMLUI_LUA_ELEMENTS_ELEMENTDATAGRID_H
-
-
-#include <RmlUi/Lua/LuaType.h>
-#include <RmlUi/Lua/IncludeLua.h>
-#include <RmlUi/Core/Elements/ElementDataGrid.h>
-
-namespace Rml {
-namespace Lua {
-
-//methods
-int ElementDataGridAddColumn(lua_State* L, ElementDataGrid* obj);
-int ElementDataGridSetDataSource(lua_State* L, ElementDataGrid* obj);
-
-//getter
-int ElementDataGridGetAttrrows(lua_State* L);
-
-
-extern RegType<ElementDataGrid> ElementDataGridMethods[];
-extern luaL_Reg ElementDataGridGetters[];
-extern luaL_Reg ElementDataGridSetters[];
-
-
-//this will be used to "inherit" from Element
-template<> void ExtraInit<ElementDataGrid>(lua_State* L, int metatable_index);
-RMLUI_LUATYPE_DECLARE(ElementDataGrid)
-} // namespace Lua
-} // namespace Rml
-
-#endif

+ 0 - 124
Source/Lua/Elements/ElementDataGridRow.cpp

@@ -1,124 +0,0 @@
-/*
- * 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.
- *
- */
- 
-#include "ElementDataGridRow.h"
-#include <RmlUi/Core/Elements/ElementDataGrid.h>
-#include <RmlUi/Lua/Utilities.h>
-
-
-namespace Rml {
-namespace Lua {
-
-
-//getters
-int ElementDataGridRowGetAttrrow_expanded(lua_State* L)
-{
-    ElementDataGridRow* obj = LuaType<ElementDataGridRow>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-    lua_pushboolean(L,obj->IsRowExpanded());
-    return 1;
-}
-
-int ElementDataGridRowGetAttrparent_relative_index(lua_State* L)
-{
-    ElementDataGridRow* obj = LuaType<ElementDataGridRow>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-    lua_pushinteger(L,obj->GetParentRelativeIndex());
-    return 1;
-}
-
-int ElementDataGridRowGetAttrtable_relative_index(lua_State* L)
-{
-    ElementDataGridRow* obj = LuaType<ElementDataGridRow>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-    lua_pushinteger(L,obj->GetTableRelativeIndex());
-    return 1;
-}
-
-int ElementDataGridRowGetAttrparent_row(lua_State* L)
-{
-    ElementDataGridRow* obj = LuaType<ElementDataGridRow>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-    LuaType<ElementDataGridRow>::push(L,obj->GetParentRow(),false);
-    return 1;
-}
-
-int ElementDataGridRowGetAttrparent_grid(lua_State* L)
-{
-    ElementDataGridRow* obj = LuaType<ElementDataGridRow>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-    LuaType<ElementDataGrid>::push(L,obj->GetParentGrid(),false);
-    return 1;
-}
-
-
-//setter
-int ElementDataGridRowSetAttrrow_expanded(lua_State* L)
-{
-    ElementDataGridRow* obj = LuaType<ElementDataGridRow>::check(L,1);
-    RMLUI_CHECK_OBJ(obj);
-    bool expanded = RMLUI_CHECK_BOOL(L,2);
-    if(expanded)
-        obj->ExpandRow();
-    else
-        obj->CollapseRow();
-    return 0;
-}
-
-
-RegType<ElementDataGridRow> ElementDataGridRowMethods[] =
-{
-    { nullptr, nullptr },
-};
-
-luaL_Reg ElementDataGridRowGetters[] =
-{
-    RMLUI_LUAGETTER(ElementDataGridRow,row_expanded)
-    RMLUI_LUAGETTER(ElementDataGridRow,parent_relative_index)
-    RMLUI_LUAGETTER(ElementDataGridRow,table_relative_index)
-    RMLUI_LUAGETTER(ElementDataGridRow,parent_row)
-    RMLUI_LUAGETTER(ElementDataGridRow,parent_grid)
-    { nullptr, nullptr },
-};
-
-luaL_Reg ElementDataGridRowSetters[] =
-{
-    RMLUI_LUASETTER(ElementDataGridRow,row_expanded)
-    { nullptr, nullptr },
-};
-
-
-template<> void ExtraInit<ElementDataGridRow>(lua_State* L, int metatable_index)
-{
-    ExtraInit<Element>(L,metatable_index);
-    LuaType<Element>::_regfunctions(L,metatable_index,metatable_index-1);
-    AddTypeToElementAsTable<ElementDataGridRow>(L);
-}
-RMLUI_LUATYPE_DEFINE(ElementDataGridRow)
-} // namespace Lua
-} // namespace Rml

+ 0 - 62
Source/Lua/Elements/ElementDataGridRow.h

@@ -1,62 +0,0 @@
-/*
- * 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_LUA_ELEMENTS_ELEMENTDATAGRIDROW_H
-#define RMLUI_LUA_ELEMENTS_ELEMENTDATAGRIDROW_H
-
-
-#include <RmlUi/Lua/LuaType.h>
-#include <RmlUi/Lua/IncludeLua.h>
-#include <RmlUi/Core/Elements/ElementDataGridRow.h>
-
-namespace Rml {
-namespace Lua {
-
-//getters
-int ElementDataGridRowGetAttrrow_expanded(lua_State* L);
-int ElementDataGridRowGetAttrparent_relative_index(lua_State* L);
-int ElementDataGridRowGetAttrtable_relative_index(lua_State* L);
-int ElementDataGridRowGetAttrparent_row(lua_State* L);
-int ElementDataGridRowGetAttrparent_grid(lua_State* L);
-
-//setter
-int ElementDataGridRowSetAttrrow_expanded(lua_State* L);
-
-
-extern RegType<ElementDataGridRow> ElementDataGridRowMethods[];
-extern luaL_Reg ElementDataGridRowGetters[];
-extern luaL_Reg ElementDataGridRowSetters[];
-
-
-//this will be used to "inherit" from Element
-template<> void ExtraInit<ElementDataGridRow>(lua_State* L, int metatable_index);
-RMLUI_LUATYPE_DECLARE(ElementDataGridRow)
-} // namespace Lua
-} // namespace Rml
-
-#endif

+ 0 - 74
Source/Lua/Elements/ElementFormControlDataSelect.cpp

@@ -1,74 +0,0 @@
-/*
- * 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.
- *
- */
- 
-#include "ElementFormControlDataSelect.h"
-#include <RmlUi/Core/Elements/ElementFormControlSelect.h>
-#include "ElementFormControlSelect.h"
-#include <RmlUi/Lua/Utilities.h>
-
-namespace Rml {
-namespace Lua {
-
-//method
-int ElementFormControlDataSelectSetDataSource(lua_State* L, ElementFormControlDataSelect* obj)
-{
-    const char* source = luaL_checkstring(L,1);
-    obj->SetDataSource(source);
-    return 0;
-}
-
-RegType<ElementFormControlDataSelect> ElementFormControlDataSelectMethods[] =
-{
-    RMLUI_LUAMETHOD(ElementFormControlDataSelect,SetDataSource)
-    { nullptr, nullptr },
-};
-
-luaL_Reg ElementFormControlDataSelectGetters[] =
-{
-    { nullptr, nullptr },
-};
-
-luaL_Reg ElementFormControlDataSelectSetters[] =
-{
-    { nullptr, nullptr },
-};
-
-
-//inherits from ElementFormControl which inherits from Element
-template<> void ExtraInit<ElementFormControlDataSelect>(lua_State* L, int metatable_index)
-{
-    //do whatever ElementFormControlSelect did as far as inheritance
-    ExtraInit<ElementFormControlSelect>(L,metatable_index);
-    //then inherit from ElementFromControlSelect
-    LuaType<ElementFormControlSelect>::_regfunctions(L,metatable_index,metatable_index-1);
-    AddTypeToElementAsTable<ElementFormControlDataSelect>(L);
-}
-
-RMLUI_LUATYPE_DEFINE(ElementFormControlDataSelect)
-} // namespace Lua
-} // namespace Rml

+ 0 - 53
Source/Lua/Elements/ElementFormControlDataSelect.h

@@ -1,53 +0,0 @@
-/*
- * 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_LUA_ELEMENTS_ELEMENTFORMCONTROLDATASELECT_H
-#define RMLUI_LUA_ELEMENTS_ELEMENTFORMCONTROLDATASELECT_H
-
-#include <RmlUi/Lua/IncludeLua.h>
-#include <RmlUi/Lua/LuaType.h>
-#include <RmlUi/Core/Elements/ElementFormControlDataSelect.h>
-
-namespace Rml {
-namespace Lua {
-
-//method
-int ElementFormControlDataSelectSetDataSource(lua_State* L, ElementFormControlDataSelect* obj);
-
-extern RegType<ElementFormControlDataSelect> ElementFormControlDataSelectMethods[];
-extern luaL_Reg ElementFormControlDataSelectGetters[];
-extern luaL_Reg ElementFormControlDataSelectSetters[];
-
-
-//inherits from ElementFormControl which inherits from Element
-template<> void ExtraInit<ElementFormControlDataSelect>(lua_State* L, int metatable_index);
-RMLUI_LUATYPE_DECLARE(ElementFormControlDataSelect)
-} // namespace Lua
-} // namespace Rml
-
-#endif

+ 0 - 93
Source/Lua/Elements/LuaDataFormatter.cpp

@@ -1,93 +0,0 @@
-/*
- * 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.
- *
- */
- 
-#include "LuaDataFormatter.h"
-#include <RmlUi/Lua/Interpreter.h>
-#include <RmlUi/Core/Log.h>
-
-namespace Rml {
-namespace Lua {
-
-
-LuaDataFormatter::LuaDataFormatter(const String& name) : DataFormatter(name), ref_FormatData(LUA_NOREF)
-{}
-
-LuaDataFormatter::~LuaDataFormatter()
-{}
-
-void LuaDataFormatter::FormatData(String& formatted_data, const StringList& raw_data)
-{
-    if(ref_FormatData == LUA_NOREF || ref_FormatData == LUA_REFNIL)
-    {
-        Log::Message(Log::LT_ERROR, "In LuaDataFormatter: There is no value assigned to the \"FormatData\" variable.");
-        return;
-    }
-    lua_State* L = Interpreter::GetLuaState();
-    int top = lua_gettop(L);
-    PushDataFormatterFunctionTable(L); // push the table where the function resides
-    lua_rawgeti(L,-1,ref_FormatData); //push the function
-    if(lua_type(L,-1) != LUA_TFUNCTION)
-    {
-        Log::Message(Log::LT_ERROR, "In LuaDataFormatter: The value for the FormatData variable must be a function. You passed in a %s.", lua_typename(L,lua_type(L,-1)));
-        lua_settop(L,top);
-        return;
-    }
-    lua_newtable(L); //to hold raw_data
-    int tbl = lua_gettop(L);
-    for(unsigned int i = 0; i < raw_data.size(); i++)
-    {
-        lua_pushstring(L,raw_data[i].c_str());
-        lua_rawseti(L,tbl,i);
-    }
-    Interpreter::ExecuteCall(1,1); //1 parameter (the table), 1 result (a string)
-
-    //top of the stack should be the return value
-    if(lua_type(L,-1) != LUA_TSTRING)
-    {
-        Log::Message(Log::LT_ERROR, "In LuaDataFormatter: the return value of FormatData must be a string. You returned a %s.", lua_typename(L,lua_type(L,-1)));
-        lua_settop(L,top);
-        return;
-    }
-    formatted_data = String(lua_tostring(L,-1));
-    lua_settop(L,top);
-}
-
-void LuaDataFormatter::PushDataFormatterFunctionTable(lua_State* L)
-{
-    lua_getglobal(L,"LUADATAFORMATTERFUNCTIONS");
-    if(lua_isnoneornil(L,-1))
-    {
-        lua_newtable(L);
-        lua_setglobal(L,"LUADATAFORMATTERFUNCTIONS");
-        lua_pop(L,1); //pop the unsucessful getglobal
-        lua_getglobal(L,"LUADATAFORMATTERFUNCTIONS");
-    }
-}
-
-} // namespace Lua
-} // namespace Rml

+ 0 - 54
Source/Lua/Elements/LuaDataFormatter.h

@@ -1,54 +0,0 @@
-/*
- * 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_LUA_ELEMENTS_LUADATAFORMATTER_H
-#define RMLUI_LUA_ELEMENTS_LUADATAFORMATTER_H
-
-#include <RmlUi/Lua/IncludeLua.h>
-#include <RmlUi/Core/Elements/DataFormatter.h>
-
-namespace Rml {
-namespace Lua {
-
-class LuaDataFormatter : public ::Rml::DataFormatter
-{
-public:
-    LuaDataFormatter(const String& name = "");
-    ~LuaDataFormatter();
-
-    void FormatData(String& formatted_data, const StringList& raw_data) override;
-
-    //Helper function used to push on to the stack the table where the function ref should be stored
-    static void PushDataFormatterFunctionTable(lua_State* L);
-
-    int ref_FormatData; //the lua reference to the FormatData function
-};
-
-} // namespace Lua
-} // namespace Rml
-#endif

+ 0 - 103
Source/Lua/Elements/LuaDataSource.cpp

@@ -1,103 +0,0 @@
-/*
- * 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.
- *
- */
- 
-#include "LuaDataSource.h"
-#include <RmlUi/Lua/Interpreter.h>
-#include <RmlUi/Core/Log.h>
-
-namespace Rml {
-namespace Lua {
-
-LuaDataSource::LuaDataSource(const String& name) : DataSource(name), getRowRef(LUA_NOREF), getNumRowsRef(LUA_NOREF)
-{}
-
-/// Fetches the contents of one row of a table within the data source.
-/// @param[out] row The list of values in the table.
-/// @param[in] table The name of the table to query.
-/// @param[in] row_index The index of the desired row.
-/// @param[in] columns The list of desired columns within the row.
-void LuaDataSource::GetRow(StringList& row, const String& table, int row_index, const StringList& columns)
-{
-    if(getRowRef == LUA_NOREF || getRowRef == LUA_REFNIL) return;
-
-    //setup the call
-    Interpreter::BeginCall(getRowRef);
-    lua_State* L = Interpreter::GetLuaState();
-    lua_pushstring(L,table.c_str());
-    lua_pushinteger(L,row_index);
-    lua_newtable(L);
-    int index = 0;
-    for(StringList::const_iterator itr = columns.begin(); itr != columns.end(); ++itr)
-    {
-        lua_pushstring(L,itr->c_str());
-        lua_rawseti(L,-2,index++);
-    }
-    Interpreter::ExecuteCall(3,1); //3 parameters, 1 return. After here, the top of the stack contains the return value
-
-    if(lua_type(L,-1) == LUA_TTABLE)
-    {
-        lua_pushnil(L);
-        while (lua_next(L, -2))
-        {
-            //key at -2, value at -1
-            row.push_back(luaL_checkstring(L,-1));
-            lua_pop(L,1); //pops value, leaves key for next iteration
-        }
-    }
-    else
-        Log::Message(Log::LT_WARNING, "Lua: DataSource.GetRow must return a table, the function it called returned a %s", lua_typename(L,-1));
-    lua_pop(L,1);
-}
-
-/// Fetches the number of rows within one of this data source's tables.
-/// @param[in] table The name of the table to query.
-/// @return The number of rows within the specified table. Returns -1 in case of an incorrect Lua function.
-int LuaDataSource::GetNumRows(const String& table)
-{
-    if(getNumRowsRef == LUA_NOREF || getNumRowsRef == LUA_REFNIL) return -1;
-
-    lua_State* L = Interpreter::GetLuaState();
-    Interpreter::BeginCall(getNumRowsRef);
-    lua_pushstring(L,table.c_str());
-    Interpreter::ExecuteCall(1,1); //1 parameter, 1 return. After this, the top of the stack contains the return value
-
-    int res = -1;
-    if(lua_type(L, -1) == LUA_TNUMBER)
-    {
-        res = (int)luaL_checkinteger(L,res);
-    }
-    else
-    {
-        Log::Message(Log::LT_WARNING, "Lua: DataSource.GetNumRows must return an integer, the function it called returned a %s", lua_typename(L,-1));
-    }
-    lua_pop(L, 1);
-    return res;
-}
-
-} // namespace Lua
-} // namespace Rml

+ 0 - 69
Source/Lua/Elements/LuaDataSource.h

@@ -1,69 +0,0 @@
-/*
- * 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_LUA_ELEMENTS_LUADATASOURCE_H
-#define RMLUI_LUA_ELEMENTS_LUADATASOURCE_H
-
-#include <RmlUi/Lua/LuaType.h>
-#include <RmlUi/Lua/IncludeLua.h>
-#include <RmlUi/Core/Elements/DataSource.h>
-
-namespace Rml {
-namespace Lua {
-
-class LuaDataSource : public ::Rml::DataSource
-{
-public:
-    //default initilialize the lua func references to -1
-    LuaDataSource(const String& name = "");
-
-	/// Fetches the contents of one row of a table within the data source.
-	/// @param[out] row The list of values in the table.
-	/// @param[in] table The name of the table to query.
-	/// @param[in] row_index The index of the desired row.
-	/// @param[in] columns The list of desired columns within the row.
-	void GetRow(StringList& row, const String& table, int row_index, const StringList& columns) override;
-	/// Fetches the number of rows within one of this data source's tables.
-	/// @param[in] table The name of the table to query.
-	/// @return The number of rows within the specified table. Returns -1 in case of an incorrect Lua function.
-	int GetNumRows(const String& table) override;
-
-    //make the protected members of DataSource public
-	using DataSource::NotifyRowAdd;
-	using DataSource::NotifyRowRemove;
-	using DataSource::NotifyRowChange;
-
-    //lua reference to DataSource.GetRow
-    int getRowRef;
-    //lua reference to DataSource.GetNumRows
-    int getNumRowsRef;
-};
-
-} // namespace Lua
-} // namespace Rml
-#endif

+ 0 - 10
Source/Lua/LuaPlugin.cpp

@@ -57,16 +57,11 @@
 #include "RmlUiContextsProxy.h"
 // Control types
 #include "Elements/SelectOptionsProxy.h"
-#include "Elements/DataFormatter.h"
-#include "Elements/DataSource.h"
 #include "Elements/ElementForm.h"
 #include "Elements/ElementFormControl.h"
 #include "Elements/ElementFormControlSelect.h"
-#include "Elements/ElementFormControlDataSelect.h"
 #include "Elements/ElementFormControlInput.h"
 #include "Elements/ElementFormControlTextArea.h"
-#include "Elements/ElementDataGrid.h"
-#include "Elements/ElementDataGridRow.h"
 #include "Elements/ElementTabSet.h"
 
 namespace Rml {
@@ -164,13 +159,8 @@ static void RegisterTypes()
     LuaType<ElementFormControl>::Register(L);
     //Inherits from ElementFormControl
     LuaType<ElementFormControlSelect>::Register(L);
-    LuaType<ElementFormControlDataSelect>::Register(L);
     LuaType<ElementFormControlInput>::Register(L);
     LuaType<ElementFormControlTextArea>::Register(L);
-    LuaType<DataFormatter>::Register(L);
-    LuaType<DataSource>::Register(L);
-    LuaType<ElementDataGrid>::Register(L);
-    LuaType<ElementDataGridRow>::Register(L);
     LuaType<ElementTabSet>::Register(L);
     //proxy tables
     LuaType<SelectOptionsProxy>::Register(L);

+ 10 - 0
changelog.md

@@ -11,6 +11,16 @@
 * [RmlUi 3.0](#rmlui-30)
 * [RmlUi 2.0](#rmlui-20)
 
+
+## RmlUi 6.0 (WIP)
+
+### Breaking changes
+
+Removed deprecated functionality:
+
+- Removed the `<datagrid>` and `<dataselect>` elements, related utilities, and associated tutorials. Users are encouraged to replace this functionality by [tables](https://mikke89.github.io/RmlUiDoc/pages/rcss/tables.html), [select boxes](https://mikke89.github.io/RmlUiDoc/pages/rml/forms.html#select), and [data bindings](https://mikke89.github.io/RmlUiDoc/pages/data_bindings.html).
+
+
 ## RmlUi 5.1
 
 ### New scrolling features