diff --git a/src/ui/CSimpleFrame.cpp b/src/ui/CSimpleFrame.cpp index 63fa796..b02a14c 100644 --- a/src/ui/CSimpleFrame.cpp +++ b/src/ui/CSimpleFrame.cpp @@ -1331,7 +1331,12 @@ void CSimpleFrame::SetBeingScrolled(int32_t a2, int32_t a3) { } void CSimpleFrame::SetFrameAlpha(uint8_t alpha) { - // TODO + if (this->m_alpha == alpha) { + return; + } + + this->m_alpha = alpha; + this->UpdateAlpha(); } void CSimpleFrame::SetFrameFlag(int32_t flag, int32_t on) { @@ -1588,3 +1593,16 @@ void CSimpleFrame::UnregisterRegion(CSimpleRegion* region) { this->m_regions.UnlinkNode(region); } + +void CSimpleFrame::UpdateAlpha() { + for (auto region = this->m_regions.Head(); region; region = this->m_regions.Link(region)->Next()) { + region->OnColorChanged(false); + } + + auto effectiveAlpha = this->m_alpha * this->alphaBD / 255; + + for (auto child = this->m_children.Head(); child; child = this->m_children.Link(child)->Next()) { + child->frame->alphaBD = effectiveAlpha; + child->frame->UpdateAlpha(); + } +} diff --git a/src/ui/CSimpleFrame.hpp b/src/ui/CSimpleFrame.hpp index ce3e45f..4222ed1 100644 --- a/src/ui/CSimpleFrame.hpp +++ b/src/ui/CSimpleFrame.hpp @@ -35,6 +35,8 @@ class CSimpleFrame : public CScriptRegion { int32_t m_id = 0; uint32_t m_flags = 0; float m_frameScale = 1.0f; + uint8_t m_alpha = 255; + uint8_t alphaBD = 255; float m_depth = 0.0; FRAME_STRATA m_strata = FRAME_STRATA_MEDIUM; int32_t m_level = 0; @@ -112,6 +114,7 @@ class CSimpleFrame : public CScriptRegion { virtual int32_t HideThis(); virtual int32_t ShowThis(); virtual bool UpdateScale(bool a2); + virtual void UpdateAlpha(); virtual void UpdateDepth(bool a2); virtual void ParentFrame(CSimpleFrame* frame); virtual void OnFrameSizeChanged(const CRect& rect);