mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(ui): add LoadXML_Gradient
This commit is contained in:
parent
a6e93122a7
commit
066a53e667
@ -128,6 +128,28 @@ int32_t LoadXML_Dimensions(XMLNode* node, float& x, float& y, CStatus* status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t LoadXML_Gradient(XMLNode* node, ORIENTATION& orientation, CImVector& minColor, CImVector& maxColor, CStatus* status) {
|
||||||
|
orientation = ORIENTATION_HORIZONTAL;
|
||||||
|
|
||||||
|
// Orientation
|
||||||
|
auto orientationAttr = node->GetAttributeByName("orientation");
|
||||||
|
if (orientationAttr && *orientationAttr) {
|
||||||
|
if (!StringToOrientation(orientationAttr, orientation)) {
|
||||||
|
status->Add(STATUS_WARNING, "Unknown orientation %s in element %s", orientationAttr, node->GetName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto child = node->m_child; child; child = child->m_next) {
|
||||||
|
if (!SStrCmpI(child->GetName(), "MinColor")) {
|
||||||
|
LoadXML_Color(child, minColor);
|
||||||
|
} else if (!SStrCmpI(child->GetName(), "MaxColor")) {
|
||||||
|
LoadXML_Color(child, maxColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t LoadXML_Insets(XMLNode* node, float& left, float& right, float& top, float& bottom, CStatus* status) {
|
int32_t LoadXML_Insets(XMLNode* node, float& left, float& right, float& top, float& bottom, CStatus* status) {
|
||||||
left = 0.0f;
|
left = 0.0f;
|
||||||
right = 0.0f;
|
right = 0.0f;
|
||||||
|
|||||||
@ -1,19 +1,22 @@
|
|||||||
#ifndef UI_LOAD_XML_HPP
|
#ifndef UI_LOAD_XML_HPP
|
||||||
#define UI_LOAD_XML_HPP
|
#define UI_LOAD_XML_HPP
|
||||||
|
|
||||||
|
#include "ui/Types.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
class CImVector;
|
||||||
class CSimpleFontString;
|
class CSimpleFontString;
|
||||||
class CSimpleFrame;
|
class CSimpleFrame;
|
||||||
class CSimpleTexture;
|
class CSimpleTexture;
|
||||||
class CStatus;
|
class CStatus;
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
class CImVector;
|
|
||||||
|
|
||||||
int32_t LoadXML_Color(XMLNode* node, CImVector& color);
|
int32_t LoadXML_Color(XMLNode* node, CImVector& color);
|
||||||
|
|
||||||
int32_t LoadXML_Dimensions(XMLNode* node, float& x, float& y, CStatus* status);
|
int32_t LoadXML_Dimensions(XMLNode* node, float& x, float& y, CStatus* status);
|
||||||
|
|
||||||
|
int32_t LoadXML_Gradient(XMLNode* node, ORIENTATION& orientation, CImVector& minColor, CImVector& maxColor, CStatus* status);
|
||||||
|
|
||||||
int32_t LoadXML_Insets(XMLNode* node, float& left, float& right, float& top, float& bottom, CStatus* status);
|
int32_t LoadXML_Insets(XMLNode* node, float& left, float& right, float& top, float& bottom, CStatus* status);
|
||||||
|
|
||||||
CSimpleFontString* LoadXML_String(XMLNode* node, CSimpleFrame* frame, CStatus* status);
|
CSimpleFontString* LoadXML_String(XMLNode* node, CSimpleFrame* frame, CStatus* status);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user