예제 #1
0
void wxSTEditorTreeCtrl::OnWindowDestroy( wxWindowDestroyEvent& event )
{
    event.Skip();

    // Clear the notebook since it's being deleted
    if (event.GetEventObject() == m_steNotebook)
    {
        SetSTENotebook(NULL);
        return;
    }

    wxLongToLongHashMap::iterator it;

    // Else this is a page in the notebook
    it = m_windowToSTETreeItemDataMap.find((long)event.GetEventObject());
    if (it != m_windowToSTETreeItemDataMap.end())
    {
        wxSTETreeItemData* oldData = (wxSTETreeItemData*)it->second;
        DeleteItem(oldData->m_id, true, -1, GetRootItem());
        m_windowToSTETreeItemDataMap.erase(it);
    }

    // Remove the wxEVT_DESTROY tracker for notebook pages
    it = m_windowDestroyMap.find((long)event.GetEventObject());
    if (it != m_windowDestroyMap.end())
    {
        m_windowDestroyMap.erase(it);
    }
}
예제 #2
0
void wxLuaWinDestroyCallback::OnAllDestroyEvents(wxWindowDestroyEvent& event)
{
    // Central handler for events, forward to the specific instance
    wxLuaWinDestroyCallback *theCallback = (wxLuaWinDestroyCallback *)event.m_callbackUserData;
    if (theCallback && (((wxWindow*)event.GetEventObject()) == theCallback->m_window))
    {
        theCallback->OnDestroy(event);
    }
    else
        event.Skip();
}
예제 #3
0
void Pcsx2App::OnDestroyWindow( wxWindowDestroyEvent& evt )
{
	// Precautions:
	//  * Whenever windows are destroyed, make sure to check if it matches our "active"
	//    console logger.  If so, we need to disable logging to the console window, or else
	//    it'll crash.  (this is because the console log system uses a cached window handle
	//    instead of looking the window up via it's ID -- fast but potentially unsafe).
	//
	//  * The virtual machine's plugins usually depend on the GS window handle being valid,
	//    so if the GS window is the one being shut down then we need to make sure to close
	//    out the Corethread before it vanishes completely from existence.
	

	OnProgramLogClosed( evt.GetId() );
	OnGsFrameClosed( evt.GetId() );
	evt.Skip();
}
예제 #4
0
void KIWAY::player_destroy_handler( wxWindowDestroyEvent& event )
{
    wxWindow* w = event.GetWindow();

    for( unsigned i=0; i < KIWAY_PLAYER_COUNT;  ++i )
    {
        // if destroying one of our flock, then mark it as deceased.
        if( (wxWindow*) m_player[i] == w )
        {
            DBG(printf( "%s: m_player[%u] destroyed: %s\n",
                __func__, i, TO_UTF8( m_player[i]->GetName() ) );)

            m_player[i] = 0;
        }
예제 #5
0
void dlgNewVSCPSession::OnDestroy(wxWindowDestroyEvent& event)
{
    event.Skip();
}
예제 #6
0
void KIWAY::player_destroy_handler( wxWindowDestroyEvent& event )
{
    // Currently : do nothing
    event.Skip();  // skip to who, the wxApp?  I'm the top window.
}
예제 #7
0
void wxLuaWinDestroyCallback::OnDestroy(wxWindowDestroyEvent& event)
{
    event.Skip();

    // FIXME - Is it an error to receive an event after you've deleted Lua?
    //  probably not if Lua is getting shutdown

    // Note: do not remove from wxLuaState's destroyHandlerList here, wait 'till destructor
    if (m_wxlState.Ok())
    {
        lua_State* L = m_wxlState.GetLuaState();

        // clear the metatable for all userdata we're tracking.
        wxluaO_untrackweakobject(L, NULL, m_window);
        wxlua_removederivedmethods(L, m_window);

        // Clear our own pointer to this window
        wxluaW_removetrackedwindow(L, m_window);

        wxEvtHandler* evtHandler = m_window->GetEventHandler();

        // Finally, clear out the wxLuaEventCallbacks for the very odd cases where
        // (activation) events can be sent during destruction. These can happen
        // if you pop up a modal dialog (asking if they want to save perhaps)
        // and when the dialog is closed the frame below sends an activation event,
        // but we're right in the middle of being destroyed and we crash.

        lua_pushlightuserdata(L, &wxlua_lreg_evtcallbacks_key); // push key
        lua_rawget(L, LUA_REGISTRYINDEX);                       // pop key, push value (table)

        lua_pushnil(L);
        while (lua_next(L, -2) != 0)
        {
            // value = -1, key = -2, table = -3
            wxLuaEventCallback* wxlCallback = (wxLuaEventCallback*)lua_touserdata(L, -2);
            wxCHECK_RET(wxlCallback, wxT("Invalid wxLuaEventCallback"));

            if ((wxlCallback->GetEvtHandler() == evtHandler) ||
                (wxlCallback->GetEvtHandler() == (wxEvtHandler*)m_window))
            {
                // remove the ref to the routine since we're clearing the wxLuaState
                // See ~wxLuaEventCallback
                wxluaR_unref(L, wxlCallback->GetLuaFuncRef(), &wxlua_lreg_refs_key);
                wxlCallback->ClearwxLuaState();

                lua_pop(L, 1);        // pop value

                // The code below is the equivalent of this, but works while iterating
                //   "m_wxlState.RemoveTrackedEventCallback(wxlCallback);"

                lua_pushvalue(L, -1); // copy key for next iteration
                lua_pushnil(L);
                lua_rawset(L, -4);    // set t[key] = nil to remove it
            }
            else
                lua_pop(L, 1);        // pop value, lua_next will pop key at end
        }

        lua_pop(L, 1); // pop table
    }
}