protected internal override void OnCursorActivate(CursorInputEventArgs e) { if ((e.Source == CursorInputSource.Left) && IsPushed()) { var sheet = GetGUIContext().GetRootWindow(); if (sheet != null) { // if mouse was released over this widget // (use mouse position, as e.position has been unprojected) if (this == sheet.GetTargetChildAtPosition(GetGUIContext().GetCursor().GetPosition())) { // fire event OnClicked(new WindowEventArgs(this)); } } ++e.handled; } else if (e.Source == CursorInputSource.Middle) { _dragging = false; ReleaseInput(); ++e.handled; } // default handling base.OnCursorActivate(e); }
protected internal override void OnCursorPressHold(CursorInputEventArgs e) { // base class handling base.OnCursorPressHold(e); if (e.Source == CursorInputSource.Left) { // grab inputs if (CaptureInput()) { // handle cursor press ClearSelection(); _dragging = true; _dragAnchorIdx = GetTextIndexFromPosition(e.Position); #if CEGUI_BIDI_SUPPORT if (d_bidiVisualMapping.GetV2lMapping().Count > _dragAnchorIdx) { _dragAnchorIdx = d_bidiVisualMapping.GetV2lMapping()[_dragAnchorIdx]; } #endif SetCaretIndex(_dragAnchorIdx); } ++e.handled; } }
protected internal override void OnCursorPressHold(CursorInputEventArgs e) { // default processing (this is now essential as it controls event firing). base.OnCursorPressHold(e); if (e.Source == CursorInputSource.Left) { if (IsSizingEnabled()) { // get position of mouse as co-ordinates local to this window. var localPos = CoordConverter.ScreenToWindow(this, e.Position); // if the mouse is on the sizing border if (GetSizingBorderAtPoint(localPos) != SizingLocation.SizingNone) { // ensure all inputs come to us for now if (CaptureInput()) { // setup the 'dragging' state variables _beingSized = true; _dragPoint = localPos; // do drag-sizing started notification OnDragSizingStarted(new WindowEventArgs(this)); ++e.handled; } } } } }
protected internal override void OnCursorActivate(CursorInputEventArgs e) { base.OnCursorActivate(e); if (e.Source == CursorInputSource.Left) { if (_dragging) { // release picked up state if (_pickedUp) { _pickedUp = false; } // fire off event OnDragEnded(new WindowEventArgs(this)); } // check for sticky pick up else if (_stickyMode && !_pickedUp) { InitialiseDragging(); _pickedUp = true; // in this case, do not proceed to release inputs. return; } // release our capture on the input data ReleaseInput(); ++e.handled; } }
protected internal override void OnScroll(CursorInputEventArgs e) { FireEvent(Scrolled, e); // default handling base.OnCursorMove(e); }
protected internal override void OnCursorPressHold(CursorInputEventArgs e) { // base class processing base.OnCursorPressHold(e); if (e.Source == CursorInputSource.Left) { // ensure all inputs come to us for now if (CaptureInput()) { // get position of mouse as co-ordinates local to this window. var localPos = CoordConverter.ScreenToWindow(this, e.Position); // store drag point for possible sizing or moving operation. _dragPoint = localPos; // if the mouse is in the sizing area if (_splitterHover) { if (IsSizingEnabled()) { // setup the 'dragging' state variables _dragSizing = true; } } else { _segmentPushed = true; } } ++e.handled; } }
protected internal override void OnCursorMove(CursorInputEventArgs e) { base.OnCursorMove(e); // get position of mouse as co-ordinates local to this window. var localMousePos = CoordConverter.ScreenToWindow(this, e.Position); // handle dragging if (_dragging) { DoDragging(localMousePos); } // not dragging else { // if mouse button is down (but we're not yet being dragged) if (_leftPointerHeld) { if (IsDraggingThresholdExceeded(localMousePos)) { // Trigger the event OnDragStarted(new WindowEventArgs(this)); } } } }
protected internal override void OnCursorActivate(CursorInputEventArgs e) { base.OnCursorActivate(e); if (e.Source == CursorInputSource.Left) { if (_armed && (GetChildAtPosition(e.Position) == null)) { // if something was selected, confirm that selection. if (GetIndexSelectionStates().Any()) { OnListSelectionAccepted(new WindowEventArgs(this)); } ReleaseInput(); } else { // if we are not already armed, in response to a left button up event, we auto-arm. _armed = true; } ++e.handled; } }
protected internal override void OnScroll(CursorInputEventArgs e) { HandleOnScroll(GetVertScrollbar(), e.scroll); ++e.handled; base.OnScroll(e); }
protected internal override void OnCursorMove(CursorInputEventArgs e) { // default processing base.OnCursorMove(e); // only react if we are being dragged if (_beingDragged) { var parentSize = GetParentPixelSize(); var delta = CoordConverter.ScreenToWindow(this, e.Position); var hmin = _horzMin; var hmax = _horzMax; var vmin = _vertMin; var vmax = _vertMax; // calculate amount of movement delta -= _dragPoint; delta.X /= parentSize.Width; delta.Y /= parentSize.Height; // // Calculate new (pixel) position for thumb // var newPos = GetPosition(); if (_horzFree) { newPos.d_x.d_scale += delta.X; // limit value to within currently set range newPos.d_x.d_scale = (newPos.d_x.d_scale < hmin) ? hmin : (newPos.d_x.d_scale > hmax) ? hmax : newPos.d_x.d_scale; } if (_vertFree) { newPos.d_y.d_scale += delta.Y; // limit new position to within currently set range newPos.d_y.d_scale = (newPos.d_y.d_scale < vmin) ? vmin : (newPos.d_y.d_scale > vmax) ? vmax : newPos.d_y.d_scale; } // update thumb position if needed if (newPos != GetPosition()) { SetPosition(newPos); // send notification as required if (_hotTrack) { OnThumbPositionChanged(new WindowEventArgs(this)); } } } ++e.handled; }
/// <summary> /// helper to update mouse input handled state /// </summary> /// <param name="e"></param> protected void UpdatePointerEventHandled(CursorInputEventArgs e) { // by default, if we are a root window (no parent) with pass-though enabled // we do /not/ mark mouse events as handled. if (d_parent == null && e.handled != 0 && _cursorPassThroughEnabled) { --e.handled; } }
protected internal override void OnCursorMove(CursorInputEventArgs e) { // default processing (this is now essential as it controls event firing). base.OnCursorMove(e); // if we are not the window containing the mouse, do NOT change the cursor if (GetGUIContext().GetWindowContainingCursor() != this) { return; } if (IsSizingEnabled()) { var localMousePos = CoordConverter.ScreenToWindow(this, e.Position); if (_beingSized) { var dragEdge = GetSizingBorderAtPoint(_dragPoint); // calculate sizing deltas... var deltaX = localMousePos.X - _dragPoint.X; var deltaY = localMousePos.Y - _dragPoint.Y; var newArea = d_area; var topLeftSizing = false; // size left or right edges if (IsLeftSizingLocation(dragEdge)) { topLeftSizing |= MoveLeftEdge(deltaX, ref newArea); } else if (IsRightSizingLocation(dragEdge)) { topLeftSizing |= MoveRightEdge(deltaX, ref newArea); } // size top or bottom edges if (IsTopSizingLocation(dragEdge)) { topLeftSizing |= MoveTopEdge(deltaY, ref newArea); } else if (IsBottomSizingLocation(dragEdge)) { topLeftSizing |= MoveBottomEdge(deltaY, ref newArea); } SetAreaImpl(newArea.d_min, newArea.Size, topLeftSizing); } else { SetCursorForPoint(localMousePos); } } // mark event as handled ++e.handled; }
protected internal override void OnCursorLeaves(CursorInputEventArgs e) { // base class processing base.OnCursorLeaves(e); _splitterHover = false; _dragSizing = false; _segmentHover = false; Invalidate(false); }
protected internal override void OnCursorLeaves(CursorInputEventArgs e) { // deafult processing base.OnCursorLeaves(e); _hovering = false; Invalidate(false); ++e.handled; }
protected internal override void OnCursorMove(CursorInputEventArgs e) { base.OnCursorMove(e); if (d_isItemTooltipsEnabled) { SetupTooltip(e.Position); } ++e.handled; }
protected void /*bool*/ HandleWheeledPane(object sender, CursorInputEventArgs e) { var butPane = GetTabButtonPane(); var delta = butPane.GetOuterRectClipper().Width / 20f; d_firstTabOffset += e.scroll * delta; PerformChildWindowLayout(); // TODO: return true; }
protected internal override void OnCursorPressHold(CursorInputEventArgs e) { base.OnCursorPressHold(e); if (e.Source != CursorInputSource.Left) { return; } HandleSelection(e.Position, true, false, false); ++e.handled; }
protected internal override void OnCursorMove(CursorInputEventArgs e) { if (_dragging) { FireEvent(Dragged, e); ++e.handled; } // default handling base.OnCursorMove(e); }
protected internal override void OnScroll(CursorInputEventArgs e) { // base class processing base.OnScroll(e); // scroll by e.wheelChange * stepSize SetScrollPosition(_position + _stepSize * -e.scroll); // ensure the message does not go to our parent. ++e.handled; }
protected internal override void OnCursorActivate(CursorInputEventArgs e) { // Base class processing base.OnCursorActivate(e); if (e.Source == CursorInputSource.Left) { ReleaseInput(); ++e.handled; } }
protected internal override void OnCursorActivate(CursorInputEventArgs e) { // default processing (this is now essential as it controls event firing). base.OnCursorActivate(e); if (e.Source == CursorInputSource.Left && IsCapturedByThis()) { // release our capture on the input data ReleaseInput(); ++e.handled; } }
protected internal override void OnCursorActivate(CursorInputEventArgs e) { // default processing base.OnCursorActivate(e); if (e.Source == CursorInputSource.Left) { ReleaseInput(); // event was handled by us. ++e.handled; } }
protected internal override void OnCursorPressHold(CursorInputEventArgs e) { if (e.Source == CursorInputSource.Middle) { CaptureInput(); ++e.handled; _dragging = true; FireEvent(Dragged, e); } // default handling base.OnCursorPressHold(e); }
protected internal override void OnCursorMove(CursorInputEventArgs e) { // this is needed to discover whether mouse is in the widget area or not. // The same thing used to be done each frame in the rendering method, // but in this version the rendering method may not be called every frame // so we must discover the internal widget state here - which is actually // more efficient anyway. // base class processing base.OnCursorMove(e); UpdateInternalState(e.Position); ++e.handled; }
protected internal override void OnCursorPressHold(CursorInputEventArgs e) { // default processing base.OnCursorPressHold(e); if (e.Source == CursorInputSource.Left) { // initialise the dragging state _beingDragged = true; _dragPoint = CoordConverter.ScreenToWindow(this, e.Position); // trigger tracking started event OnThumbTrackStarted(new WindowEventArgs(this)); ++e.handled; } }
protected internal override void OnCursorMove(CursorInputEventArgs e) { base.OnCursorMove(e); // if mouse is within our area (but not our children) if (IsHit(e.Position)) { if (GetChildAtPosition(e.Position) == null) { // handle auto-arm if (_autoArm) { _armed = true; } if (_armed) { // check for an item under the mouse StandardItem item = d_itemModel.GetItemForIndex(IndexAt(e.Position)); // if an item is under cursor, select it if (item != null) { SetIndexSelectionState(item, true); } else { ClearSelections(); } } } ++e.handled; } else { // not within the list area // if left mouse button is down, clear any selection if (e.state.IsHeld(CursorInputSource.Left)) { ClearSelections(); } } }
protected internal override void OnCursorPressHold(CursorInputEventArgs e) { // default processing base.OnCursorPressHold(e); if (e.Source == CursorInputSource.Left) { if (CaptureInput()) { _pushed = true; UpdateInternalState(e.Position); Invalidate(false); } // event was handled by us. ++e.handled; } }
protected internal override void OnCursorPressHold(CursorInputEventArgs e) { // base class processing base.OnCursorPressHold(e); if (e.Source == CursorInputSource.Left) { var adj = GetAdjustDirectionFromPoint(e.Position); // adjust slider position in whichever direction as required. if (Math.Abs(adj) > float.Epsilon) { SetCurrentValue(_value + adj * _step); } ++e.handled; } }
// TODO: Destructor for Titlebar base class. // TODO: virtual ~Titlebar() {} protected internal override void OnCursorMove(CursorInputEventArgs e) { // Base class processing. base.OnCursorMove(e); if (_dragging && (d_parent != null)) { var delta = CoordConverter.ScreenToWindow(this, e.Position); // calculate amount that window has been moved delta -= _dragPoint; // move the window. *** Again: Titlebar objects should only be attached to FrameWindow derived classes. *** ((FrameWindow)d_parent).OffsetPixelPosition(delta); ++e.handled; } }
protected internal override void OnCursorPressHold(CursorInputEventArgs e) { base.OnCursorPressHold(e); if (e.Source == CursorInputSource.Left) { if (!IsHit(e.Position)) { ClearSelections(); ReleaseInput(); } else { _armed = true; } ++e.handled; } }