mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user