mirror of
https://github.com/whoahq/whoa.git
synced 2026-11-14 18:21:26 +03:00
feat(ui): implement CSimpleFrame::SetFrameAlpha
This commit is contained in:
2 files changed
+22
-1
No files matched your search
+19
-1
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user