X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5b077d483bcd47bcd1c3e89a9adc1d6b1a44e046..a3f4e9e81afa4f435b137ebbfb5b07e98a698271:/src/gtk/frame.cpp diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 934ea9d990..c314c3d28c 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -8,7 +8,7 @@ ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ -#pragma implementation "frame.h" + #pragma implementation "frame.h" #endif #include "wx/frame.h" @@ -91,6 +91,10 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC win->m_x = event->x; win->m_y = event->y; + wxMoveEvent mevent( wxPoint(win->m_x,win->m_y), win->GetId() ); + mevent.SetEventObject( win ); + win->GetEventHandler()->ProcessEvent( mevent ); + return FALSE; } @@ -101,7 +105,7 @@ static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventC BEGIN_EVENT_TABLE(wxFrame, wxWindow) EVT_SIZE(wxFrame::OnSize) EVT_CLOSE(wxFrame::OnCloseWindow) - EVT_IDLE(wxFrame::OnIdle) + EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow) @@ -193,14 +197,14 @@ wxFrame::~wxFrame() if (m_frameToolBar) delete m_frameToolBar; wxTopLevelWindows.DeleteObject( this ); - + if (wxTheApp->GetTopWindow() == this) { wxTheApp->SetTopWindow( (wxWindow*) NULL ); } - + if (wxTopLevelWindows.Number() == 0) - { + { wxTheApp->ExitMainLoop(); } } @@ -222,11 +226,6 @@ bool wxFrame::Show( bool show ) return wxWindow::Show( show ); } -void wxFrame::OnCloseWindow( wxCloseEvent &event ) -{ - if (GetEventHandler()->OnClose() || event.GetForce()) this->Destroy(); -} - bool wxFrame::Destroy() { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); @@ -296,8 +295,8 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags ) if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; - if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; - if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight; + if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; + if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; if ((m_x != -1) || (m_y != -1)) { @@ -307,7 +306,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags ) if ((m_width != old_width) || (m_height != old_height)) { - gtk_widget_set_usize( m_widget, m_width, m_height ); + gtk_widget_set_usize( m_widget, m_width, m_height ); } wxSizeEvent event( wxSize(m_width,m_height), GetId() ); @@ -390,8 +389,8 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; - if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; - if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight; + if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; + if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; gtk_widget_set_usize( m_widget, m_width, m_height ); @@ -450,14 +449,25 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height m_sizeSet = TRUE; + /* send size event to frame */ + wxSizeEvent event( wxSize(m_width,m_height), GetId() ); event.SetEventObject( this ); GetEventHandler()->ProcessEvent( event ); + /* send size event to status bar */ + + if (m_frameStatusBar) + { + wxSizeEvent event2( wxSize(m_frameStatusBar->m_width,m_frameStatusBar->m_height), m_frameStatusBar->GetId() ); + event2.SetEventObject( m_frameStatusBar ); + m_frameStatusBar->GetEventHandler()->ProcessEvent( event2 ); + } + m_resizing = FALSE; } -void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) ) +void wxFrame::OnInternalIdle() { if (!m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height ); @@ -465,6 +475,13 @@ void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) ) DoMenuUpdates(); } +void wxFrame::OnCloseWindow( wxCloseEvent& event ) +{ + // close the window if it wasn't vetoed by the application +// if ( !event.GetVeto() ) // No, this isn't the interpretation of GetVeto. + Destroy(); +} + void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); @@ -550,6 +567,29 @@ wxMenuBar *wxFrame::GetMenuBar() const return m_frameMenuBar; } +void wxFrame::OnMenuHighlight(wxMenuEvent& event) +{ + if (GetStatusBar()) + { + if (event.GetMenuId() == -1) + { + SetStatusText(""); + } + else + { + wxMenuBar *menuBar = GetMenuBar(); + if (menuBar) + { + int menuId = event.GetMenuId(); + wxString helpString; + helpString = menuBar->GetHelpString(menuId); + if (helpString != "") + SetStatusText(helpString); + } + } + } +} + wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { wxASSERT_MSG( (m_widget != NULL), "invalid frame" );