Author: everaldo
Date: 2007-05-23 16:10:28 -0400 (Wed, 23 May 2007)
New Revision: 77863

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
Log:
        * MainMenu.cs, MenuAPI.cs: Implement Collapse event for MainMenu (2.0).

2007-05-23  Everaldo Canuto  <[EMAIL PROTECTED]>



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-05-23 20:08:52 UTC (rev 77862)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-05-23 20:10:28 UTC (rev 77863)
@@ -1,5 +1,9 @@
 2007-05-23  Everaldo Canuto  <[EMAIL PROTECTED]>
 
+       * MainMenu.cs, MenuAPI.cs: Implement Collapse event for MainMenu (2.0).
+
+2007-05-23  Everaldo Canuto  <[EMAIL PROTECTED]>
+
        * ContextMenu.cs: Implement ProcessCmdKey with control parameter.
 
 2007-05-23  Everaldo Canuto  <[EMAIL PROTECTED]>

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs      
2007-05-23 20:08:52 UTC (rev 77862)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs      
2007-05-23 20:10:28 UTC (rev 77863)
@@ -54,6 +54,19 @@
                }
 #endif
 
+               #region Events
+
+#if NET_2_0
+               static object CollapseEvent = new object ();
+
+               public event EventHandler Collapse {
+                       add { Events.AddHandler (CollapseEvent, value); }
+                       remove { Events.RemoveHandler (CollapseEvent, value); }
+               }
+#endif
+               
+               #endregion Events
+
                #region Public Properties
                [Localizable(true)]
 #if NET_2_0
@@ -95,6 +108,15 @@
                        return base.ToString () + ", GetForm: " + form;
                }
 
+#if NET_2_0
+               protected internal virtual void OnCollapse (EventArgs e)
+               {
+                       EventHandler eh = (EventHandler) (Events 
[CollapseEvent]);
+                       if (eh != null)
+                               eh (this, e);
+               }
+#endif
+
                #endregion Public Methods
                
                #region Private Methods

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs       
2007-05-23 20:08:52 UTC (rev 77862)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs       
2007-05-23 20:10:28 UTC (rev 77863)
@@ -286,7 +286,7 @@
 
                        /* When popup item then close all sub popups and 
unselect all sub items */
                        if (item.IsPopup) {
-                               HideSubPopups (item);
+                               HideSubPopups (item, TopMenu);
                                
                                /* Unselect all selected sub itens */
                                foreach (MenuItem subitem in item.MenuItems)
@@ -371,11 +371,11 @@
                        puw.ShowWindow ();
                }
 
-               static public void HideSubPopups (Menu menu)
+               static public void HideSubPopups (Menu menu, Menu topmenu)
                {
                        foreach (MenuItem item in menu.MenuItems)
                                if (item.IsPopup)
-                                       HideSubPopups (item);
+                                       HideSubPopups (item, null);
 
                        if (menu.Wnd == null)
                                return;
@@ -383,6 +383,11 @@
                        PopUpWindow puw = menu.Wnd as PopUpWindow;
                        puw.Hide ();
                        menu.Wnd = null;
+
+#if NET_2_0
+                       if ((topmenu != null) && (topmenu is MainMenu))
+                               ((MainMenu) topmenu).OnCollapse 
(EventArgs.Empty);
+#endif
                }
 
                MenuItem FindSubItemByCoord (Menu menu, Point pnt)
@@ -708,7 +713,7 @@
                                                CurrentMenu = item;
                                        }
                                } else {
-                                       HideSubPopups (CurrentMenu);
+                                       HideSubPopups (CurrentMenu, TopMenu);
                                        CurrentMenu = CurrentMenu.parent_menu;
                                }
                                break;
@@ -783,7 +788,7 @@
                public void HideWindow ()
                {
                        XplatUI.SetCursor (form.Handle, form.Cursor.handle);
-                       MenuTracker.HideSubPopups (menu);
+                       MenuTracker.HideSubPopups (menu, null);
                Hide ();
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to