git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17214
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/generic/mdig.h"
#include "wx/generic/mdig.h"
{
wxWINDOWCLOSE = 4001,
wxWINDOWCLOSEALL,
{
wxWINDOWCLOSE = 4001,
wxWINDOWCLOSEALL,
EVT_MENU (-1, wxGenericMDIParentFrame::DoHandleMenu)
END_EVENT_TABLE()
EVT_MENU (-1, wxGenericMDIParentFrame::DoHandleMenu)
END_EVENT_TABLE()
-wxGenericMDIParentFrame::wxGenericMDIParentFrame()
-{
- Init();
+wxGenericMDIParentFrame::wxGenericMDIParentFrame()
+{
+ Init();
}
wxGenericMDIParentFrame::wxGenericMDIParentFrame(wxWindow *parent,
}
wxGenericMDIParentFrame::wxGenericMDIParentFrame(wxWindow *parent,
const wxString& name)
{
Init();
const wxString& name)
{
Init();
(void)Create(parent, id, title, pos, size, style, name);
}
wxGenericMDIParentFrame::~wxGenericMDIParentFrame()
(void)Create(parent, id, title, pos, size, style, name);
}
wxGenericMDIParentFrame::~wxGenericMDIParentFrame()
// Make sure the client window is destructed before the menu bars are!
wxDELETE(m_pClientWindow);
// Make sure the client window is destructed before the menu bars are!
wxDELETE(m_pClientWindow);
if (m_pMyMenuBar)
{
delete m_pMyMenuBar;
m_pMyMenuBar = (wxMenuBar *) NULL;
}
if (m_pMyMenuBar)
{
delete m_pMyMenuBar;
m_pMyMenuBar = (wxMenuBar *) NULL;
}
RemoveWindowMenu(GetMenuBar());
if (m_pWindowMenu)
RemoveWindowMenu(GetMenuBar());
if (m_pWindowMenu)
{
// No Child, set Our menu bar back.
SetMenuBar(m_pMyMenuBar);
{
// No Child, set Our menu bar back.
SetMenuBar(m_pMyMenuBar);
// Make sure we know our menu bar is in use
m_pMyMenuBar = (wxMenuBar*) NULL;
}
// Make sure we know our menu bar is in use
m_pMyMenuBar = (wxMenuBar*) NULL;
}
// Let the active child (if any) process the event first.
bool res = FALSE;
// Let the active child (if any) process the event first.
bool res = FALSE;
- if (m_pActiveChild && event.IsKindOf(CLASSINFO(wxCommandEvent))
+ if (m_pActiveChild && event.IsKindOf(CLASSINFO(wxCommandEvent))
#if 0
/* This is sure to not give problems... */
&& (event.GetEventType() == wxEVT_COMMAND_MENU_SELECTED ||
#if 0
/* This is sure to not give problems... */
&& (event.GetEventType() == wxEVT_COMMAND_MENU_SELECTED ||
void wxGenericMDIParentFrame::AddWindowMenu(wxMenuBar *pMenuBar)
{
if (pMenuBar && m_pWindowMenu)
void wxGenericMDIParentFrame::AddWindowMenu(wxMenuBar *pMenuBar)
{
if (pMenuBar && m_pWindowMenu)
- {
- int pos = pMenuBar->FindMenu(_T("Help"));
+ {
+ int pos = pMenuBar->FindMenu(_T("Help"));
if (pos == wxNOT_FOUND)
{
pMenuBar->Append(m_pWindowMenu, _T("&Window"));
if (pos == wxNOT_FOUND)
{
pMenuBar->Append(m_pWindowMenu, _T("&Window"));
{
switch (event.GetId())
{
{
switch (event.GetId())
{
if (m_pActiveChild)
{
m_pActiveChild->Close();
if (m_pActiveChild)
{
m_pActiveChild->Close();
break;
case wxWINDOWCLOSEALL:
{
break;
case wxWINDOWCLOSEALL:
{
-#if 0 // code is only needed if next #if is set to 0!
+#if 0 // code is only needed if next #if is set to 0!
wxGenericMDIChildFrame *pFirstActiveChild = m_pActiveChild;
#endif
while (m_pActiveChild)
wxGenericMDIChildFrame *pFirstActiveChild = m_pActiveChild;
#endif
while (m_pActiveChild)
{
#if 1 // What's best? Delayed deleting or immediate deleting?
delete m_pActiveChild;
{
#if 1 // What's best? Delayed deleting or immediate deleting?
delete m_pActiveChild;
ActivateNext();
if (pFirstActiveChild == m_pActiveChild)
ActivateNext();
if (pFirstActiveChild == m_pActiveChild)
if (bActive)
{
// Set the new selection to the a remaining page
if (bActive)
{
// Set the new selection to the a remaining page
wxASSERT_MSG((pClientWindow != (wxWindow*) NULL), "Missing MDI client window.");
wxPanel::Create(pClientWindow, id, wxDefaultPosition, size, style, name);
wxASSERT_MSG((pClientWindow != (wxWindow*) NULL), "Missing MDI client window.");
wxPanel::Create(pClientWindow, id, wxDefaultPosition, size, style, name);
SetMDIParentFrame(parent);
// This is the currently active child
SetMDIParentFrame(parent);
// This is the currently active child
void wxGenericMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
{
wxMenuBar *pOldMenuBar = m_pMenuBar;
void wxGenericMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
{
wxMenuBar *pOldMenuBar = m_pMenuBar;
if (m_pMenuBar)
{
wxGenericMDIParentFrame *pParentFrame = GetMDIParentFrame();
if (m_pMenuBar)
{
wxGenericMDIParentFrame *pParentFrame = GetMDIParentFrame();
if (pParentFrame != NULL)
{
m_pMenuBar->SetParent(pParentFrame);
if (pParentFrame != NULL)
{
m_pMenuBar->SetParent(pParentFrame);
void wxGenericMDIChildFrame::SetTitle(const wxString& title)
{
m_Title = title;
wxGenericMDIParentFrame *pParentFrame = GetMDIParentFrame();
void wxGenericMDIChildFrame::SetTitle(const wxString& title)
{
m_Title = title;
wxGenericMDIParentFrame *pParentFrame = GetMDIParentFrame();
if (pParentFrame != NULL)
{
wxGenericMDIClientWindow * pClientWindow = pParentFrame->GetClientWindow();
if (pParentFrame != NULL)
{
wxGenericMDIClientWindow * pClientWindow = pParentFrame->GetClientWindow();
if (pClientWindow != NULL)
if (pClientWindow != NULL)
int pos;
for (pos = 0; pos < pClientWindow->GetPageCount(); pos++)
{
int pos;
for (pos = 0; pos < pClientWindow->GetPageCount(); pos++)
{
pClientWindow->SetPageText(pos, m_Title);
break;
}
pClientWindow->SetPageText(pos, m_Title);
break;
}
-wxString wxGenericMDIChildFrame::GetTitle()
+wxString wxGenericMDIChildFrame::GetTitle() const
#if wxUSE_STATUSBAR
if ( m_pMDIParentFrame)
{
#if wxUSE_STATUSBAR
if ( m_pMDIParentFrame)
{
- // we don't have any help text for this item,
+ // we don't have any help text for this item,
// but may be the MDI frame does?
m_pMDIParentFrame->OnMenuHighlight(event);
}
// but may be the MDI frame does?
m_pMDIParentFrame->OnMenuHighlight(event);
}
-void wxGenericMDIChildFrame::SetMDIParentFrame(wxGenericMDIParentFrame* parentFrame)
-{
- m_pMDIParentFrame = parentFrame;
+void wxGenericMDIChildFrame::SetMDIParentFrame(wxGenericMDIParentFrame* parentFrame)
+{
+ m_pMDIParentFrame = parentFrame;
-wxGenericMDIParentFrame* wxGenericMDIChildFrame::GetMDIParentFrame() const
-{
- return m_pMDIParentFrame;
+wxGenericMDIParentFrame* wxGenericMDIChildFrame::GetMDIParentFrame() const
+{
+ return m_pMDIParentFrame;
}
void wxGenericMDIChildFrame::Init()
}
void wxGenericMDIChildFrame::Init()
m_pMDIParentFrame = (wxGenericMDIParentFrame *) NULL;
#if wxUSE_MENUS
m_pMenuBar = (wxMenuBar *) NULL;
m_pMDIParentFrame = (wxGenericMDIParentFrame *) NULL;
#if wxUSE_MENUS
m_pMenuBar = (wxMenuBar *) NULL;
}
void wxGenericMDIChildFrame::DoMoveWindow(int x, int y, int width, int height)
}
void wxGenericMDIChildFrame::DoMoveWindow(int x, int y, int width, int height)
m_MDIRect = wxRect(x, y, width, height);
}
m_MDIRect = wxRect(x, y, width, height);
}
{
int oldSelection = wxNotebook::SetSelection(nPage);
{
int oldSelection = wxNotebook::SetSelection(nPage);
-#if !defined(__WXMSW__) // No need to do this for wxMSW as wxNotebook::SetSelection()
+#if !defined(__WXMSW__) // No need to do this for wxMSW as wxNotebook::SetSelection()
// will already cause this to be done!
// Handle the page change.
PageChanged(oldSelection, nPage);
// will already cause this to be done!
// Handle the page change.
PageChanged(oldSelection, nPage);