feat(ui): add StringToOrientation

This commit is contained in:
fallenoak 2025-11-29 22:51:16 -06:00
parent 92a85cc5ce
commit d576b8058d
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 23 additions and 0 deletions

View File

@ -86,3 +86,24 @@ int32_t StringToFrameStrata(const char* string, FRAME_STRATA& strata) {
return 0;
}
int32_t StringToOrientation(const char* string, SLIDER_ORIENTATION& orientation) {
struct OrientationEntry {
SLIDER_ORIENTATION value;
const char* string;
};
static OrientationEntry orientationMap[] = {
{ SLIDER_HORIZONTAL, "HORIZONTAL" },
{ SLIDER_VERTICAL, "VERTICAL" },
};
for (auto& entry : orientationMap) {
if (!SStrCmpI(entry.string, string)) {
orientation = entry.value;
return 1;
}
}
return 0;
}

View File

@ -13,4 +13,6 @@ int32_t StringToFramePoint(const char* string, FRAMEPOINT& point);
int32_t StringToFrameStrata(const char* string, FRAME_STRATA& strata);
int32_t StringToOrientation(const char* string, SLIDER_ORIENTATION& orientation);
#endif