Ejemplo n.º 1
0
        //public string update = "";
        #endregion


        #region Mouse Handling
        void Mouse_Move(object sender, MouseMoveEventArgs e)
        {
            if (_activeWidget != null)
            {
                //first, ensure object is still in the graphic tree
                if (_activeWidget.HostContainer == null)
                {
                    activeWidget = null;
                }
                else
                {
                    //send move evt even if mouse move outside bounds
                    _activeWidget.onMouseMove(_activeWidget, e);
                    return;
                }
            }

            if (_hoverWidget != null)
            {
                //first, ensure object is still in the graphic tree
                if (_hoverWidget.HostContainer == null)
                {
                    hoverWidget = null;
                }
                else
                {
                    //check topmost graphicobject first
                    GraphicObject tmp  = _hoverWidget;
                    GraphicObject topc = null;
                    while (tmp is GraphicObject)
                    {
                        topc = tmp;
                        tmp  = tmp.Parent as GraphicObject;
                    }
                    int idxhw = GraphicObjects.IndexOf(topc);
                    if (idxhw != 0)
                    {
                        int i = 0;
                        while (i < idxhw)
                        {
                            if (GraphicObjects [i].MouseIsIn(e.Position))
                            {
                                _hoverWidget.onMouseLeave(this, e);
                                GraphicObjects [i].checkHoverWidget(e);
                                return;
                            }
                            i++;
                        }
                    }


                    if (_hoverWidget.MouseIsIn(e.Position))
                    {
                        _hoverWidget.checkHoverWidget(e);
                        return;
                    }
                    else
                    {
                        _hoverWidget.onMouseLeave(this, e);
                        //seek upward from last focused graph obj's
                        while (_hoverWidget.Parent as GraphicObject != null)
                        {
                            _hoverWidget = _hoverWidget.Parent as GraphicObject;
                            if (_hoverWidget.MouseIsIn(e.Position))
                            {
                                _hoverWidget.checkHoverWidget(e);
                                return;
                            }
                            else
                            {
                                _hoverWidget.onMouseLeave(this, e);
                            }
                        }
                    }
                }
            }

            //top level graphic obj's parsing
            for (int i = 0; i < GraphicObjects.Count; i++)
            {
                GraphicObject g = GraphicObjects[i];
                if (g.MouseIsIn(e.Position))
                {
                    g.checkHoverWidget(e);
                    PutOnTop(g);
                    return;
                }
            }
            _hoverWidget = null;
            MouseMove.Raise(this, e);
        }
Ejemplo n.º 2
0
		//public string update = "";
		#endregion


		#region Mouse Handling
		void Mouse_Move(object sender, MouseMoveEventArgs e)
		{
			if (_activeWidget != null) {
				//first, ensure object is still in the graphic tree
				if (_activeWidget.HostContainer == null) {
					activeWidget = null;
				} else {

					//send move evt even if mouse move outside bounds
					_activeWidget.onMouseMove (_activeWidget, e);
					return;
				}
			}

			if (_hoverWidget != null) {
				//first, ensure object is still in the graphic tree
				if (_hoverWidget.HostContainer == null) {
					hoverWidget = null;
				} else {
					//check topmost graphicobject first
					GraphicObject tmp = _hoverWidget;
					GraphicObject topc = null;
					while (tmp is GraphicObject) {
						topc = tmp;
						tmp = tmp.Parent as GraphicObject;
					}
					int idxhw = GraphicObjects.IndexOf (topc);
					if (idxhw != 0) {
						int i = 0;
						while (i < idxhw) {
							if (GraphicObjects [i].MouseIsIn (e.Position)) {
								_hoverWidget.onMouseLeave (this, e);
								GraphicObjects [i].checkHoverWidget (e);
								return;
							}
							i++;
						}
					}


					if (_hoverWidget.MouseIsIn (e.Position)) {
						_hoverWidget.checkHoverWidget (e);
						return;
					} else {
						_hoverWidget.onMouseLeave (this, e);
						//seek upward from last focused graph obj's
						while (_hoverWidget.Parent as GraphicObject != null) {
							_hoverWidget = _hoverWidget.Parent as GraphicObject;
							if (_hoverWidget.MouseIsIn (e.Position)) {
								_hoverWidget.checkHoverWidget (e);
								return;
							} else
								_hoverWidget.onMouseLeave (this, e);
						}
					}
				}
			}

			//top level graphic obj's parsing
			for (int i = 0; i < GraphicObjects.Count; i++) {
				GraphicObject g = GraphicObjects[i];
				if (g.MouseIsIn (e.Position)) {
					g.checkHoverWidget (e);
					PutOnTop (g);
					return;
				}
			}
			_hoverWidget = null;
			MouseMove.Raise (this, e);
		}