mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 13:37:42 -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:
@@ -9,13 +9,10 @@ namespace hex { class View; }
|
||||
|
||||
/* GUI events definitions */
|
||||
namespace hex {
|
||||
|
||||
/**
|
||||
* @brief Signals a newly opened window
|
||||
* @brief Signals a newly opened view
|
||||
*
|
||||
* This event is sent when the window has just been opened and docked by the Window manager.
|
||||
*
|
||||
* FIXME: In the event that a newly created window is already docked, this will not be sent.
|
||||
* This event is sent when the view has just been opened by the Window manager.
|
||||
*
|
||||
* FIXME: This is currently only used for the introduction tutorial.
|
||||
* If the event's only purpose is this, maybe rename it?
|
||||
@@ -24,6 +21,15 @@ namespace hex {
|
||||
*/
|
||||
EVENT_DEF(EventViewOpened, View*);
|
||||
|
||||
/**
|
||||
* @brief Signals a newly closed view
|
||||
*
|
||||
* This event is sent when the view has just been closed.
|
||||
*
|
||||
* @param view the closed view reference
|
||||
*/
|
||||
EVENT_DEF(EventViewClosed, View*);
|
||||
|
||||
/**
|
||||
* @brief Signals a change in the DPI scale.
|
||||
*
|
||||
|
||||
@@ -98,7 +98,10 @@ namespace hex {
|
||||
[[nodiscard]] bool didWindowJustOpen();
|
||||
void setWindowJustOpened(bool state);
|
||||
|
||||
void trackViewOpenState();
|
||||
[[nodiscard]] bool didWindowJustClose();
|
||||
void setWindowJustClosed(bool state);
|
||||
|
||||
void trackViewState();
|
||||
|
||||
static void discardNavigationRequests();
|
||||
|
||||
@@ -125,7 +128,7 @@ namespace hex {
|
||||
UnlocalizedString m_unlocalizedViewName;
|
||||
bool m_windowOpen = false, m_prevWindowOpen = false;
|
||||
std::map<Shortcut, ShortcutManager::ShortcutEntry> m_shortcuts;
|
||||
bool m_windowJustOpened = false;
|
||||
bool m_windowJustOpened = false, m_windowJustClosed = false;
|
||||
const char *m_icon;
|
||||
bool m_focused = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user