Exemple #1
0
        internal void Deactivate()
        {
            bool redrawbar = (keynav_state != KeyNavState.Idle) && (TopMenu is MainMenu);

            active        = false;
            popup_active  = false;
            hotkey_active = false;
            if (GrabControl != null)
            {
                GrabControl.ActiveTracker = null;
            }
            keynav_state = KeyNavState.Idle;
            if (TopMenu is ContextMenu)
            {
                PopUpWindow puw = TopMenu.Wnd as PopUpWindow;
                DeselectItem(TopMenu.SelectedItem);
                if (puw != null)
                {
                    puw.HideWindow();
                }
            }
            else
            {
                DeselectItem(TopMenu.SelectedItem);
            }
            CurrentMenu = TopMenu;

            if (redrawbar)
            {
                (TopMenu as MainMenu).Draw();
            }
        }
Exemple #2
0
        static public void HideSubPopups(Menu menu, Menu topmenu)
        {
            foreach (MenuItem item in menu.MenuItems)
            {
                if (item.IsPopup)
                {
                    HideSubPopups(item, null);
                }
            }

            if (menu.Wnd == null)
            {
                return;
            }

            PopUpWindow puw = menu.Wnd as PopUpWindow;

            if (puw != null)
            {
                puw.Hide();
                puw.Dispose();
            }
            menu.Wnd = null;

            if ((topmenu != null) && (topmenu is MainMenu))
            {
                ((MainMenu)topmenu).OnCollapse(EventArgs.Empty);
            }
        }
Exemple #3
0
        // Create a popup window and show it or only show it if it is already created
        void ShowSubPopup(Menu menu, MenuItem item)
        {
            if (item.Enabled == false)
            {
                return;
            }

            if (!popdown_menu || !item.VisibleItems)
            {
                item.PerformPopup();
            }

            if (item.VisibleItems == false)
            {
                return;
            }

            if (item.Wnd != null)
            {
                item.Wnd.Dispose();
            }

            popup_active = true;
            PopUpWindow puw = new PopUpWindow(GrabControl, item);

            Point pnt;

            if (menu is MainMenu)
            {
                pnt = new Point(item.X, item.Y + item.Height - 2 - menu.Height);
            }
            else
            {
                pnt = new Point(item.X + item.Width - 3, item.Y - 3);
            }
            pnt          = menu.Wnd.PointToScreen(pnt);
            puw.Location = pnt;
            item.Wnd     = puw;

            puw.ShowWindow();
            if (menu.Tracker.ShowSubPopupEvent != null)
            {
                menu.Tracker.ShowSubPopupEvent(this, new SubPopupEventArgs(item));
            }
        }
Exemple #4
0
		// Create a popup window and show it or only show it if it is already created
		void ShowSubPopup (Menu menu, MenuItem item)
		{
			if (item.Enabled == false)
				return;

			if (!popdown_menu || !item.VisibleItems) 
				item.PerformPopup ();
			
			if (item.VisibleItems == false)
				return;

			if (item.Wnd != null) {
				item.Wnd.Dispose ();
			}

			popup_active = true;
			PopUpWindow puw = new PopUpWindow (GrabControl, item);
			
			Point pnt;
			if (menu is MainMenu)
				pnt = new Point (item.X, item.Y + item.Height - 2 - menu.Height);
			else
				pnt = new Point (item.X + item.Width - 3, item.Y - 3);
			pnt = menu.Wnd.PointToScreen (pnt);
			puw.Location = pnt;
			item.Wnd = puw;

			puw.ShowWindow ();
		}