bool wxAuiMDIParentFrame::ProcessEvent(wxEvent& event)
{
- // Stops the same event being processed repeatedly
- static wxEventType inEvent = wxEVT_NULL;
- if (inEvent == event.GetEventType())
+ // stops the same event being processed repeatedly
+ if (m_pLastEvt == &event)
return false;
-
- inEvent = event.GetEventType();
-
- // Let the active child (if any) process the event first.
+ m_pLastEvt = &event;
+
+ // let the active child (if any) process the event first.
bool res = false;
if (m_pActiveChild &&
event.IsCommandEvent() &&
res = m_pActiveChild->GetEventHandler()->ProcessEvent(event);
}
- // If the event was not handled this frame will handle it!
if (!res)
{
- //res = GetEventHandler()->ProcessEvent(event);
+ // if the event was not handled this frame will handle it,
+ // which is why we need the protection code at the beginning
+ // of this method
res = wxEvtHandler::ProcessEvent(event);
}
- inEvent = wxEVT_NULL;
+ m_pLastEvt = NULL;
return res;
}
m_pActiveChild = pChildFrame;
}
-wxAuiTabMDIClientWindow *wxAuiMDIParentFrame::GetClientWindow() const
+wxAuiMDIClientWindow *wxAuiMDIParentFrame::GetClientWindow() const
{
return m_pClientWindow;
}
-wxAuiTabMDIClientWindow *wxAuiMDIParentFrame::OnCreateClient()
+wxAuiMDIClientWindow *wxAuiMDIParentFrame::OnCreateClient()
{
- m_pClientWindow = new wxAuiTabMDIClientWindow( this );
+ m_pClientWindow = new wxAuiMDIClientWindow( this );
return m_pClientWindow;
}
void wxAuiMDIParentFrame::Init()
{
+ m_pLastEvt = NULL;
m_pClientWindow = NULL;
m_pActiveChild = NULL;
#if wxUSE_MENUS
long style,
const wxString& name)
{
- wxAuiTabMDIClientWindow* pClientWindow = parent->GetClientWindow();
+ wxAuiMDIClientWindow* pClientWindow = parent->GetClientWindow();
wxASSERT_MSG((pClientWindow != (wxWindow*) NULL), wxT("Missing MDI client window."));
wxPanel::Create(pClientWindow, id, wxDefaultPosition, size, style|wxNO_BORDER, name);
wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame();
wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame"));
- wxAuiTabMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
+ wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
wxASSERT_MSG(pClientWindow, wxT("Missing MDI Client Window"));
if (pParentFrame->GetActiveChild() == this)
wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame();
wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame"));
- wxAuiTabMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
+ wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
if (pClientWindow != NULL)
{
size_t pos;
wxAuiMDIParentFrame* pParentFrame = GetMDIParentFrame();
wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame"));
- wxAuiTabMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
+ wxAuiMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
if (pClientWindow != NULL)
{
//-----------------------------------------------------------------------------
-// wxAuiTabMDIClientWindow
+// wxAuiMDIClientWindow
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxAuiTabMDIClientWindow, wxAuiNotebook)
+IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIClientWindow, wxAuiNotebook)
-BEGIN_EVENT_TABLE(wxAuiTabMDIClientWindow, wxAuiNotebook)
- EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, wxAuiTabMDIClientWindow::OnPageChanged)
- EVT_SIZE(wxAuiTabMDIClientWindow::OnSize)
+BEGIN_EVENT_TABLE(wxAuiMDIClientWindow, wxAuiNotebook)
+ EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, wxAuiMDIClientWindow::OnPageChanged)
+ EVT_SIZE(wxAuiMDIClientWindow::OnSize)
END_EVENT_TABLE()
-wxAuiTabMDIClientWindow::wxAuiTabMDIClientWindow()
+wxAuiMDIClientWindow::wxAuiMDIClientWindow()
{
}
-wxAuiTabMDIClientWindow::wxAuiTabMDIClientWindow(wxAuiMDIParentFrame* parent, long style)
+wxAuiMDIClientWindow::wxAuiMDIClientWindow(wxAuiMDIParentFrame* parent, long style)
{
CreateClient(parent, style);
}
-wxAuiTabMDIClientWindow::~wxAuiTabMDIClientWindow()
+wxAuiMDIClientWindow::~wxAuiMDIClientWindow()
{
DestroyChildren();
}
-bool wxAuiTabMDIClientWindow::CreateClient(wxAuiMDIParentFrame* parent, long style)
+bool wxAuiMDIClientWindow::CreateClient(wxAuiMDIParentFrame* parent, long style)
{
SetWindowStyleFlag(style);
if (!wxAuiNotebook::Create(parent,
- wxID_ANY,
- wxPoint(0,0),
- wxSize(100, 100),
- wxNO_BORDER))
+ wxID_ANY,
+ wxPoint(0,0),
+ wxSize(100, 100),
+ wxAUI_NB_DEFAULT_STYLE | wxNO_BORDER))
{
return false;
}
return true;
}
-int wxAuiTabMDIClientWindow::SetSelection(size_t nPage)
+int wxAuiMDIClientWindow::SetSelection(size_t nPage)
{
return wxAuiNotebook::SetSelection(nPage);
}
-void wxAuiTabMDIClientWindow::PageChanged(int old_selection, int new_selection)
+void wxAuiMDIClientWindow::PageChanged(int old_selection, int new_selection)
{
// don't do anything if the page doesn't actually change
if (old_selection == new_selection)
if (old_selection != -1)
{
wxAuiMDIChildFrame* old_child = (wxAuiMDIChildFrame*)GetPage(old_selection);
- wxASSERT_MSG(old_child, wxT("wxAuiTabMDIClientWindow::PageChanged - null page pointer"));
+ wxASSERT_MSG(old_child, wxT("wxAuiMDIClientWindow::PageChanged - null page pointer"));
wxActivateEvent event(wxEVT_ACTIVATE, false, old_child->GetId());
event.SetEventObject(old_child);
if (new_selection != -1)
{
wxAuiMDIChildFrame* active_child = (wxAuiMDIChildFrame*)GetPage(new_selection);
- wxASSERT_MSG(active_child, wxT("wxAuiTabMDIClientWindow::PageChanged - null page pointer"));
+ wxASSERT_MSG(active_child, wxT("wxAuiMDIClientWindow::PageChanged - null page pointer"));
wxActivateEvent event(wxEVT_ACTIVATE, true, active_child->GetId());
event.SetEventObject(active_child);
}
}
-void wxAuiTabMDIClientWindow::OnPageChanged(wxAuiNotebookEvent& evt)
+void wxAuiMDIClientWindow::OnPageChanged(wxAuiNotebookEvent& evt)
{
PageChanged(evt.GetOldSelection(), evt.GetSelection());
evt.Skip();
}
-void wxAuiTabMDIClientWindow::OnSize(wxSizeEvent& evt)
+void wxAuiMDIClientWindow::OnSize(wxSizeEvent& evt)
{
wxAuiNotebook::OnSize(evt);