X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/74e0e33a85ab0514dd1c0a750d694da1f3a28f08..7d6a4d96961eac84d05db8bb24c64d39003f6e54:/src/aui/tabmdi.cpp diff --git a/src/aui/tabmdi.cpp b/src/aui/tabmdi.cpp index 5d6859a371..e54e2d97f0 100644 --- a/src/aui/tabmdi.cpp +++ b/src/aui/tabmdi.cpp @@ -38,6 +38,7 @@ #endif //WX_PRECOMP #include "wx/stockitem.h" +#include "wx/aui/dockart.h" enum MDI_MENU_ID { @@ -56,6 +57,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIParentFrame, wxFrame) BEGIN_EVENT_TABLE(wxAuiMDIParentFrame, wxFrame) #if wxUSE_MENUS EVT_MENU (wxID_ANY, wxAuiMDIParentFrame::DoHandleMenu) + EVT_UPDATE_UI (wxID_ANY, wxAuiMDIParentFrame::DoHandleUpdateUI) #endif END_EVENT_TABLE() @@ -347,6 +349,35 @@ void wxAuiMDIParentFrame::DoHandleMenu(wxCommandEvent& event) event.Skip(); } } + +void wxAuiMDIParentFrame::DoHandleUpdateUI(wxUpdateUIEvent& event) +{ + switch (event.GetId()) + { + case wxWINDOWCLOSE: + case wxWINDOWCLOSEALL: + { + wxAuiMDIClientWindow* client_window = GetClientWindow(); + wxCHECK_RET(client_window, wxS("Missing MDI Client Window")); + size_t pages = client_window->GetPageCount(); + event.Enable(pages >= 1); + break; + } + + case wxWINDOWNEXT: + case wxWINDOWPREV: + { + wxAuiMDIClientWindow* client_window = GetClientWindow(); + wxCHECK_RET(client_window, wxS("Missing MDI Client Window")); + size_t pages = client_window->GetPageCount(); + event.Enable(pages >= 2); + break; + } + + default: + event.Skip(); + } +} #endif // wxUSE_MENUS void wxAuiMDIParentFrame::DoGetClientSize(int* width, int* height) const @@ -409,7 +440,7 @@ wxAuiMDIChildFrame::wxAuiMDIChildFrame(wxAuiMDIParentFrame *parent, // is, but those are the expected symantics. No style flag is passed // onto the panel underneath. if (style & wxMINIMIZE) - m_activate_on_create = false; + m_activateOnCreate = false; Create(parent, id, title, wxDefaultPosition, size, 0, name); } @@ -451,7 +482,7 @@ bool wxAuiMDIChildFrame::Create(wxAuiMDIParentFrame* parent, // see comment in constructor if (style & wxMINIMIZE) - m_activate_on_create = false; + m_activateOnCreate = false; wxSize cli_size = pClientWindow->GetClientSize(); @@ -471,7 +502,7 @@ bool wxAuiMDIChildFrame::Create(wxAuiMDIParentFrame* parent, m_title = title; - pClientWindow->AddPage(this, title, m_activate_on_create); + pClientWindow->AddPage(this, title, m_activateOnCreate); pClientWindow->Refresh(); return true; @@ -565,12 +596,12 @@ void wxAuiMDIChildFrame::SetIcons(const wxIconBundle& icons) { // get icon with the system icon size SetIcon(icons.GetIcon(-1)); - m_icon_bundle = icons; + m_iconBundle = icons; } const wxIconBundle& wxAuiMDIChildFrame::GetIcons() const { - return m_icon_bundle; + return m_iconBundle; } void wxAuiMDIChildFrame::SetIcon(const wxIcon& icon) @@ -658,7 +689,7 @@ wxAuiMDIParentFrame* wxAuiMDIChildFrame::GetMDIParentFrame() const void wxAuiMDIChildFrame::Init() { - m_activate_on_create = true; + m_activateOnCreate = true; m_pMDIParentFrame = NULL; #if wxUSE_MENUS m_pMenuBar = NULL; @@ -667,7 +698,7 @@ void wxAuiMDIChildFrame::Init() bool wxAuiMDIChildFrame::Show(bool show) { - m_activate_on_create = show; + m_activateOnCreate = show; // do nothing return true; @@ -680,7 +711,7 @@ void wxAuiMDIChildFrame::DoShow(bool show) void wxAuiMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags) { - m_mdi_newrect = wxRect(x, y, width, height); + m_mdiNewRect = wxRect(x, y, width, height); #ifdef __WXGTK__ wxPanel::DoSetSize(x,y,width, height, sizeFlags); #else @@ -690,16 +721,16 @@ void wxAuiMDIChildFrame::DoSetSize(int x, int y, int width, int height, int size void wxAuiMDIChildFrame::DoMoveWindow(int x, int y, int width, int height) { - m_mdi_newrect = wxRect(x, y, width, height); + m_mdiNewRect = wxRect(x, y, width, height); } void wxAuiMDIChildFrame::ApplyMDIChildFrameRect() { - if (m_mdi_currect != m_mdi_newrect) + if (m_mdiCurRect != m_mdiNewRect) { - wxPanel::DoMoveWindow(m_mdi_newrect.x, m_mdi_newrect.y, - m_mdi_newrect.width, m_mdi_newrect.height); - m_mdi_currect = m_mdi_newrect; + wxPanel::DoMoveWindow(m_mdiNewRect.x, m_mdiNewRect.y, + m_mdiNewRect.width, m_mdiNewRect.height); + m_mdiCurRect = m_mdiNewRect; } }