]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/frame.cpp
menu title is drawn in bold font and the commands from it are ignored
[wxWidgets.git] / src / gtk / frame.cpp
index d809e69266c841908d757ab7eba50c5f07af6ac2..c314c3d28c50d2f49899654e33ded89fc0578799 100644 (file)
@@ -8,7 +8,7 @@
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
-#pragma implementation "frame.h"
+    #pragma implementation "frame.h"
 #endif
 
 #include "wx/frame.h"
@@ -105,6 +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_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
 END_EVENT_TABLE()
 
 IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
@@ -196,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();
     }
 }
@@ -225,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" );
@@ -479,6 +475,13 @@ void wxFrame::OnInternalIdle()
     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" );
@@ -564,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" );