mirror of
https://github.com/whoahq/whoa.git
synced 2026-11-11 00:44:13 +03:00
feat(ui): set orientation in CSimpleSlider::LoadXML
This commit is contained in:
2 files changed
+28
No files matched your search
@@ -79,6 +79,23 @@ void CSimpleSlider::LoadXML(XMLNode* node, CStatus* status) {
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
auto orientationStr = node->GetAttributeByName("orientation");
|
||||
if (orientationStr && *orientationStr) {
|
||||
SLIDER_ORIENTATION orientation;
|
||||
|
||||
if (StringToOrientation(orientationStr, orientation)) {
|
||||
this->SetOrientation(orientation);
|
||||
} else {
|
||||
status->Add(
|
||||
STATUS_WARNING,
|
||||
"Frame %s: Unknown orientation %s in element %s",
|
||||
this->GetDisplayName(),
|
||||
orientationStr,
|
||||
node->GetName()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSimpleSlider::OnLayerUpdate(float elapsedSec) {
|
||||
@@ -151,6 +168,16 @@ void CSimpleSlider::SetMinMaxValues(float min, float max) {
|
||||
}
|
||||
}
|
||||
|
||||
void CSimpleSlider::SetOrientation(SLIDER_ORIENTATION orientation) {
|
||||
this->m_orientation = orientation;
|
||||
|
||||
if (this->m_thumbTexture) {
|
||||
this->m_thumbTexture->ClearAllPoints();
|
||||
}
|
||||
|
||||
this->m_changed = 1;
|
||||
}
|
||||
|
||||
void CSimpleSlider::SetThumbTexture(CSimpleTexture* texture, int32_t drawLayer) {
|
||||
if (this->m_thumbTexture == texture) {
|
||||
return;
|
||||
|
||||
@@ -48,6 +48,7 @@ class CSimpleSlider : public CSimpleFrame {
|
||||
void RunOnMinMaxChangedScript();
|
||||
void RunOnValueChangedScript();
|
||||
void SetMinMaxValues(float min, float max);
|
||||
void SetOrientation(SLIDER_ORIENTATION orientation);
|
||||
void SetThumbTexture(CSimpleTexture* texture, int32_t drawLayer);
|
||||
void SetValue(float value);
|
||||
float Sub96BC10(float value);
|
||||
|
||||
Reference in new issue
Block a user