Example #1
0
                void MenuWillHighlightItem(NSMenu menu, NSMenuItem willHighlightItem)
                {
                    if (oldItem != null)
                    {
                        oldItem.FireDeselectedEvent();
                        oldItem = null;
                    }
                    if (willHighlightItem == null)
                    {
                        return;
                    }
                    int index = (int)menu.IndexOf(willHighlightItem);

                    if (index < 0)
                    {
                        return;
                    }
                    oldItem = this.menu.Items [index];
                    nfloat x = 0, y = 0;
                    var    locationAwareMenu = menu as NSLocationAwareMenu;

                    if (locationAwareMenu != null)
                    {
                        while (locationAwareMenu.Parent != null && locationAwareMenu.Parent.TryGetTarget(out var other))
                        {
                            locationAwareMenu = other;
                        }
                        x    = locationAwareMenu.Location.X;
                        y    = locationAwareMenu.Location.Y;
                        menu = locationAwareMenu;
                    }
                    oldItem.FireSelectedEvent(new Xwt.Rectangle(x, y, menu.Size.Width, menu.Size.Height));
                }
Example #2
0
            void MenuWillHighlightItem(NSMenu menu, NSMenuItem willHighlightItem)
            {
                if (oldItem != null)
                {
                    oldItem.FireDeselectedEvent();
                    oldItem = null;
                }
                if (willHighlightItem == null)
                {
                    return;
                }
                int index = (int)menu.IndexOf(willHighlightItem);

                if (index < 0)
                {
                    return;
                }
                oldItem = this.menu.Items [index];

                oldItem.FireSelectedEvent(new Xwt.Rectangle(lastOpenPositon.X, lastOpenPositon.Y, menu.Size.Width, menu.Size.Height));
            }
			void MenuWillHighlightItem (NSMenu menu, NSMenuItem willHighlightItem)
			{
				if (oldItem != null) {
					oldItem.FireDeselectedEvent ();
					oldItem = null;
				}
				if (willHighlightItem == null)
					return;
				int index = (int)menu.IndexOf (willHighlightItem);
				if (index < 0)
					return;
				oldItem = this.menu.Items [index];

				oldItem.FireSelectedEvent (new Xwt.Rectangle (lastOpenPositon.X, lastOpenPositon.Y, menu.Size.Width, menu.Size.Height));
			}