Explorar el Código

Make progress bar a replaced element

Michael Ragazzon hace 4 años
padre
commit
2ce8e02e37

+ 3 - 0
Include/RmlUi/Core/Elements/ElementProgressBar.h

@@ -73,6 +73,9 @@ public:
 	/// Set the value of the progress bar
 	void SetValue(float value);
 
+	/// Returns the element's inherent size.
+	bool GetIntrinsicDimensions(Vector2f& dimensions, float& ratio) override;
+
 protected:
 	void OnRender() override;
 

+ 7 - 0
Source/Core/Elements/ElementProgressBar.cpp

@@ -63,6 +63,13 @@ void ElementProgressBar::SetValue(float in_value)
 	SetAttribute("value", in_value);
 }
 
+bool ElementProgressBar::GetIntrinsicDimensions(Vector2f& dimensions, float& /*ratio*/)
+{
+	dimensions.x = 256;
+	dimensions.y = 16;
+	return true;
+}
+
 void ElementProgressBar::OnRender()
 {
 	// Some properties may change geometry without dirtying the layout, eg. opacity.