Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/libimhex/include/hex/ui/view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ namespace hex {
void trackViewState();
void setFocused(bool focused);

protected:
/**
* @brief Called when this view is opened (i.e. made visible).
*/
virtual void onOpen() {}

/**
* @brief Called when this view is closed (i.e. made invisible).
*/
virtual void onClose() {}

public:
class Window;
class Special;
Expand Down
6 changes: 5 additions & 1 deletion lib/libimhex/source/ui/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,13 @@ namespace hex {

void View::trackViewState() {
if (m_windowOpen && !m_prevWindowOpen)
{
this->setWindowJustOpened(true);
else if (!m_windowOpen && m_prevWindowOpen)
this->onOpen();
} else if (!m_windowOpen && m_prevWindowOpen) {
this->setWindowJustClosed(true);
this->onClose();
}
m_prevWindowOpen = m_windowOpen;
}

Expand Down
Loading