public override void checkHoverWidget(MouseMoveEventArgs e) { base.checkHoverWidget (e); if (child != null) if (child.MouseIsIn (e.Position)) child.checkHoverWidget (e); }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove (sender, e); if (CurrentInterface.Mouse.LeftButton == ButtonState.Released) return; updateMouseLocalPos (e.Position); }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove(sender, e); Interface otkgw = IFace; if (!hoverBorder) { currentDirection = Direction.None; IFace.MouseCursor = XCursor.Default; return; } if (this.HasFocus && movable) { if (e.Mouse.IsButtonDown(MouseButton.Left)) { MoveAndResize(e.XDelta, e.YDelta, currentDirection); return; } } if (Resizable) { Direction lastDir = currentDirection; if (Math.Abs(e.Position.Y - this.Slot.Y) < Interface.BorderThreshold) { if (Math.Abs(e.Position.X - this.Slot.X) < Interface.BorderThreshold) { currentDirection = Direction.NW; } else if (Math.Abs(e.Position.X - this.Slot.Right) < Interface.BorderThreshold) { currentDirection = Direction.NE; } else { currentDirection = Direction.N; } } else if (Math.Abs(e.Position.Y - this.Slot.Bottom) < Interface.BorderThreshold) { if (Math.Abs(e.Position.X - this.Slot.X) < Interface.BorderThreshold) { currentDirection = Direction.SW; } else if (Math.Abs(e.Position.X - this.Slot.Right) < Interface.BorderThreshold) { currentDirection = Direction.SE; } else { currentDirection = Direction.S; } } else if (Math.Abs(e.Position.X - this.Slot.X) < Interface.BorderThreshold) { currentDirection = Direction.W; } else if (Math.Abs(e.Position.X - this.Slot.Right) < Interface.BorderThreshold) { currentDirection = Direction.E; } else { currentDirection = Direction.None; } if (currentDirection != lastDir) { switch (currentDirection) { case Direction.None: otkgw.MouseCursor = XCursor.Default; break; case Direction.N: otkgw.MouseCursor = XCursor.V; break; case Direction.S: otkgw.MouseCursor = XCursor.V; break; case Direction.E: otkgw.MouseCursor = XCursor.H; break; case Direction.W: otkgw.MouseCursor = XCursor.H; break; case Direction.NW: otkgw.MouseCursor = XCursor.NW; break; case Direction.NE: otkgw.MouseCursor = XCursor.NE; break; case Direction.SW: otkgw.MouseCursor = XCursor.SW; break; case Direction.SE: otkgw.MouseCursor = XCursor.SE; break; } } } }
public override void onMouseEnter(object sender, MouseMoveEventArgs e) { base.onMouseEnter (sender, e); if ((LogicalParent as Menu).AutomaticOpenning && items.Children.Count>0) IsOpened = true; }
public virtual void checkHoverWidget(MouseMoveEventArgs e) { if (CurrentInterface.HoverWidget != this) { CurrentInterface.HoverWidget = this; onMouseEnter (this, e); } this.onMouseMove (this, e);//without this, window border doesn't work, should be removed }
public virtual void onMouseLeave(object sender, MouseMoveEventArgs e) { #if DEBUG_FOCUS Debug.WriteLine("MouseLeave => " + this.ToString()); #endif MouseLeave.Raise (this, e); }
// [XmlAttributeAttribute()][DefaultValue(WindowState.Normal)] // public virtual WindowState State { // get { return _state; } // set { // if (_state == value) // return; // _state = value; // NotifyValueChanged ("State", _state); // NotifyValueChanged ("IsNormal", IsNormal); // NotifyValueChanged ("IsMaximized", IsMaximized); // NotifyValueChanged ("IsMinimized", IsMinimized); // NotifyValueChanged ("IsNotMinimized", IsNotMinimized); // } // } #endregion #region GraphicObject Overrides public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove(sender, e); Interface otkgw = CurrentInterface; if (!hoverBorder) { currentDirection = Direction.None; CurrentInterface.MouseCursor = XCursor.Default; return; } if (this.HasFocus && _movable) { if (e.Mouse.IsButtonDown(MouseButton.Left)) { int currentLeft = this.Left; int currentTop = this.Top; int currentWidth, currentHeight; if (currentLeft == 0) { currentLeft = this.Slot.Left; this.Left = currentLeft; } if (currentTop == 0) { currentTop = this.Slot.Top; this.Top = currentTop; } if (this.Width.IsFixed) { currentWidth = this.Width; } else { currentWidth = this.Slot.Width; } if (this.Height.IsFixed) { currentHeight = this.Height; } else { currentHeight = this.Slot.Height; } switch (currentDirection) { case Direction.None: this.Left = currentLeft + e.XDelta; this.Top = currentTop + e.YDelta; break; case Direction.N: this.Height = currentHeight - e.YDelta; if (this.Height == currentHeight - e.YDelta) { this.Top = currentTop + e.YDelta; } break; case Direction.S: this.Height = currentHeight + e.YDelta; break; case Direction.W: this.Width = currentWidth - e.XDelta; if (this.Width == currentWidth - e.XDelta) { this.Left = currentLeft + e.XDelta; } break; case Direction.E: this.Width = currentWidth + e.XDelta; break; case Direction.NW: this.Height = currentHeight - e.YDelta; if (this.Height == currentHeight - e.YDelta) { this.Top = currentTop + e.YDelta; } this.Width = currentWidth - e.XDelta; if (this.Width == currentWidth - e.XDelta) { this.Left = currentLeft + e.XDelta; } break; case Direction.NE: this.Height = currentHeight - e.YDelta; if (this.Height == currentHeight - e.YDelta) { this.Top = currentTop + e.YDelta; } this.Width = currentWidth + e.XDelta; break; case Direction.SW: this.Width = currentWidth - e.XDelta; if (this.Width == currentWidth - e.XDelta) { this.Left = currentLeft + e.XDelta; } this.Height = currentHeight + e.YDelta; break; case Direction.SE: this.Height = currentHeight + e.YDelta; this.Width = currentWidth + e.XDelta; break; } return; } } if (Resizable) { Direction lastDir = currentDirection; if (Math.Abs(e.Position.Y - this.Slot.Y) < Interface.BorderThreshold) { if (Math.Abs(e.Position.X - this.Slot.X) < Interface.BorderThreshold) { currentDirection = Direction.NW; } else if (Math.Abs(e.Position.X - this.Slot.Right) < Interface.BorderThreshold) { currentDirection = Direction.NE; } else { currentDirection = Direction.N; } } else if (Math.Abs(e.Position.Y - this.Slot.Bottom) < Interface.BorderThreshold) { if (Math.Abs(e.Position.X - this.Slot.X) < Interface.BorderThreshold) { currentDirection = Direction.SW; } else if (Math.Abs(e.Position.X - this.Slot.Right) < Interface.BorderThreshold) { currentDirection = Direction.SE; } else { currentDirection = Direction.S; } } else if (Math.Abs(e.Position.X - this.Slot.X) < Interface.BorderThreshold) { currentDirection = Direction.W; } else if (Math.Abs(e.Position.X - this.Slot.Right) < Interface.BorderThreshold) { currentDirection = Direction.E; } else { currentDirection = Direction.None; } if (currentDirection != lastDir) { switch (currentDirection) { case Direction.None: otkgw.MouseCursor = XCursor.Default; break; case Direction.N: otkgw.MouseCursor = XCursor.V; break; case Direction.S: otkgw.MouseCursor = XCursor.V; break; case Direction.E: otkgw.MouseCursor = XCursor.H; break; case Direction.W: otkgw.MouseCursor = XCursor.H; break; case Direction.NW: otkgw.MouseCursor = XCursor.NW; break; case Direction.NE: otkgw.MouseCursor = XCursor.NE; break; case Direction.SW: otkgw.MouseCursor = XCursor.SW; break; case Direction.SE: otkgw.MouseCursor = XCursor.SE; break; } } } }
public override void onMouseLeave(object sender, MouseMoveEventArgs e) { base.onMouseLeave (sender, e); CurrentInterface.MouseCursor = XCursor.Default; }
public override void onMouseLeave(object sender, MouseMoveEventArgs e) { base.onMouseLeave (sender, e); AutomaticOpenning = false; }
protected void onBorderMouseEnter(object sender, MouseMoveEventArgs e) { hoverBorder = true; }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove (sender, e); Interface otkgw = CurrentInterface; if (!hoverBorder) { currentDirection = Direction.None; CurrentInterface.MouseCursor = XCursor.Default; return; } if (this.HasFocus && _movable) { if (e.Mouse.IsButtonDown (MouseButton.Left)) { int currentLeft = this.Left; int currentTop = this.Top; int currentWidth, currentHeight; if (currentLeft == 0) { currentLeft = this.Slot.Left; this.Left = currentLeft; } if (currentTop == 0) { currentTop = this.Slot.Top; this.Top = currentTop; } if (this.Width.IsFixed) currentWidth = this.Width; else currentWidth = this.Slot.Width; if (this.Height.IsFixed) currentHeight = this.Height; else currentHeight = this.Slot.Height; switch (currentDirection) { case Direction.None: this.Left = currentLeft + e.XDelta; this.Top = currentTop + e.YDelta; break; case Direction.N: this.Height = currentHeight - e.YDelta; if (this.Height == currentHeight - e.YDelta) this.Top = currentTop + e.YDelta; break; case Direction.S: this.Height = currentHeight + e.YDelta; break; case Direction.W: this.Width = currentWidth - e.XDelta; if (this.Width == currentWidth - e.XDelta) this.Left = currentLeft + e.XDelta; break; case Direction.E: this.Width = currentWidth + e.XDelta; break; case Direction.NW: this.Height = currentHeight - e.YDelta; if (this.Height == currentHeight - e.YDelta) this.Top = currentTop + e.YDelta; this.Width = currentWidth - e.XDelta; if (this.Width == currentWidth - e.XDelta) this.Left = currentLeft + e.XDelta; break; case Direction.NE: this.Height = currentHeight - e.YDelta; if (this.Height == currentHeight - e.YDelta) this.Top = currentTop + e.YDelta; this.Width = currentWidth + e.XDelta; break; case Direction.SW: this.Width = currentWidth - e.XDelta; if (this.Width == currentWidth - e.XDelta) this.Left = currentLeft + e.XDelta; this.Height = currentHeight + e.YDelta; break; case Direction.SE: this.Height = currentHeight + e.YDelta; this.Width = currentWidth + e.XDelta; break; } return; } } // GraphicObject firstFocusableAncestor = otkgw.hoverWidget; // while (firstFocusableAncestor != this) { // if (firstFocusableAncestor == null) // return; // if (firstFocusableAncestor.Focusable) // return; // firstFocusableAncestor = firstFocusableAncestor.Parent as GraphicObject; // } if (Resizable) { Direction lastDir = currentDirection; if (Math.Abs (e.Position.Y - this.Slot.Y) < Interface.BorderThreshold) { if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold) currentDirection = Direction.NW; else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold) currentDirection = Direction.NE; else currentDirection = Direction.N; } else if (Math.Abs (e.Position.Y - this.Slot.Bottom) < Interface.BorderThreshold) { if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold) currentDirection = Direction.SW; else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold) currentDirection = Direction.SE; else currentDirection = Direction.S; } else if (Math.Abs (e.Position.X - this.Slot.X) < Interface.BorderThreshold) currentDirection = Direction.W; else if (Math.Abs (e.Position.X - this.Slot.Right) < Interface.BorderThreshold) currentDirection = Direction.E; else currentDirection = Direction.None; if (currentDirection != lastDir) { switch (currentDirection) { case Direction.None: otkgw.MouseCursor = XCursor.Default; break; case Direction.N: otkgw.MouseCursor = XCursor.V; break; case Direction.S: otkgw.MouseCursor = XCursor.V; break; case Direction.E: otkgw.MouseCursor = XCursor.H; break; case Direction.W: otkgw.MouseCursor = XCursor.H; break; case Direction.NW: otkgw.MouseCursor = XCursor.NW; break; case Direction.NE: otkgw.MouseCursor = XCursor.NE; break; case Direction.SW: otkgw.MouseCursor = XCursor.SW; break; case Direction.SE: otkgw.MouseCursor = XCursor.SE; break; } } } }
//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); }
public override void onMouseLeave(object sender, MouseMoveEventArgs e) { base.onMouseLeave(sender, e); AutomaticOpenning = false; }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove(sender, e); if (!IsActive) { return; } GenericStack gs = Parent as GenericStack; int newDelta = delta, size1 = init1, size2 = init2; if (gs.Orientation == Orientation.Horizontal) { newDelta -= e.XDelta; if (size1 < 0) { size1 = go1.Slot.Width + delta; } if (size2 < 0) { size2 = go2.Slot.Width - delta; } } else { newDelta -= e.YDelta; if (size1 < 0) { size1 = go1.Slot.Height + delta; } if (size2 < 0) { size2 = go2.Slot.Height - delta; } } if (size1 - newDelta < min1 || (max1 > 0 && size1 - newDelta > max1) || size2 + newDelta < min2 || (max2 > 0 && size2 + newDelta > max2)) { return; } delta = newDelta; if (gs.Orientation == Orientation.Horizontal) { if (init1 >= 0) { go1.Width = init1 - delta; } if (init2 >= 0) { go2.Width = init2 + delta; } } else { if (init1 >= 0) { go1.Height = init1 - delta; } if (init2 >= 0) { go2.Height = init2 + delta; } } }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { if (IsDropTarget) { DockWindow dw = IFace.DragAndDropOperation.DragSource as DockWindow; if (dw.IsDocked) { base.onMouseMove(sender, e); return; } Alignment curDockPos = dw.DockingPosition; dw.DockingPosition = Alignment.Undefined; Rectangle cb = ClientRectangle; Point lm = ScreenPointToLocal(e.Position); if (Children.Count == 0) { Rectangle r = cb; r.Inflate(r.Width / -5, r.Height / -5); if (r.ContainsOrIsEqual(lm)) { dw.DockingPosition = Alignment.Center; } } else { rIn = cb; if (Orientation == Orientation.Horizontal || Children.Count == 1) { if (lm.Y > cb.Top + cb.Height / 3 && lm.Y < cb.Bottom - cb.Height / 3) { if (lm.X < cb.Left + cb.Width / 3) { dw.DockingPosition = Alignment.Left; } else if (lm.X > cb.Right - cb.Width / 3) { dw.DockingPosition = Alignment.Right; } } else { getFocusedChild(lm); if (focusedChild != null) { if (lm.Y < rIn.Top + rIn.Height / 3) { dw.DockingPosition = Alignment.Top; } else if (lm.Y > rIn.Bottom - rIn.Height / 3) { dw.DockingPosition = Alignment.Bottom; } } } } if (Orientation == Orientation.Vertical || Children.Count == 1) { if (lm.X > cb.Left + cb.Width / 3 && lm.X < cb.Right - cb.Width / 3) { if (lm.Y < cb.Top + cb.Height / 3) { dw.DockingPosition = Alignment.Top; } else if (lm.Y > cb.Bottom - cb.Height / 3) { dw.DockingPosition = Alignment.Bottom; } } else { getFocusedChild(lm); if (focusedChild != null) { if (lm.X < rIn.Left + rIn.Width / 3) { dw.DockingPosition = Alignment.Left; } else if (lm.X > rIn.Right - rIn.Width / 3) { dw.DockingPosition = Alignment.Right; } } } } } if (curDockPos != dw.DockingPosition) { RegisterForGraphicUpdate(); } } base.onMouseMove(sender, e); }
protected virtual void onBorderMouseEnter(object sender, MouseMoveEventArgs e) { hoverBorder = true; }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { savedMousePos.X += e.XDelta; savedMousePos.Y += e.YDelta; base.onMouseMove (sender, new MouseMoveEventArgs(savedMousePos.X,savedMousePos.Y,e.XDelta,e.YDelta)); }
protected void onBorderMouseLeave(object sender, MouseMoveEventArgs e) { hoverBorder = false; currentDirection = Direction.None; CurrentInterface.MouseCursor = XCursor.Default; }
public override void onMouseEnter(object sender, MouseMoveEventArgs e) { base.onMouseEnter (sender, e); if (Selectable) CurrentInterface.MouseCursor = XCursor.Text; }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove(sender, e); if (!IsActive) { return; } GenericStack gs = Parent as GenericStack; int ptrSplit = gs.Children.IndexOf(this); if (ptrSplit == 0 || ptrSplit == gs.Children.Count - 1) { return; } if (gs.Orientation == Orientation.Horizontal) { if ((gs.Children [ptrSplit - 1].Width + e.XDelta < gs.Children [ptrSplit - 1].MinimumSize.Width) || (gs.Children [ptrSplit + 1].Width - e.XDelta < gs.Children [ptrSplit + 1].MinimumSize.Width)) { return; } if (!gs.Children [ptrSplit - 1].Width.IsFixed) { gs.Children [ptrSplit - 1].Width = gs.Children [ptrSplit - 1].Slot.Width; } if (!gs.Children [ptrSplit + 1].Width.IsFixed) { gs.Children [ptrSplit + 1].Width = gs.Children [ptrSplit + 1].Slot.Width; } gs.Children [ptrSplit - 1].Width = gs.Children [ptrSplit - 1].Width + e.XDelta; gs.Children [ptrSplit + 1].Width = gs.Children [ptrSplit + 1].Width - e.XDelta; } else { if ((gs.Children [ptrSplit - 1].Height + e.YDelta < gs.Children [ptrSplit - 1].MinimumSize.Height) || (gs.Children [ptrSplit + 1].Height - e.YDelta < gs.Children [ptrSplit + 1].MinimumSize.Height)) { return; } if (!gs.Children [ptrSplit - 1].Height.IsFixed) { gs.Children [ptrSplit - 1].Height = gs.Children [ptrSplit - 1].Slot.Height; } if (!gs.Children [ptrSplit + 1].Height.IsFixed) { gs.Children [ptrSplit + 1].Height = gs.Children [ptrSplit + 1].Slot.Height; } gs.Children [ptrSplit - 1].Height = gs.Children [ptrSplit - 1].Height + e.YDelta; gs.Children [ptrSplit + 1].Height = gs.Children [ptrSplit + 1].Height - e.YDelta; } }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove (sender, e); if (!(SelectionInProgress && HasFocus && _selectable)) return; updatemouseLocalPos (e.Position); RegisterForRedraw(); }
public override void onMouseEnter(object sender, MouseMoveEventArgs e) { base.onMouseEnter (sender, e); if ((Parent as GenericStack).Orientation == Orientation.Horizontal) CurrentInterface.MouseCursor = XCursor.H; else CurrentInterface.MouseCursor = XCursor.V; }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove (sender, e); if (!IsActive) return; GenericStack gs = Parent as GenericStack; int newDelta = delta, size1 = init1 , size2 = init2; if (gs.Orientation == Orientation.Horizontal) { newDelta -= e.XDelta; if (size1 < 0) size1 = go1.Slot.Width + delta; if (size2 < 0) size2 = go2.Slot.Width - delta; } else { newDelta -= e.YDelta; if (size1 < 0) size1 = go1.Slot.Height + delta; if (size2 < 0) size2 = go2.Slot.Height - delta; } if (size1 - newDelta < min1 || (max1 > 0 && size1 - newDelta > max1) || size2 + newDelta < min2 || (max2 > 0 && size2 + newDelta > max2)) return; delta = newDelta; if (gs.Orientation == Orientation.Horizontal) { if (init1 >= 0) go1.Width = init1 - delta; if (init2 >= 0) go2.Width = init2 + delta; } else { if (init1 >= 0) go1.Height = init1 - delta; if (init2 >= 0) go2.Height = init2 + delta; } }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { if (holdCursor) { if (_orientation == Orientation.Horizontal) Value += (double)e.XDelta / unity; else Value += (double)e.YDelta / unity; } base.onMouseMove (sender, e); }
public virtual void onMouseMove(object sender, MouseMoveEventArgs e) { //bubble event to the top GraphicObject p = Parent as GraphicObject; if (p != null) p.onMouseMove(sender,e); MouseMove.Raise (sender, e); }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { savedMousePos.X += e.XDelta; savedMousePos.Y += e.YDelta; base.onMouseMove(sender, new MouseMoveEventArgs(savedMousePos.X, savedMousePos.Y, e.XDelta, e.YDelta)); }
/// <summary> /// Constructs a new <see cref="MouseMoveEventArgs"/> instance. /// </summary> /// <param name="args">The <see cref="MouseMoveEventArgs"/> instance to clone.</param> public MouseMoveEventArgs(MouseMoveEventArgs args) : this(args.X, args.Y, args.XDelta, args.YDelta) { }
public override void onMouseLeave(object sender, MouseMoveEventArgs e) { base.onMouseLeave(sender, e); CurrentInterface.MouseCursor = XCursor.Default; }
public override void onMouseLeave(object sender, MouseMoveEventArgs e) { if (IsOpened) IsOpened = false; base.onMouseLeave (this, e); }
public override void onMouseLeave(object sender, MouseMoveEventArgs e) { base.onMouseLeave(sender, e); IsPopped = false; }
protected virtual void onBorderMouseLeave(object sender, MouseMoveEventArgs e) { hoverBorder = false; currentDirection = Direction.None; IFace.MouseCursor = XCursor.Default; }
public override void checkHoverWidget(MouseMoveEventArgs e) { if (CurrentInterface.HoverWidget != this) { CurrentInterface.HoverWidget = this; onMouseEnter (this, e); } if (SelectedTab > Children.Count - 1) return; if (((Children[SelectedTab] as TabItem).Content.Parent as GraphicObject).MouseIsIn(e.Position)) { Children[SelectedTab].checkHoverWidget (e); return; } for (int i = Children.Count - 1; i >= 0; i--) { TabItem ti = Children [i] as TabItem; if (ti.TabTitle.MouseIsIn(e.Position)) { Children[i].checkHoverWidget (e); return; } } }
public override void checkHoverWidget(MouseMoveEventArgs e) { savedMousePos = e.Position; Point m = e.Position - new Point ((int)ScrollX, (int)ScrollY); base.checkHoverWidget (new MouseMoveEventArgs(m.X,m.Y,e.XDelta,e.YDelta)); }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove (sender, e); if (!(HasFocus&&holdCursor)) return; TabView tv = Parent as TabView; TabItem previous = null, next = null; int tmp = TabOffset + e.XDelta; if (tmp < tv.Spacing) TabOffset = tv.Spacing; else if (tmp > Parent.getSlot ().Width - TabTitle.Slot.Width - tv.Spacing) TabOffset = Parent.getSlot ().Width - TabTitle.Slot.Width - tv.Spacing; else{ int idx = tv.Children.IndexOf (this); if (idx > 0 && e.XDelta < 0) { previous = tv.Children [idx - 1] as TabItem; if (tmp < previous.TabOffset + previous.TabTitle.Slot.Width / 2) { tv.Children.RemoveAt (idx); tv.Children.Insert (idx - 1, this); tv.SelectedTab = idx - 1; tv.UpdateLayout (LayoutingType.ArrangeChildren); } }else if (idx < tv.Children.Count - 1 && e.XDelta > 0) { next = tv.Children [idx + 1] as TabItem; if (tmp > next.TabOffset - next.TabTitle.Slot.Width / 2){ tv.Children.RemoveAt (idx); tv.Children.Insert (idx + 1, this); tv.SelectedTab = idx + 1; tv.UpdateLayout (LayoutingType.ArrangeChildren); } } TabOffset = tmp; } }
public override void onMouseMove(object sender, MouseMoveEventArgs e) { base.onMouseMove(sender, e); if (Parent == null) { return; } if (!IsDragged) { return; } TabView tv = Parent as TabView; if (Math.Abs(e.Position.Y - dragStartPoint.Y) > dragThreshold || Math.Abs(e.Position.X - dragStartPoint.X) > dragThreshold) { makeFloating(tv); return; } Rectangle cb = ClientRectangle; int tmp = TabOffset + e.XDelta; if (tmp < tview.LeftSlope) { TabOffset = tview.LeftSlope; } else if (tmp > cb.Width - tv.RightSlope - tv.TabWidth) { TabOffset = cb.Width - tv.RightSlope - tv.TabWidth; } else { dragStartPoint.X = e.Position.X; TabItem[] tabItms = tv.Children.Cast <TabItem>().OrderBy(t => t.ViewIndex).ToArray(); if (ViewIndex > 0 && e.XDelta < 0) { TabItem previous = tabItms [ViewIndex - 1]; if (tmp < previous.TabOffset + tview.TabWidth / 2) { previous.ViewIndex = ViewIndex; ViewIndex--; tv.UpdateLayout(LayoutingType.ArrangeChildren); } } else if (ViewIndex < tabItms.Length - 1 && e.XDelta > 0) { TabItem next = tabItms [ViewIndex + 1]; if (tmp > next.TabOffset - tview.TabWidth / 2) { next.ViewIndex = ViewIndex; ViewIndex++; tv.UpdateLayout(LayoutingType.ArrangeChildren); } } TabOffset = tmp; } }