mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(ui): implement CSimpleFrame::SetFrameAlpha
This commit is contained in:
parent
53f7fa945a
commit
ad268d2327
@ -1331,7 +1331,12 @@ void CSimpleFrame::SetBeingScrolled(int32_t a2, int32_t a3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CSimpleFrame::SetFrameAlpha(uint8_t alpha) {
|
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) {
|
void CSimpleFrame::SetFrameFlag(int32_t flag, int32_t on) {
|
||||||
@ -1588,3 +1593,16 @@ void CSimpleFrame::UnregisterRegion(CSimpleRegion* region) {
|
|||||||
|
|
||||||
this->m_regions.UnlinkNode(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;
|
int32_t m_id = 0;
|
||||||
uint32_t m_flags = 0;
|
uint32_t m_flags = 0;
|
||||||
float m_frameScale = 1.0f;
|
float m_frameScale = 1.0f;
|
||||||
|
uint8_t m_alpha = 255;
|
||||||
|
uint8_t alphaBD = 255;
|
||||||
float m_depth = 0.0;
|
float m_depth = 0.0;
|
||||||
FRAME_STRATA m_strata = FRAME_STRATA_MEDIUM;
|
FRAME_STRATA m_strata = FRAME_STRATA_MEDIUM;
|
||||||
int32_t m_level = 0;
|
int32_t m_level = 0;
|
||||||
@ -112,6 +114,7 @@ class CSimpleFrame : public CScriptRegion {
|
|||||||
virtual int32_t HideThis();
|
virtual int32_t HideThis();
|
||||||
virtual int32_t ShowThis();
|
virtual int32_t ShowThis();
|
||||||
virtual bool UpdateScale(bool a2);
|
virtual bool UpdateScale(bool a2);
|
||||||
|
virtual void UpdateAlpha();
|
||||||
virtual void UpdateDepth(bool a2);
|
virtual void UpdateDepth(bool a2);
|
||||||
virtual void ParentFrame(CSimpleFrame* frame);
|
virtual void ParentFrame(CSimpleFrame* frame);
|
||||||
virtual void OnFrameSizeChanged(const CRect& rect);
|
virtual void OnFrameSizeChanged(const CRect& rect);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user