X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2f1ae4143271ae63a17e052a1a471d16e9cd8c44..61cca9d24ee3f935f2581e3cfb894e46181290e6:/src/mac/carbon/frame.cpp diff --git a/src/mac/carbon/frame.cpp b/src/mac/carbon/frame.cpp index b5498fec48..aded221ea5 100644 --- a/src/mac/carbon/frame.cpp +++ b/src/mac/carbon/frame.cpp @@ -14,7 +14,7 @@ #endif #include "wx/frame.h" -#include "wx/mac/statusbr.h" +#include "wx/statusbr.h" #include "wx/toolbar.h" #include "wx/menuitem.h" #include "wx/menu.h" @@ -100,6 +100,7 @@ bool wxFrame::Create(wxWindow *parent, m_frameToolBar = NULL ; #endif m_frameStatusBar = NULL; + m_winLastFocused = NULL ; SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); @@ -199,8 +200,9 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, { wxStatusBar *statusBar = NULL; - statusBar = new wxStatusBar(this, id, style, name); - + statusBar = new wxStatusBar(this, id, + style, name); + statusBar->SetSize( 100 , 15 ) ; statusBar->SetFieldsCount(number); return statusBar; } @@ -216,7 +218,7 @@ void wxFrame::PositionStatusBar() // Since we wish the status bar to be directly under the client area, // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS. - m_frameStatusBar->SetSize(0, h, w, WX_MAC_STATUSBAR_HEIGHT ); + m_frameStatusBar->SetSize(0, h, w, sh); } } @@ -229,7 +231,7 @@ void wxFrame::SetMenuBar(wxMenuBar *menuBar) m_frameMenuBar = NULL; m_frameMenuBar = menuBar; - m_frameMenuBar->MacInstallMenuBar() ; +// m_frameMenuBar->MacInstallMenuBar() ; m_frameMenuBar->Attach(this); } @@ -258,10 +260,21 @@ void wxFrame::OnActivate(wxActivateEvent& event) { if ( !event.GetActive() ) { + // remember the last focused child + m_winLastFocused = FindFocus(); + while ( m_winLastFocused ) + { + if ( GetChildren().Find(m_winLastFocused) ) + break; + + m_winLastFocused = m_winLastFocused->GetParent(); + } + event.Skip(); - return; } - + else + { +/* for ( wxWindowList::Node *node = GetChildren().GetFirst(); node; node = node->GetNext() ) @@ -272,7 +285,7 @@ void wxFrame::OnActivate(wxActivateEvent& event) // restore focus wxWindow *child = node->GetData(); - if ( !child->IsTopLevel() + if ( !child->IsTopLevel() && child->AcceptsFocus() #if wxUSE_TOOLBAR && !wxDynamicCast(child, wxToolBar) #endif // wxUSE_TOOLBAR @@ -282,9 +295,17 @@ void wxFrame::OnActivate(wxActivateEvent& event) ) { child->SetFocus(); - return; + break; } } + */ + wxSetFocusToChild(this, &m_winLastFocused); + + if ( m_frameMenuBar != NULL ) + { + m_frameMenuBar->MacInstallMenuBar() ; + } + } } void wxFrame::DoGetClientSize(int *x, int *y) const @@ -296,8 +317,7 @@ void wxFrame::DoGetClientSize(int *x, int *y) const { int statusX, statusY; GetStatusBar()->GetClientSize(&statusX, &statusY); - // right now this is a constant, this might change someday - *y -= WX_MAC_STATUSBAR_HEIGHT ; + *y -= statusY; } #endif // wxUSE_STATUSBAR