/////////////////////////////////////////////////////////////////////////////
-// Name: src/generic/mdig.cpp
+// Name: src/aui/tabmdi.cpp
// Purpose: Generic MDI (Multiple Document Interface) classes
// Author: Hans Van Leemputten
// Modified by: Benjamin I. Williams / Kirix Corporation
#pragma hdrstop
#endif
+#if wxUSE_AUI
#if wxUSE_MDI
#include "wx/aui/tabmdi.h"
#include "wx/menu.h"
#include "wx/intl.h"
#include "wx/log.h"
+ #include "wx/settings.h"
#endif //WX_PRECOMP
#include "wx/stockitem.h"
}
}
-void wxTabMDIParentFrame::SetMenuBar(wxMenuBar *pMenuBar)
+void wxTabMDIParentFrame::SetMenuBar(wxMenuBar* pMenuBar)
{
// Remove the Window menu from the old menu bar
RemoveWindowMenu(GetMenuBar());
-
+
// Add the Window menu to the new menu bar.
AddWindowMenu(pMenuBar);
-
+
wxFrame::SetMenuBar(pMenuBar);
m_pMyMenuBar = GetMenuBar();
}
SetMenuBar(m_pMyMenuBar);
// Make sure we know our menu bar is in use
- m_pMyMenuBar = NULL;
+ //m_pMyMenuBar = NULL;
}
else
{
void wxTabMDIParentFrame::ActivateNext()
{
- if (m_pClientWindow && m_pClientWindow->GetSelection() != -1)
+ if (m_pClientWindow && m_pClientWindow->GetSelection() != wxNOT_FOUND)
{
size_t active = m_pClientWindow->GetSelection() + 1;
if (active >= m_pClientWindow->GetPageCount())
void wxTabMDIParentFrame::ActivatePrevious()
{
- if (m_pClientWindow && m_pClientWindow->GetSelection() != -1)
+ if (m_pClientWindow && m_pClientWindow->GetSelection() != wxNOT_FOUND)
{
int active = m_pClientWindow->GetSelection() - 1;
if (active < 0)
{
if (pMenuBar && m_pWindowMenu)
{
- int pos = pMenuBar->FindMenu(wxGetStockLabel(wxID_HELP,false));
+ int pos = pMenuBar->FindMenu(wxGetStockLabel(wxID_HELP,wxSTOCK_NOFLAGS));
if (pos == wxNOT_FOUND)
pMenuBar->Append(m_pWindowMenu, _("&Window"));
else
{
wxTabMDIParentFrame* pParentFrame = GetMDIParentFrame();
wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame"));
-
+
wxTabMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
wxASSERT_MSG(pClientWindow, wxT("Missing MDI Client Window"));
-
+
bool bActive = false;
if (pParentFrame->GetActiveChild() == this)
{
pParentFrame->SetChildMenuBar(NULL);
bActive = true;
}
-
+
size_t pos, page_count = pClientWindow->GetPageCount();
for (pos = 0; pos < page_count; pos++)
{
if (pClientWindow->GetPage(pos) == this)
return pClientWindow->DeletePage(pos);
}
-
+
return false;
}
-/*
- wxTabMDIParentFrame* pParentFrame = GetMDIParentFrame();
- wxASSERT_MSG(pParentFrame, wxT("Missing MDI Parent Frame"));
-
- bool bActive = false;
- if (pParentFrame->GetActiveChild() == this)
- {
- pParentFrame->SetActiveChild(NULL);
- pParentFrame->SetChildMenuBar(NULL);
- bActive = true;
- }
-
- wxTabMDIClientWindow* pClientWindow = pParentFrame->GetClientWindow();
-
- // remove page if it is still there
- size_t pos;
- for (pos = 0; pos < pClientWindow->GetPageCount(); pos++)
- {
- if (pClientWindow->GetPage(pos) == this)
- {
- if (pClientWindow->RemovePage(pos))
- pClientWindow->Refresh();
- break;
- }
- }
-
- if (bActive)
- {
- // Set the new selection to the a remaining page
- if (pos < pClientWindow->GetPageCount())
- {
- pClientWindow->SetSelection(pos);
- }
- else
- {
- if (pClientWindow->GetPageCount() >= 1)
- pClientWindow->SetSelection(pClientWindow->GetPageCount() - 1);
- }
- }
-
- // delete the child frame with pending delete, as is
- // customary with frame windows
- if (!wxPendingDelete.Member(this))
- wxPendingDelete.Append(this);
-
- return true;
-*/
-
-
#if wxUSE_MENUS
void wxTabMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
{
wxWindow::Show(show);
}
-void wxTabMDIChildFrame::DoSetSize(int x, int y, int width, int height, int WXUNUSED(sizeFlags))
+void wxTabMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
m_mdi_newrect = wxRect(x, y, width, height);
+#ifdef __WXGTK__
+ wxPanel::DoSetSize(x,y,width, height, sizeFlags);
+#else
+ wxUnusedVar(sizeFlags);
+#endif
}
void wxTabMDIChildFrame::DoMoveWindow(int x, int y, int width, int height)
IMPLEMENT_DYNAMIC_CLASS(wxTabMDIClientWindow, wxAuiMultiNotebook)
BEGIN_EVENT_TABLE(wxTabMDIClientWindow, wxAuiMultiNotebook)
- EVT_AUINOTEBOOK_PAGE_CHANGED(-1, wxTabMDIClientWindow::OnPageChanged)
+ EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, wxTabMDIClientWindow::OnPageChanged)
EVT_SIZE(wxTabMDIClientWindow::OnSize)
END_EVENT_TABLE()
SetWindowStyleFlag(style);
if (!wxAuiMultiNotebook::Create(parent,
- -1,
+ wxID_ANY,
wxPoint(0,0),
wxSize(100, 100),
wxNO_BORDER))
{
return false;
}
-
+
wxColour bkcolour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
SetBackgroundColour(bkcolour);
-
+
m_mgr.GetArtProvider()->SetColour(wxAUI_ART_BACKGROUND_COLOUR, bkcolour);
-
+
return true;
}
// don't do anything if the page doesn't actually change
if (old_selection == new_selection)
return;
-
+
// don't do anything if the new page is already active
if (new_selection != -1)
{
{
wxTabMDIChildFrame* old_child = (wxTabMDIChildFrame*)GetPage(old_selection);
wxASSERT_MSG(old_child, wxT("wxTabMDIClientWindow::PageChanged - null page pointer"));
-
+
wxActivateEvent event(wxEVT_ACTIVATE, false, old_child->GetId());
event.SetEventObject(old_child);
old_child->GetEventHandler()->ProcessEvent(event);
{
wxTabMDIChildFrame* active_child = (wxTabMDIChildFrame*)GetPage(new_selection);
wxASSERT_MSG(active_child, wxT("wxTabMDIClientWindow::PageChanged - null page pointer"));
-
+
wxActivateEvent event(wxEVT_ACTIVATE, true, active_child->GetId());
event.SetEventObject(active_child);
active_child->GetEventHandler()->ProcessEvent(event);
}
void wxTabMDIClientWindow::OnSize(wxSizeEvent& evt)
-{
+{
wxAuiMultiNotebook::OnSize(evt);
for (size_t pos = 0; pos < GetPageCount(); pos++)
((wxTabMDIChildFrame *)GetPage(pos))->ApplyMDIChildFrameRect();
}
+#endif //wxUSE_AUI
#endif // wxUSE_MDI