public virtual int HitTest(MouseControllerEventArgs mouseEventArgs, IMouseController controller) { Point point = mouseEventArgs.Location; GridRangeInfo range = grid.Model.SelectedCells; if (range == null || range.IsEmpty) { return(0); } RowColumnIndex pos = grid.PointToCellRowColumnIndex(point, true); if (pos != RowColumnIndex.Empty && MoveDir != MovingDirection.None) { return(1); } VisibleLineInfo hitRow = HitRowTest(point); if (hitRow != null && !this.IsNotNested(hitRow) && range.Bottom == hitRow.LineIndex) { VisibleLineInfo column = HitColTest(point); if (column != null && range.Right == column.LineIndex) { return(1); } } return(0); }
public int HitTest(MouseEventArgs e, IMouseController controller) { lastHitTestCode = GridHitTestContext.None; if (e.Button == MouseButtons.Left) { GridRangeInfo range = grid.Selections.Ranges.ActiveRange; if (!range.IsEmpty) { Point point = new Point(e.X, e.Y); point.Offset(-delta, -delta); int rowIndex, colIndex; grid.PointToRowCol(point, out rowIndex, out colIndex); if (rowIndex == range.Bottom && colIndex == range.Right) { point.Offset(delta * 2 + 1, delta * 2 + 1); int rowIndex2, colIndex2; grid.PointToRowCol(point, out rowIndex2, out colIndex2); if (rowIndex2 != rowIndex && colIndex2 != colIndex) { lastHitTestCode = HitExcelMarker; } } } } return(lastHitTestCode); }
public int HitTest(MouseControllerEventArgs mouseEventArgs, IMouseController controller) { Point point = mouseEventArgs.Location; GridRangeInfo range = Grid.Model.SelectedCells; if (range == null || range.IsEmpty) { return(0); } RowColumnIndex pos = Grid.PointToCellRowColumnIndex(point, true); VisibleLineInfo hitRow = HitRowTest(point); if (hitRow != null && !this.IsNotNested(hitRow) && range.Bottom == hitRow.LineIndex) { VisibleLineInfo column = HitColTest(point);//Grid.ScrollColumns.GetVisibleLineAtPoint(point.X); if (column != null && range.Right == column.LineIndex) { // Grid.InvalidateCells(); return(1); } } return(0); }
private MouseController GetControllerMock(IMouseController imcon) { var mcon = Substitute.For <MouseController> (); imcon.MouseTranslation().Returns(0); imcon.MouseRotation().Returns(0); mcon.SetMouseController(imcon); return(mcon); }
/// <summary> /// Initialize a new instance of the ButtonSpecViewControllers class. /// </summary> /// <param name="mouseController">Mouse controller.</param> /// <param name="sourceController">Source controller.</param> /// <param name="keyController">Key controller.</param> public ButtonSpecViewControllers(IMouseController mouseController, ISourceController sourceController, IKeyController keyController) { Debug.Assert(mouseController != null); Debug.Assert(sourceController != null); Debug.Assert(keyController != null); _mouseController = mouseController; _sourceController = sourceController; _keyController = keyController; }
/// <summary> /// Initialize an instance of the TooltipController class. /// </summary> /// <param name="manager">Reference to manager of all tooltip functionality.</param> /// <param name="targetElement">Target element that controller is for.</param> /// <param name="targetController">Target controller that we are snooping.</param> public ToolTipController(ToolTipManager manager, ViewBase targetElement, IMouseController targetController) { Debug.Assert(manager != null); Debug.Assert(targetElement != null); // Remember incoming references _manager = manager; _targetElement = targetElement; _targetController = targetController; }
/// <summary> /// Initialize a new instance of the ButtonSpecViewControllers class. /// </summary> /// <param name="mouseController">Mouse controller.</param> /// <param name="sourceController">Source controller.</param> /// <param name="keyController">Key controller.</param> public ButtonSpecViewControllers(IMouseController mouseController, ISourceController sourceController, IKeyController keyController) { Debug.Assert(mouseController != null); Debug.Assert(sourceController != null); Debug.Assert(keyController != null); _mouseController = mouseController; _sourceController = sourceController; _keyController = keyController; }
/// <summary> /// Initialize an instance of the TooltipController class. /// </summary> /// <param name="manager">Reference to manager of all tooltip functionality.</param> /// <param name="targetElement">Target element that controller is for.</param> /// <param name="targetController">Target controller that we are snooping.</param> public ToolTipController(ToolTipManager manager, ViewBase targetElement, IMouseController targetController) { Debug.Assert(manager != null); Debug.Assert(targetElement != null); // Remember incoming references _manager = manager; _targetElement = targetElement; _targetController = targetController; }
/// <summary> /// Create a button controller for the view. /// </summary> /// <param name="viewButton">View to be controlled.</param> /// <param name="needPaint">Paint delegate.</param> /// <param name="clickHandler">Reference to click handler.</param> /// <returns>Controller instance.</returns> public virtual ButtonSpecViewControllers CreateController(ViewDrawButton viewButton, NeedPaintHandler needPaint, MouseEventHandler clickHandler) { // Create a standard button controller _controller = new ButtonController(viewButton, needPaint); _controller.BecomesFixed = true; _controller.Click += clickHandler; // If associated with a tooltip manager then pass mouse messages onto tooltip manager IMouseController mouseController = (IMouseController)_controller; if (Manager.ToolTipManager != null) { mouseController = new ToolTipController(Manager.ToolTipManager, viewButton, _controller); } // Return a collection of controllers return(new ButtonSpecViewControllers(mouseController, _controller, _controller)); }
/// <override/> public override int HitTest(MouseEventArgs e, IMouseController controller) { // This HitTest code has higher priority than "SelectCells" Point pt = new Point(e.X, e.Y); hitTestInfo = null; if (CheckMouseButtons(e) //&& e.Clicks < 2 && (controller == null || controller.Name != "ResizeCells") ) { hitTestInfo = new DragFieldHitTestInfo(grid, pt); if (hitTestInfo.hitTestResult == GridHitTestContext.None) { hitTestInfo = null; } else if (!IsOverCheckBox(hitTestInfo.rowIndex, hitTestInfo.colIndex, e)) { this._rowIndex = hitTestInfo.rowIndex; this._colIndex = hitTestInfo.colIndex; this._cellRange = hitTestInfo.cellRange; this.originBounds = grid.GridRectangleToScreen(grid.RangeInfoToRectangle(_cellRange)); this.origin = this.grid.GetGridWindow().LastMousePosition; this.fieldIndex = hitTestInfo.rowIndex; wasDragged = false; } else { hitTestInfo = null; } } if (hitTestInfo != null) { base.HitTest(e, controller); return(hitTestInfo.hitTestResult); } return(0); }
/// <summary> /// Create a button controller for the view. /// </summary> /// <param name="viewButton">View to be controlled.</param> /// <param name="needPaint">Paint delegate.</param> /// <param name="clickHandler">Reference to click handler.</param> /// <returns>Controller instance.</returns> public override ButtonSpecViewControllers CreateController(ViewDrawButton viewButton, NeedPaintHandler needPaint, MouseEventHandler clickHandler) { // Create a ribbon specific button controller ButtonSpecManagerLayoutAppButton managerAppButton = (ButtonSpecManagerLayoutAppButton)Manager; _controller = new ButtonSpecAppButtonController(managerAppButton.ViewManager, viewButton, needPaint); _controller.BecomesFixed = true; _controller.Click += clickHandler; // If associated with a tooltip manager then pass mouse messages onto tooltip manager IMouseController mouseController = (IMouseController)_controller; if (Manager.ToolTipManager != null) { mouseController = new ToolTipController(Manager.ToolTipManager, viewButton, _controller); } // Return a collection of controllers return(new ButtonSpecViewControllers(mouseController, _controller, _controller)); }
public void Load() { mouse = new MouseController(this); keyboard = new KeyboardController(this); Initialize(); this.EventSubscribe <TimePreUpdateEvent>(e => { foreach (var player in players) { var actions = (List <IInputAction>)player.Actions; foreach (InputAction action in actions) { action.Update(e.DeltaTime); } } Update(); }); }
/// <summary>Initializes a new instance of the <see cref="T:System.Object" /> class.</summary> public FluentInvoker(IMouseController mouseController, IExtendedKeyboardController keyboardController) { MouseController = mouseController; KeyboardController = keyboardController; }
protected override int OnHitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller) { if (e.Button != MouseButtons.None) { //return a cell hit so OnMouseDown will be called later return(GridHitTestContext.Cell); } else { return(0); } }
/// <summary> /// Initialize a new instance of the ViewDrawNavCheckButtonBase class. /// </summary> /// <param name="navigator">Owning navigator instance.</param> /// <param name="page">Page this check button represents.</param> /// <param name="orientation">Orientation for the check button.</param> /// <param name="stateDisabled">Source for disabled state values.</param> /// <param name="stateNormal">Source for normal state values.</param> /// <param name="stateTracking">Source for tracking state values.</param> /// <param name="statePressed">Source for pressed state values.</param> /// <param name="stateSelected">Source for selected state values.</param> /// <param name="stateFocused">Source for focused state values.</param> public ViewDrawNavCheckButtonBase(KryptonNavigator navigator, KryptonPage page, VisualOrientation orientation, IPaletteTriple stateDisabled, IPaletteTriple stateNormal, IPaletteTriple stateTracking, IPaletteTriple statePressed, IPaletteTriple stateSelected, IPaletteTriple stateFocused) : base(stateDisabled, stateNormal, stateTracking, statePressed, null, null, orientation, true) { Debug.Assert(navigator != null); Navigator = navigator; _page = page; _lastClick = DateTime.Now.AddDays(-1); // Associate the page component with this view element Component = page; // Prevent user from unchecking the selected check button AllowUncheck = false; // Set the source for values to ourself ButtonValues = this; // Create a controller for managing button behavior IMouseController controller = CreateMouseController(); MouseController = controller; // Create overrides for getting the focus values _overrideDisabled = new PaletteTripleOverride(stateFocused, stateDisabled, PaletteState.FocusOverride); _overrideNormal = new PaletteTripleOverride(stateFocused, stateNormal, PaletteState.FocusOverride); _overrideTracking = new PaletteTripleOverride(stateFocused, stateTracking, PaletteState.FocusOverride); _overridePressed = new PaletteTripleOverride(stateFocused, statePressed, PaletteState.FocusOverride); _overrideSelected = new PaletteTripleOverride(stateFocused, stateSelected, PaletteState.FocusOverride); // Push values into the base class SetPalettes(_overrideDisabled, _overrideNormal, _overrideTracking, _overridePressed); SetCheckedPalettes(_overrideSelected, _overrideSelected, _overrideSelected); // Are we allowed to add button specs to the button? if (AllowButtonSpecs) { // Create button specification collection manager ButtonSpecManager = new ButtonSpecNavManagerLayoutBar(Navigator, Navigator.InternalRedirector, Page.ButtonSpecs, null, new ViewLayoutDocker[] { LayoutDocker }, new IPaletteMetric[] { Navigator.StateCommon }, new PaletteMetricInt[] { PaletteMetricInt.PageButtonInset }, new PaletteMetricInt[] { PaletteMetricInt.PageButtonInset }, new PaletteMetricPadding[] { PaletteMetricPadding.PageButtonPadding }, Navigator.CreateToolStripRenderer, null) { // Hook up the tooltip manager so that tooltips can be generated ToolTipManager = Navigator.ToolTipManager }; // Allow derived classes to update the remapping with different values UpdateButtonSpecMapping(); } }
public static Vector2Int GetPosition(this IMouseController mouseController) { mouseController.GetPosition(out int mouseX, out int mouseY); return(new Vector2Int(mouseX, mouseY)); }
protected override int OnHitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller) { //return a nonzero so the mouse messages will be forwarded to the cell render //but don't include the cell borders so D&D can be handled if (controller != null && controller.Name == "OleDataSource") { // other controllers have higher priority than me return(0); } return(1); }
public static Vector2 GetPositionDelta(this IMouseController mouseController) { mouseController.GetPositionDelta(out float mouseX, out float mouseY); return(new Vector2(mouseX, mouseY)); }
[SetUp] public void Init() { this.imcon = GetEffectMock(); this.mcon = GetControllerMock(imcon); }
/// <implement/> public virtual int HitTest(MouseEventArgs e, IMouseController controller) { clickCellsControllerHitTest = clickCellsController.HitTest(e, controller); return(clickCellsControllerHitTest); }
public void SetMouseController(IMouseController imcon) { this.imcon = imcon; }