From 86171954ec23d82d4095b16cc4477509573152d6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 4 Feb 2002 15:40:34 +0000 Subject: [PATCH] don't skip first/last node when pressing down/up arrow after opening the menu with the mouse git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/univ/menu.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index ac728688b9..e5bf6a9e66 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -352,14 +352,9 @@ void wxPopupMenuWindow::ChangeCurrent(wxMenuItemList::Node *node) wxMenuItemList::Node *wxPopupMenuWindow::GetPrevNode() const { - wxMenuItemList::Node *node = m_nodeCurrent; - if ( !node ) - { - // start from the end if no current item - node = m_menu->GetMenuItems().GetLast(); - } - - return GetPrevNode(node); + // return the last node if there had been no previously selected one + return m_nodeCurrent ? GetPrevNode(m_nodeCurrent) + : m_menu->GetMenuItems().GetLast(); } wxMenuItemList::Node * @@ -380,14 +375,9 @@ wxPopupMenuWindow::GetPrevNode(wxMenuItemList::Node *node) const wxMenuItemList::Node *wxPopupMenuWindow::GetNextNode() const { - wxMenuItemList::Node *node = m_nodeCurrent; - if ( !node ) - { - // start from the beginning if no current item - node = m_menu->GetMenuItems().GetFirst(); - } - - return GetNextNode(node); + // return the first node if there had been no previously selected one + return m_nodeCurrent ? GetNextNode(m_nodeCurrent) + : m_menu->GetMenuItems().GetFirst(); } wxMenuItemList::Node * -- 2.47.2