Ejemplo n.º 1
0
        public bool HandleMenuMouseDown(MainMenu menu, int x, int y)
        {
            Point_ pt = MenuTracker.ScreenToMenu(menu, new Point_(x, y));

            HandleTitleBarDown(pt.X, pt.Y);
            return(TitleButtons.AnyPushedTitleButtons);
        }
		public ContextMenu (MenuItem [] menuItems) : base (menuItems)
		{
			CreateHandle();
			tracker = new MenuTracker (this);
			right_to_left = RightToLeft.Inherit;
			
		}
Ejemplo n.º 3
0
        internal void SetForm(Form form)
        {
            this.form = form;
            Wnd       = form;

            if (tracker == null)
            {
                tracker             = new MenuTracker(this);
                tracker.GrabControl = form;
            }
        }
        public void Show(Control control, Point pos)
        {
            if (control == null)
            {
                throw new ArgumentException();
            }

            src_control = control;

            OnPopup(EventArgs.Empty);
            pos = control.PointToScreen(pos);
            MenuTracker.TrackPopupMenu(this, pos);
            OnCollapse(EventArgs.Empty);
        }
Ejemplo n.º 5
0
        static public bool TrackPopupMenu(Menu menu, Point pnt)
        {
            if (menu.MenuItems.Count <= 0)              // No submenus to track
            {
                return(true);
            }

            MenuTracker tracker = menu.tracker;

            tracker.active       = true;
            tracker.popup_active = true;

            // Set GrabControl
            Control src_ctrl = (tracker.TopMenu as ContextMenu).SourceControl;

            tracker.GrabControl = src_ctrl.FindForm();
            if (tracker.GrabControl == null)
            {
                tracker.GrabControl = src_ctrl.FindRootParent();
            }
            //tracker.GrabControl.ActiveTracker = tracker;


            menu.Wnd          = new PopUpWindow(tracker.GrabControl, menu);
            menu.Wnd.Location = menu.Wnd.PointToClient(pnt);
            //((PopUpWindow)menu.Wnd).ShowWindow ();

            bool no_quit = true;

            //Object queue_id = XplatUI.StartLoop(Thread.CurrentThread);



            if (tracker.GrabControl.IsDisposed)
            {
                return(true);
            }

            //if (!no_quit)
            //	XplatUI.PostQuitMessage(0);

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

            return(true);
        }
Ejemplo n.º 6
0
Archivo: Menu.cs Proyecto: nsivov/mono
            public virtual void Clear()
            {
                MenuTracker tracker = owner.Tracker;

                foreach (MenuItem item in items)
                {
                    if (tracker != null)
                    {
                        tracker.RemoveShortcuts(item);
                    }
                    item.parent_menu = null;
                }
                items.Clear();
                owner.OnMenuChanged(EventArgs.Empty);
            }
Ejemplo n.º 7
0
Archivo: Menu.cs Proyecto: nsivov/mono
            public virtual void RemoveAt(int index)
            {
                if (index < 0 || index >= Count)
                {
                    throw new ArgumentOutOfRangeException("Index of out range");
                }

                MenuItem    item    = (MenuItem)items [index];
                MenuTracker tracker = owner.Tracker;

                if (tracker != null)
                {
                    tracker.RemoveShortcuts(item);
                }
                item.parent_menu = null;

                items.RemoveAt(index);

                UpdateItemsIndices();
                owner.OnMenuChanged(EventArgs.Empty);
            }
Ejemplo n.º 8
0
        public void HandleMenuMouseMove(MainMenu menu, int x, int y)
        {
            Point_ pt = MenuTracker.ScreenToMenu(menu, new Point_(x, y));

            HandleTitleBarMouseMove(pt.X, pt.Y);
        }
 public ContextMenu(MenuItem [] menuItems) : base(menuItems)
 {
     tracker       = new MenuTracker(this);
     right_to_left = RightToLeft.Inherit;
 }
 public ContextMenu() : base(null)
 {
     tracker       = new MenuTracker(this);
     right_to_left = RightToLeft.Inherit;
 }
Ejemplo n.º 11
0
		internal void SetForm (Form form)
		{
			this.form = form;
			Wnd = form;
			
			if (tracker == null) {
				tracker = new MenuTracker (this);
				tracker.GrabControl = form;
			}
		}
Ejemplo n.º 12
0
        static public bool TrackPopupMenu(Menu menu, Point_ pnt)
        {
            if (menu.MenuItems.Count <= 0)              // No submenus to track
            {
                return(true);
            }

            MenuTracker tracker = menu.tracker;

            tracker.active       = true;
            tracker.popup_active = true;

            // Set GrabControl
            Control src_ctrl = (tracker.TopMenu as ContextMenu).SourceControl;

            tracker.GrabControl = src_ctrl.FindForm();
            if (tracker.GrabControl == null)
            {
                tracker.GrabControl = src_ctrl.FindRootParent();
            }
            tracker.GrabControl.ActiveTracker = tracker;

            menu.Wnd          = new PopUpWindow(tracker.GrabControl, menu);
            menu.Wnd.Location = menu.Wnd.PointToClient(pnt);
            ((PopUpWindow)menu.Wnd).ShowWindow();

            bool no_quit = true;

            Object queue_id = XplatUI.StartLoop(Thread.CurrentThread);

            while ((menu.Wnd != null) && menu.Wnd.Visible && no_quit)
            {
                MSG msg = new MSG();
                no_quit = XplatUI.GetMessage(queue_id, ref msg, IntPtr.Zero, 0, 0);

                switch ((Msg)msg.message)
                {
                case Msg.WM_KEYDOWN:
                case Msg.WM_SYSKEYDOWN:
                case Msg.WM_CHAR:
                case Msg.WM_SYSCHAR:
                case Msg.WM_KEYUP:
                case Msg.WM_SYSKEYUP:
                    Control c = Control.FromHandle(msg.hwnd);
                    if (c != null)
                    {
                        Message m = Message.Create(msg.hwnd, (int)msg.message, msg.wParam, msg.lParam);
                        c.PreProcessControlMessageInternal(ref m);
                    }
                    break;

                default:
                    XplatUI.TranslateMessage(ref msg);
                    XplatUI.DispatchMessage(ref msg);
                    break;
                }
            }

            if (tracker.GrabControl.IsDisposed)
            {
                return(true);
            }

            if (!no_quit)
            {
                XplatUI.PostQuitMessage(0);
            }

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

            return(true);
        }
Ejemplo n.º 13
0
 public void HideWindow()
 {
     XplatUI.SetCursor(form.Handle, form.Cursor.handle);
     MenuTracker.HideSubPopups(menu, null);
     Hide();
 }
Ejemplo n.º 14
0
		public ContextMenu () : base (null)
		{
			tracker = new MenuTracker (this);
			right_to_left = RightToLeft.Inherit;
		}
Ejemplo n.º 15
0
        public void HandleMenuMouseUp(MainMenu menu, int x, int y)
        {
            Point pt = MenuTracker.ScreenToMenu(menu, new Point(x, y));

            HandleTitleBarUp(pt.X, pt.Y);
        }