Kirix Support Forums

Close Event handling

Please post any wxAUI patches or modifications you've created here. Thanks!

Close Event handling

Postby Joel on Fri Jan 13, 2006 8:21 pm

Code: Select all
------manager.h------
line 496, replace:
class WXDLLEXPORT wxFrameManagerEvent : public wxEvent
with:
class WXDLLEXPORT wxFrameManagerEvent : public wxNotifyEvent

line 497, replace:
    wxFrameManagerEvent(wxEventType type) : wxEvent(0, type)
with:
    wxFrameManagerEvent(wxEventType type) : wxNotifyEvent(type, 0)

line 503, replace:
    wxFrameManagerEvent(const wxFrameManagerEvent& c) : wxEvent(c)
with:
    wxFrameManagerEvent(const wxFrameManagerEvent& c) : wxNotifyEvent(c)

line 758, replace:
    DECLARE_EVENT_TYPE(wxEVT_AUI_PANEBUTTON, 0)   
with:
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_AUI_PANEBUTTON, 0)
    DECLARE_EXPORTED_EVENT_TYPE(WXDLLEXPORT, wxEVT_AUI_PANECLOSED, 0)

line 767, after
#define EVT_AUI_PANEBUTTON(func) \
   wx__DECLARE_EVT0(wxEVT_AUI_PANEBUTTON, wxFrameManagerEventHandler(func))
add:
#define EVT_AUI_PANECLOSED(func) \
   wx__DECLARE_EVT0(wxEVT_AUI_PANECLOSED, wxFrameManagerEventHandler(func))


-----manager.cpp-----

line 30, after:
DEFINE_EVENT_TYPE(wxEVT_AUI_PANEBUTTON)
add:
DEFINE_EVENT_TYPE(wxEVT_AUI_PANECLOSED)

line 536, remove:
        Destroy();

line 3301, after:
    wxASSERT_MSG(pane.IsOk(), wxT("Pane window not found"));
add:
   
    //Send an event
    wxFrameManagerEvent e(wxEVT_AUI_PANECLOSED);
    e.SetPane(&pane);
    e.SetButton(NULL);
    ProcessMgrEvent(e);
   
   if (e.IsAllowed())
   {
        // reparent the pane window back to us and
        // prepare the frame window for destruction
        pane.window->Show(false);
        pane.window->Reparent(m_frame);
        pane.frame = NULL;
        pane.Hide();
       
        //Then destroy the window
        wnd->Destroy();
    }
manager.h fixes some DLL import/export problems, and made wxFrameManagerEvent derive from wxNotifyEvent, which gives it Veto() ability; manager.cpp got a revamp and it now lets the parent frame know when a toolbar is dismissed, and because the event passed is of type wxFrameManagerEvent(wxNotifyEvent-derived), it can Veto() to prevent the floating pane from being Destroy()ed
Joel's Place
Project Administrator for the UPX GUI and developer for wxDev-C++

I want a legal copy of VS Professional! :P
Joel
Registered User
 
Posts: 37
Joined: Mon Jan 09, 2006 1:32 pm
Location: Singapore

Postby Ben on Sat Jan 14, 2006 11:45 am

Thanks. This looks good.
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Return to wxAUI Patches & Modifications