Browse Source

Debugger: Display contents of text elements

Michael Ragazzon 6 years ago
parent
commit
fd7b83f50c
1 changed files with 8 additions and 0 deletions
  1. 8 0
      Source/Debugger/ElementInfo.cpp

+ 8 - 0
Source/Debugger/ElementInfo.cpp

@@ -29,6 +29,7 @@
 #include "ElementInfo.h"
 #include "../../Include/RmlUi/Core/Core.h"
 #include "../../Include/RmlUi/Core/ElementUtilities.h"
+#include "../../Include/RmlUi/Core/ElementText.h"
 #include "../../Include/RmlUi/Core/Factory.h"
 #include "../../Include/RmlUi/Core/Property.h"
 #include "../../Include/RmlUi/Core/PropertiesIteratorView.h"
@@ -502,6 +503,13 @@ void ElementInfo::UpdateSourceElement()
 				if(name != "class" && name != "style" && name != "id") 
 					attributes += Core::CreateString(name.size() + value.size() + 32, "%s: <em>%s</em><br />", name.c_str(), value.c_str());
 			}
+
+			// Text is not an attribute but useful nonetheless
+			if (auto text_element = rmlui_dynamic_cast<Core::ElementText*>(source_element))
+			{
+				const Core::String& text_content = text_element->GetText();
+				attributes += Core::CreateString(text_content.size() + 32, "Text: <em>%s</em><br />", text_content.c_str());
+			}
 		}
 
 		if (attributes.empty())