Update of /cvsroot/mahogany/M/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30029/src/gui

Modified Files:
        wxFolderTree.cpp 
Log Message:
show popup menu for currently selected folder when it is opened using kbd and not mouse

Index: wxFolderTree.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/gui/wxFolderTree.cpp,v
retrieving revision 1.235
retrieving revision 1.236
diff -b -u -2 -r1.235 -r1.236
--- wxFolderTree.cpp    3 May 2004 07:44:15 -0000       1.235
+++ wxFolderTree.cpp    27 Sep 2004 20:05:48 -0000      1.236
@@ -2901,28 +2901,39 @@
 void wxFolderTreeImpl::OnRightDown(wxMouseEvent& event)
 {
-   // for now... see comments near m_suppressSelectionChange declaration
-   m_suppressSelectionChange = true;
-
+   wxTreeItemId item;
    wxPoint pt = event.GetPosition();
-   wxTreeItemId item = HitTest(pt);
-   if ( item.IsOk() )
-   {
-      SelectItem(item);
-   }
-   else
+   if ( pt == wxDefaultPosition )
    {
+      // show the menu for the currently selected item
       item = wxTreeCtrl::GetSelection();
+      if ( !item.IsOk() )
+      {
+         event.Skip();
+         return;
    }
 
-#if 0
-   // try to popup the menu in some reasonable position
-   if ( item.IsOk() )
-   {
+      // and position it over it
       wxRect rect;
       GetBoundingRect(item, rect);
-      pt.x = (rect.GetX() + rect.GetWidth())/2;
-      pt.y = (rect.GetY() + rect.GetHeight())/2;
+      pt.x = rect.x + rect.width / 2;
+      pt.y = rect.y + rect.height / 2;
+   }
+   else // event generated with real mouse click
+   {
+      // show the menu for the item under mouse
+      item = HitTest(pt);
+      if ( !item.IsOk() )
+      {
+         event.Skip();
+         return;
+      }
+
+      // for now... see comments near m_suppressSelectionChange declaration
+      m_suppressSelectionChange = true;
+
+      SelectItem(item);
+
+      m_suppressSelectionChange = false;
    }
-#endif
 
    // show menu in any case
@@ -2935,6 +2946,4 @@
    SafeDecRef(m_previousFolder); // matches IncRef() in OnTreeSelect()
    m_previousFolder = NULL;
-
-   m_suppressSelectionChange = false;
 }
 



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to