]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/menu.cpp
changed charset to iso8859-2
[wxWidgets.git] / src / univ / menu.cpp
index c87393282d08d5843efa4a45f769d1bb829d9fd0..e78fc96cd9361dc18e7e775a03b526eab1f0a82e 100644 (file)
@@ -123,6 +123,8 @@ class wxPopupMenuWindow : public wxPopupTransientWindow
 {
 public:
     wxPopupMenuWindow(wxWindow *parent, wxMenu *menu);
+    
+    ~wxPopupMenuWindow();
 
     // override the base class version to select the first item initially
     virtual void Popup(wxWindow *focus = NULL);
@@ -308,6 +310,10 @@ wxPopupMenuWindow::wxPopupMenuWindow(wxWindow *parent, wxMenu *menu)
     SetCursor(wxCURSOR_ARROW);
 }
 
+wxPopupMenuWindow::~wxPopupMenuWindow()
+{
+}
+
 // ----------------------------------------------------------------------------
 // wxPopupMenuWindow current item/node handling
 // ----------------------------------------------------------------------------
@@ -662,7 +668,7 @@ bool wxPopupMenuWindow::ProcessLeftDown(wxMouseEvent& event)
             wxPopupMenuWindow *win = menu->m_popupMenu;
 
             wxCHECK_MSG( win, FALSE, _T("parent menu not shown?") );
-
+            
             pos = ClientToScreen(pos);
             if ( win->GetMenuItemFromPoint(win->ScreenToClient(pos)) )
             {
@@ -1154,6 +1160,10 @@ wxWindow *wxMenu::GetRootWindow() const
     wxMenu *menu = GetParent();
     while ( menu )
     {
+        // We are a submenu of a menu of a menubar
+        if (menu->GetMenuBar())
+           return menu->GetMenuBar();
+    
         win = menu->GetInvokingWindow();
         if ( win )
             break;
@@ -1164,7 +1174,7 @@ wxWindow *wxMenu::GetRootWindow() const
     // we're probably going to crash in the caller anyhow, but try to detect
     // this error as soon as possible
     wxASSERT_MSG( win, _T("menu without any associated window?") );
-
+    
     // also remember it in this menu so that we don't have to search for it the
     // next time
     wxConstCast(this, wxMenu)->m_invokingWindow = win;
@@ -1259,7 +1269,7 @@ void wxMenu::Popup(const wxPoint& pos, const wxSize& size, bool selectFirst)
     {
         m_popupMenu->SelectFirst();
     }
-
+    
     // the geometry might have changed since the last time we were shown, so
     // always resize
     m_popupMenu->SetClientSize(GetGeometryInfo().GetSize());
@@ -1837,7 +1847,7 @@ int wxMenuBar::GetMenuFromPoint(const wxPoint& pos) const
 void wxMenuBar::SelectMenu(size_t pos)
 {
     SetFocus();
-    wxLogDebug("Capturing mouse from wxMenuBar::SelectMenu");
+    wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::SelectMenu"));
     CaptureMouse();
 
     DoSelectMenu(pos);
@@ -1926,7 +1936,7 @@ void wxMenuBar::OnLeftDown(wxMouseEvent& event)
         }
         else // on item
         {
-           wxLogDebug("Capturing mouse from wxMenuBar::OnLeftDown");
+               wxLogTrace(_T("mousecapture"), _T("Capturing mouse from wxMenuBar::OnLeftDown"));
             CaptureMouse();
 
             // show it as selected
@@ -2289,7 +2299,7 @@ void wxMenuBar::OnDismiss()
 {
     if ( GetCapture() )
     {
-        wxLogDebug("Releasing mouse from wxMenuBar::OnDismiss");
+        wxLogTrace(_T("mousecapture"), _T("Releasing mouse from wxMenuBar::OnDismiss"));
         GetCapture()->ReleaseMouse();
     }
 
@@ -2379,6 +2389,9 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
 void wxWindow::DismissPopupMenu()
 {
     wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") );
+    
+    char *crash = NULL;
+    (*crash) = 0;
 
     ms_evtLoopPopup->Exit();
 }