feat: Add EventViewClosed event (#2377)

Where one door opens, another one closes (said someone) and in this
situation i mean view, because there's no event for closing a view only
opening one, so please add this :c

### Problem description
Simply adds an **EventViewClosed** to match the pre-existing
**EventViewOpened**. Also fixes the issue where EventViewOpened wouldn't
trigger for windows that were popups (even if they are technically a
View.

### Implementation description
I mirrored the current functionality of EventViewOpened for closing.

---------

Co-authored-by: paxcut <53811119+paxcut@users.noreply.github.com>
This commit is contained in:
aoqia194
2025-08-07 06:22:46 +10:00
committed by GitHub
parent 40b48f6460
commit cf87294a8c
5 changed files with 53 additions and 27 deletions

View File

@@ -56,13 +56,23 @@ namespace hex {
return std::exchange(m_windowJustOpened, false);
}
void View::setWindowJustOpened(bool state) {
void View::setWindowJustOpened(const bool state) {
m_windowJustOpened = state;
}
void View::trackViewOpenState() {
bool View::didWindowJustClose() {
return std::exchange(m_windowJustClosed, false);
}
void View::setWindowJustClosed(const bool state) {
m_windowJustClosed = state;
}
void View::trackViewState() {
if (m_windowOpen && !m_prevWindowOpen)
this->setWindowJustOpened(true);
else if (!m_windowOpen && m_prevWindowOpen)
this->setWindowJustClosed(true);
m_prevWindowOpen = m_windowOpen;
}