mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
feat(ui): finish implementing CSimpleSlider::LoadXML
This commit is contained in:
parent
196f90e1d5
commit
49d9f8f3a0
@ -64,6 +64,8 @@ bool CSimpleSlider::IsA(int32_t type) {
|
|||||||
void CSimpleSlider::LoadXML(XMLNode* node, CStatus* status) {
|
void CSimpleSlider::LoadXML(XMLNode* node, CStatus* status) {
|
||||||
this->CSimpleFrame::LoadXML(node, status);
|
this->CSimpleFrame::LoadXML(node, status);
|
||||||
|
|
||||||
|
// Thumb
|
||||||
|
|
||||||
int32_t drawLayer = DRAWLAYER_ARTWORK_OVERLAY;
|
int32_t drawLayer = DRAWLAYER_ARTWORK_OVERLAY;
|
||||||
|
|
||||||
auto drawLayerStr = node->GetAttributeByName("drawLayer");
|
auto drawLayerStr = node->GetAttributeByName("drawLayer");
|
||||||
@ -78,7 +80,34 @@ void CSimpleSlider::LoadXML(XMLNode* node, CStatus* status) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// Value step
|
||||||
|
|
||||||
|
auto valueStepStr = node->GetAttributeByName("valueStep");
|
||||||
|
auto valueStep = valueStepStr && *valueStepStr ? SStrToFloat(valueStepStr) : 0.001f;
|
||||||
|
this->SetValueStep(valueStep);
|
||||||
|
|
||||||
|
// Min, max, and default values
|
||||||
|
|
||||||
|
auto minValueStr = node->GetAttributeByName("minValue");
|
||||||
|
if (minValueStr && *minValueStr) {
|
||||||
|
auto minValue = SStrToFloat(minValueStr);
|
||||||
|
|
||||||
|
auto maxValueStr = node->GetAttributeByName("maxValue");
|
||||||
|
if (maxValueStr && *maxValueStr) {
|
||||||
|
auto maxValue = SStrToFloat(maxValueStr);
|
||||||
|
|
||||||
|
this->SetMinMaxValues(minValue, maxValue);
|
||||||
|
|
||||||
|
auto defaultValueStr = node->GetAttributeByName("defaultValue");
|
||||||
|
if (defaultValueStr && *defaultValueStr) {
|
||||||
|
auto defaultValue = SStrToFloat(defaultValueStr);
|
||||||
|
|
||||||
|
this->SetValue(defaultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Orientation
|
||||||
|
|
||||||
auto orientationStr = node->GetAttributeByName("orientation");
|
auto orientationStr = node->GetAttributeByName("orientation");
|
||||||
if (orientationStr && *orientationStr) {
|
if (orientationStr && *orientationStr) {
|
||||||
@ -234,6 +263,20 @@ void CSimpleSlider::SetValue(float value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimpleSlider::SetValueStep(float valueStep) {
|
||||||
|
valueStep = std::min(valueStep, 0.00000011920929f);
|
||||||
|
|
||||||
|
if (CMath::fequal(this->m_valueStep, valueStep)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->m_valueStep = valueStep;
|
||||||
|
|
||||||
|
if (this->m_valueSet) {
|
||||||
|
this->SetValue(this->m_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float CSimpleSlider::Sub96BC10(float value) {
|
float CSimpleSlider::Sub96BC10(float value) {
|
||||||
// TODO
|
// TODO
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@ -51,6 +51,7 @@ class CSimpleSlider : public CSimpleFrame {
|
|||||||
void SetOrientation(SLIDER_ORIENTATION orientation);
|
void SetOrientation(SLIDER_ORIENTATION orientation);
|
||||||
void SetThumbTexture(CSimpleTexture* texture, int32_t drawLayer);
|
void SetThumbTexture(CSimpleTexture* texture, int32_t drawLayer);
|
||||||
void SetValue(float value);
|
void SetValue(float value);
|
||||||
|
void SetValueStep(float valueStep);
|
||||||
float Sub96BC10(float value);
|
float Sub96BC10(float value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user