예제 #1
0
        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);
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
        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;
                        }
                    }
                }
            }
        }
예제 #4
0
        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;
            }
        }
예제 #5
0
        protected internal override void OnScroll(CursorInputEventArgs e)
        {
            FireEvent(Scrolled, e);

            // default handling
            base.OnCursorMove(e);
        }
예제 #6
0
        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;
            }
        }
예제 #7
0
        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));
                    }
                }
            }
        }
예제 #8
0
        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;
            }
        }
예제 #9
0
        protected internal override void OnScroll(CursorInputEventArgs e)
        {
            HandleOnScroll(GetVertScrollbar(), e.scroll);

            ++e.handled;
            base.OnScroll(e);
        }
예제 #10
0
        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;
        }
예제 #11
0
 /// <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;
     }
 }
예제 #12
0
        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;
        }
예제 #13
0
        protected internal override void OnCursorLeaves(CursorInputEventArgs e)
        {
            // base class processing
            base.OnCursorLeaves(e);

            _splitterHover = false;
            _dragSizing    = false;
            _segmentHover  = false;
            Invalidate(false);
        }
예제 #14
0
        protected internal override void OnCursorLeaves(CursorInputEventArgs e)
        {
            // deafult processing
            base.OnCursorLeaves(e);

            _hovering = false;
            Invalidate(false);

            ++e.handled;
        }
예제 #15
0
        protected internal override void OnCursorMove(CursorInputEventArgs e)
        {
            base.OnCursorMove(e);
            if (d_isItemTooltipsEnabled)
            {
                SetupTooltip(e.Position);
            }

            ++e.handled;
        }
예제 #16
0
        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;
        }
예제 #17
0
        protected internal override void OnCursorPressHold(CursorInputEventArgs e)
        {
            base.OnCursorPressHold(e);
            if (e.Source != CursorInputSource.Left)
            {
                return;
            }

            HandleSelection(e.Position, true, false, false);
            ++e.handled;
        }
예제 #18
0
        protected internal override void OnCursorMove(CursorInputEventArgs e)
        {
            if (_dragging)
            {
                FireEvent(Dragged, e);
                ++e.handled;
            }

            // default handling
            base.OnCursorMove(e);
        }
예제 #19
0
        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;
        }
예제 #20
0
        protected internal override void OnCursorActivate(CursorInputEventArgs e)
        {
            // Base class processing
            base.OnCursorActivate(e);

            if (e.Source == CursorInputSource.Left)
            {
                ReleaseInput();
                ++e.handled;
            }
        }
예제 #21
0
        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;
            }
        }
예제 #22
0
        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;
            }
        }
예제 #23
0
        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);
        }
예제 #24
0
        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;
        }
예제 #25
0
        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;
            }
        }
예제 #26
0
        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();
                }
            }
        }
예제 #27
0
        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;
            }
        }
예제 #28
0
        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;
            }
        }
예제 #29
0
        // 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;
            }
        }
예제 #30
0
        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;
            }
        }