protected virtual void Scroll(ScrollAmount amount)
        {
            if (!IsScrollable) return;

            scrollPattern.ScrollHorizontal(amount);
            actionListener.ActionPerformed(Action.WindowMessage);
        }
示例#2
0
 protected virtual void Scroll(ScrollAmount amount)
 {
     if (!IsScrollable) return;
     switch (amount)
     {
         case ScrollAmount.LargeDecrement:
             ScrollPattern.SetScrollPercent(
                 ScrollPattern.Current.HorizontalScrollPercent,
                 ValidPercentage(ScrollPattern.Current.VerticalScrollPercent - ScrollPercentage));
             break;
         case ScrollAmount.SmallDecrement:
             ScrollPattern.SetScrollPercent(
                 ScrollPattern.Current.HorizontalScrollPercent,
                 ValidPercentage(ScrollPattern.Current.VerticalScrollPercent - SmallPercentage()));
             break;
         case ScrollAmount.LargeIncrement:
             ScrollPattern.SetScrollPercent(
                 ScrollPattern.Current.HorizontalScrollPercent,
                 ValidPercentage(ScrollPattern.Current.VerticalScrollPercent + ScrollPercentage));
             break;
         case ScrollAmount.SmallIncrement:
             ScrollPattern.SetScrollPercent(
                 ScrollPattern.Current.HorizontalScrollPercent,
                 ValidPercentage(ScrollPattern.Current.VerticalScrollPercent + SmallPercentage()));
             break;
     }
     actionListener.ActionPerformed(Action.Scroll);
 }
示例#3
0
		// Method used by ScrollViewerAutomationPeer to IScrollProvider.Scroll
		internal void InvokeByAmount (ScrollAmount amount)
		{
			CacheChildren ();

			if (children == null || amount == ScrollAmount.NoAmount)
				return;

			// 0 = First button  - Small decrement
			// 1 = Second button - Large decrement
			// 2 = Thumb 
			// 3 = Third button  - Large increment
			// 4 = Fourth button - Small increment
			int index = -1;
			switch (amount) {
			case ScrollAmount.LargeIncrement:
				index = 3;
				break;
			case ScrollAmount.SmallIncrement:
				index = 4;
				break;
			case ScrollAmount.LargeDecrement:
				index = 1;
				break;
			case ScrollAmount.SmallDecrement:
				index = 0;
				break;
			}

			IInvokeProvider invokeProvider 
				= (IInvokeProvider) children [index].GetPattern (PatternInterface.Invoke);
			if (invokeProvider != null)
				invokeProvider.Invoke ();
		}
示例#4
0
文件: Document.cs 项目: mono/uia2atk
		public void ScrollVertical (ScrollAmount amount, bool log)
		{
			if (log)
				procedureLogger.Action (string.Format ("Scroll {0} vertically..", amount.ToString ()));

			ScrollPattern sp = (ScrollPattern) element.GetCurrentPattern (ScrollPattern.Pattern);
			sp.ScrollVertical (amount);
		}
示例#5
0
		public void Scroll (ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
		{
			try {
				pattern.Scroll (horizontalAmount, verticalAmount);
			} catch (Exception ex) {
				throw DbusExceptionTranslator.Translate (ex);
			}
		}
示例#6
0
文件: Document.cs 项目: mono/uia2atk
		public void Scroll (ScrollAmount horizontalAmount, ScrollAmount verticalAmount, bool log)
		{
			if (log)
				procedureLogger.Action (string.Format ("Scroll {0} horizontally and {1} vertically.",
				                                       horizontalAmount.ToString (), verticalAmount.ToString ()));

			ScrollPattern sp = (ScrollPattern) element.GetCurrentPattern (ScrollPattern.Pattern);
			sp.Scroll (horizontalAmount, verticalAmount);
		}
示例#7
0
		void IScrollProvider.Scroll (ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
		{
			if (horizontalAmount != ScrollAmount.NoAmount 
			    && GetHorizontallyScrollable () && hScrollbarPeer != null) 
				hScrollbarPeer.InvokeByAmount (horizontalAmount);
			
			if (verticalAmount != ScrollAmount.NoAmount
			    && GetVerticallyScrollable () && vScrollbarPeer != null)
				vScrollbarPeer.InvokeByAmount (verticalAmount);
		}
        //--------------------------------------------------------------------
        // 
        //  IScrollProvider
        // 
        //------------------------------------------------------------------- 

        /// <summary> 
        /// Request to scroll horizontally and vertically by the specified amount.
        /// The ability to call this method and simultaneously scroll horizontally
        /// and vertically provides simple panning support.
        /// </summary> 
        /// <see cref="IScrollProvider.Scroll"/>
        void IScrollProvider.Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount) 
        { 
            if(!IsEnabled())
                throw new ElementNotEnabledException(); 

            bool scrollHorizontally = (horizontalAmount != ScrollAmount.NoAmount);
            bool scrollVertically = (verticalAmount != ScrollAmount.NoAmount);
 
            ScrollViewer owner = (ScrollViewer)Owner;
 
            if (scrollHorizontally && !HorizontallyScrollable || scrollVertically && !VerticallyScrollable) 
            {
                throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed)); 
            }

            switch (horizontalAmount)
            { 
                case ScrollAmount.LargeDecrement:
                    owner.PageLeft(); 
                    break; 
                case ScrollAmount.SmallDecrement:
                    owner.LineLeft(); 
                    break;
                case ScrollAmount.SmallIncrement:
                    owner.LineRight();
                    break; 
                case ScrollAmount.LargeIncrement:
                    owner.PageRight(); 
                    break; 
                case ScrollAmount.NoAmount:
                    break; 
                default:
                    throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed));
            }
 
            switch (verticalAmount)
            { 
                case ScrollAmount.LargeDecrement: 
                    owner.PageUp();
                    break; 
                case ScrollAmount.SmallDecrement:
                    owner.LineUp();
                    break;
                case ScrollAmount.SmallIncrement: 
                    owner.LineDown();
                    break; 
                case ScrollAmount.LargeIncrement: 
                    owner.PageDown();
                    break; 
                case ScrollAmount.NoAmount:
                    break;
                default:
                    throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed)); 
            }
        } 
示例#9
0
 public void ScrollVertical(ScrollAmount amount)
 {
     try
     {
         this._pattern.Scroll(UIAutomationClient.ScrollAmount.ScrollAmount_NoAmount, (UIAutomationClient.ScrollAmount)amount);
     }
     catch (System.Runtime.InteropServices.COMException e)
     {
         Exception newEx; if (Utility.ConvertException(e, out newEx)) { throw newEx; } else { throw; }
     }
 }
        // Request to scroll horizontally and vertically by the specified scrolling amount
        static internal void Scroll (IntPtr hwnd, ScrollAmount HorizontalAmount, ScrollAmount VerticalAmount, bool fForceResults)
        {
            if (!IsScrollable(hwnd))
            {
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
            }

            bool fHz = ScrollCursor(hwnd, HorizontalAmount, NativeMethods.SB_HORZ, fForceResults);
            bool fVt = ScrollCursor (hwnd, VerticalAmount, NativeMethods.SB_VERT, fForceResults);

            if ( fHz && fVt )
                return;

            throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
        }
示例#11
0
        internal void pattern_Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount, Type expectedException, CheckType checkType)
        {

            string call = "Scroll(" + horizontalAmount + ", " + verticalAmount + ")";
            try
            {
                Comment("Before " + call + " VerticalScrollPercent = " + pattern_getVerticalScrollPercent + ", HorizontalScrollPercent = '" + pattern_getHorizontalScrollPercent + "'");
                m_pattern.Scroll(horizontalAmount, verticalAmount);
                Comment("After " + call + " VerticalScrollPercent = " + pattern_getVerticalScrollPercent + ", HorizontalScrollPercent = '" + pattern_getHorizontalScrollPercent + "'");
            }
            catch (Exception actualException)
            {
                if (Library.IsCriticalException(actualException))
                    throw;

                TestException(expectedException, actualException, call, checkType);
                return;
            }
            TestNoException(expectedException, call, checkType);

        }
示例#12
0
        // Scroll control by a given amount
        static private bool ScrollCursor(IntPtr hwnd, ScrollAmount amount, int sbFlag, bool fForceResults)
        {
            // Check Param
            if (amount == ScrollAmount.NoAmount)
            {
                return(true);
            }

            if (!Scrollable(hwnd, sbFlag))
            {
                return(false);
            }

            // Get Max & min
            NativeMethods.ScrollInfo si = new NativeMethods.ScrollInfo();
            si.fMask  = NativeMethods.SIF_ALL;
            si.cbSize = Marshal.SizeOf(si.GetType());

            // if no scroll bar return false
            // on Win 6.0 success is false
            // on other system check through the scroll info is a scroll bar is there
            if ((!Misc.GetScrollInfo(hwnd, sbFlag, ref si) ||
                 !((si.nMax != si.nMin && si.nPage != si.nMax - si.nMin + 1))))
            {
                return(false);
            }

            // Get Action to perform
            int nAction;

            if (sbFlag == NativeMethods.SB_HORZ)
            {
                switch (amount)
                {
                case ScrollAmount.SmallDecrement:
                    nAction = NativeMethods.SB_LINELEFT;
                    break;

                case ScrollAmount.LargeDecrement:
                    nAction = NativeMethods.SB_PAGELEFT;
                    break;

                case ScrollAmount.SmallIncrement:
                    nAction = NativeMethods.SB_LINERIGHT;
                    break;

                case ScrollAmount.LargeIncrement:
                    nAction = NativeMethods.SB_PAGERIGHT;
                    break;

                default:
                    return(false);
                }
            }
            else
            {
                switch (amount)
                {
                case ScrollAmount.SmallDecrement:
                    nAction = NativeMethods.SB_LINEUP;
                    break;

                case ScrollAmount.LargeDecrement:
                    nAction = NativeMethods.SB_PAGEUP;
                    break;

                case ScrollAmount.SmallIncrement:
                    nAction = NativeMethods.SB_LINEDOWN;
                    break;

                case ScrollAmount.LargeIncrement:
                    nAction = NativeMethods.SB_PAGEDOWN;
                    break;

                default:
                    return(false);
                }
            }

            // Set position
            int wParam  = NativeMethods.Util.MAKELONG(nAction, 0);
            int message = sbFlag == NativeMethods.SB_HORZ ? NativeMethods.WM_HSCROLL : NativeMethods.WM_VSCROLL;
            int result  = Misc.ProxySendMessageInt(hwnd, message, (IntPtr)wParam, IntPtr.Zero);

            return(result == 0 || fForceResults);
        }
示例#13
0
 void TSC_Scroll(ScrollAmount scrollHAmount, ScrollAmount scrollVAmount, CheckType checkType)
 {
     pattern_Scroll(scrollHAmount, scrollVAmount, null, checkType);
     m_TestStep++;
 }
示例#14
0
        void TestScroll(bool HScrollable,
            bool VScrollable,
            double PreConitionHPercent,
            double PreConitionVPercent,
            ScrollAmount arg_HScrollAmount,
            ScrollAmount arg_VScrollAmount,
            bool expectedMethReturn,
            object ExpectedHPercent,
            object ExpectedVPercent,
            EventFired HEventFire,
            EventFired VEventFire)
        {
            //Precondition: Verify that the ScrollAmount values are valid for this AutomationElement (ie. Tab does not support ScrollAmount.LargeIncrement or ScrollAmount.LargeDecrement)
            TS_ControlsSupportsLargeIncrementOrDecrement(m_le, arg_HScrollAmount, arg_VScrollAmount, CheckType.IncorrectElementConfiguration);

            //2 "Step: Set HorizontalPercent = PreConitionHPercent",
            TSC_ScrollPercent(PreConitionHPercent, ScrollDirection.Horizontal, CheckType.IncorrectElementConfiguration);

            //3 "Step: Verify that it was set correctly",
            TSC_VerifyScrollPercent(PreConitionHPercent, ScrollDirection.Horizontal, CheckType.Verification);

            //4 "Step: Set VerticalPercent = 0",
            TSC_ScrollPercent(PreConitionVPercent, ScrollDirection.Vertical, CheckType.IncorrectElementConfiguration);

            //5 "Step: Verify that it was set correctly",
            TSC_VerifyScrollPercent(PreConitionVPercent, ScrollDirection.Vertical, CheckType.Verification);

            //6 "Step: Add a property changed listener for HorizontalScrollPercentProperty",
            TSC_AddPropertyChangedListener(m_le, TreeScope.Element, new AutomationProperty[] { ScrollPattern.HorizontalScrollPercentProperty }, CheckType.Verification);

            //7 "Step: Add a property changed listener for VerticalScrollPercentProperty",
            TSC_AddPropertyChangedListener(m_le, TreeScope.Element, new AutomationProperty[] { ScrollPattern.VerticalScrollPercentProperty }, CheckType.Verification);

            //8 "Call SetScrollPercent (NoScroll,0) and verify that method returns true",
            TSC_Scroll(arg_HScrollAmount, arg_VScrollAmount, CheckType.Verification);

            //9 "Verify that HorizontalPercent = *",
            TSC_VerifyScrollPercent(ExpectedHPercent, ScrollDirection.Horizontal, CheckType.Verification);

            //10 "Verify that VerticalPercent = *",
            TSC_VerifyScrollPercent(ExpectedVPercent, ScrollDirection.Vertical, CheckType.Verification);

            // 11 "Step: Wait for events",
            TSC_WaitForEvents(1);

            //11 "Verify that the firing of the event listener HorizontalScrollPercentProperty is Undetermined",
            TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { HEventFire }, new AutomationProperty[] { ScrollPattern.HorizontalScrollPercentProperty }, CheckType.Verification);

            //12 "Verify that the firing of the event listener VerticalScrollPercentProperty is false",
            TSC_VerifyPropertyChangedListener(m_le, new EventFired[] { VEventFire }, new AutomationProperty[] { ScrollPattern.VerticalScrollPercentProperty }, CheckType.Verification);
        }
        //------------------------------------------------------
        //
        //  Interface IScrollProvider
        //
        //------------------------------------------------------
 
        #region Interface IScrollProvider

        public void Scroll( ScrollAmount horizontalAmount, ScrollAmount verticalAmount )
        {
            ElementUtil.Invoke( _peer, new DispatcherOperationCallback( Scroll ), new ScrollAmount [ ] { horizontalAmount, verticalAmount } );
        }
示例#16
0
		public void Scroll (ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
		{
			provider.Scroll (horizontalAmount, verticalAmount);
		}
示例#17
0
        /// <summary>This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.</summary>
        /// <param name="horizontalAmount"> The horizontal increment specific to the control.</param>
        /// <param name="verticalAmount"> The vertical increment specific to the control.</param>
        // Token: 0x060027D9 RID: 10201 RVA: 0x000BABB4 File Offset: 0x000B8DB4
        void IScrollProvider.Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
        {
            if (!base.IsEnabled())
            {
                throw new ElementNotEnabledException();
            }
            bool         flag         = horizontalAmount != ScrollAmount.NoAmount;
            bool         flag2        = verticalAmount != ScrollAmount.NoAmount;
            ScrollViewer scrollViewer = (ScrollViewer)base.Owner;

            if ((flag && !this.HorizontallyScrollable) || (flag2 && !this.VerticallyScrollable))
            {
                throw new InvalidOperationException(SR.Get("UIA_OperationCannotBePerformed"));
            }
            switch (horizontalAmount)
            {
            case ScrollAmount.LargeDecrement:
                scrollViewer.PageLeft();
                break;

            case ScrollAmount.SmallDecrement:
                scrollViewer.LineLeft();
                break;

            case ScrollAmount.NoAmount:
                break;

            case ScrollAmount.LargeIncrement:
                scrollViewer.PageRight();
                break;

            case ScrollAmount.SmallIncrement:
                scrollViewer.LineRight();
                break;

            default:
                throw new InvalidOperationException(SR.Get("UIA_OperationCannotBePerformed"));
            }
            switch (verticalAmount)
            {
            case ScrollAmount.LargeDecrement:
                scrollViewer.PageUp();
                return;

            case ScrollAmount.SmallDecrement:
                scrollViewer.LineUp();
                return;

            case ScrollAmount.NoAmount:
                return;

            case ScrollAmount.LargeIncrement:
                scrollViewer.PageDown();
                return;

            case ScrollAmount.SmallIncrement:
                scrollViewer.LineDown();
                return;

            default:
                throw new InvalidOperationException(SR.Get("UIA_OperationCannotBePerformed"));
            }
        }
示例#18
0
		public void ScrollHorizontal (ScrollAmount amount)
		{
			Source.Scroll (amount, ScrollAmount.NoAmount);
		}
示例#19
0
 public void ScrollHorizontal(ScrollAmount amount, int times)
 {
     Scroll(amount, times, ScrollAmount.NoAmount, 0);
 }
示例#20
0
 public override void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
 {
     Com.Call(() => this.NativePattern.Scroll((Interop.UIAutomationClient.ScrollAmount)horizontalAmount, (Interop.UIAutomationClient.ScrollAmount)verticalAmount));
 }
示例#21
0
 public virtual void ScrollVertical(ScrollAmount amount)
 {
     this._scrollPattern.ScrollVertical(amount: amount);
 }
示例#22
0
 public virtual void ScrollHorizontal(ScrollAmount amount)
 {
     this._scrollPattern.ScrollHorizontal(amount: amount);
 }
示例#23
0
 public virtual void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
 {
     this._scrollPattern.Scroll(horizontalAmount: horizontalAmount, verticalAmount: verticalAmount);
 }
示例#24
0
 public void Scroll(ScrollAmount ha, ScrollAmount va)
 {
     this.Pattern.Scroll(ha, va);
 }
示例#25
0
        private bool Scroll(ScrollAmount amount)
        {
            // Done
            if (amount == ScrollAmount.NoAmount)
            {
                return true;
            }

            // Get up/down control's hwnd
            IntPtr updownHwnd = this.GetUpDownHwnd ();

            if (updownHwnd == IntPtr.Zero)
            {
                return false;
            }

            // 

            int newPos = Misc.ProxySendMessageInt(updownHwnd, NativeMethods.UDM_GETPOS, IntPtr.Zero, IntPtr.Zero);
            int range = Misc.ProxySendMessageInt(updownHwnd, NativeMethods.UDM_GETRANGE, IntPtr.Zero, IntPtr.Zero);
            int max = NativeMethods.Util.LOWORD(range);
            int min = NativeMethods.Util.HIWORD(range);

            if (NativeMethods.Util.HIWORD (newPos) == 0)
            {
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
            }

            newPos = NativeMethods.Util.LOWORD (newPos);
            switch (amount)
            {
                case ScrollAmount.LargeDecrement :
                case ScrollAmount.LargeIncrement :
                    // Not supported.
                    return false;

                case ScrollAmount.SmallDecrement :
                    newPos--;
                    break;

                case ScrollAmount.SmallIncrement :
                    newPos++;
                    break;

                default :  // should never get here
                    return false;
            }

            if (newPos < min || newPos > max)
            {
                // Attempt to scroll before beginning or past end.
                // As long as this is a supported operation (namely,
                // SmallIncrement or SmallDecrement), do nothing but
                // return success.
                return true;
            }

            // Update both the spiner and the tabs
            Misc.ProxySendMessage(updownHwnd, NativeMethods.UDM_SETPOS, IntPtr.Zero, (IntPtr)newPos);
            Misc.ProxySendMessage(_hwnd, NativeMethods.WM_HSCROLL, NativeMethods.Util.MAKELPARAM(NativeMethods.SB_THUMBPOSITION, newPos), IntPtr.Zero);

            return true;
        }
示例#26
0
 public void ScrollHorizontal(ScrollAmount amount)
 {
     Source.Scroll(amount, ScrollAmount.NoAmount);
 }
示例#27
0
 public void ScrollVertical(ScrollAmount amount, int times)
 {
     Scroll(ScrollAmount.NoAmount, 0, amount, times);
 }
示例#28
0
 protected virtual void Scroll(ScrollAmount amount)
 {
     if (!IsScrollable) return;
     ScrollPattern.ScrollVertical(amount);
     actionListener.ActionPerformed(Action.Scroll);
 }
示例#29
0
            /// <summary>
            /// Scrolls inside the visible range; Small is just like arrow up/down; Large is like page up/down.
            /// </summary>
            /// <param name="horizontalAmount">The amount of characters to scroll.</param>
            /// <param name="verticalAmount">The amount of lines to scroll.</param>
            public void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
            {
                var pattern = Patterns.GetScrollPattern(_automationElement);

                pattern.Scroll(horizontalAmount, verticalAmount);
            }
示例#30
0
 public void Scroll(ScrollAmount horizontalAmount = 0, ScrollAmount verticalAmount = 0)
 {
     ActionHandler.Perform(() => ((ScrollPattern)RawElement.GetCurrentPattern(ScrollPattern.Pattern)).Scroll(horizontalAmount, verticalAmount));
 }
示例#31
0
            /// <summary>
            /// Scrolls inside the visible range vertical; Small is just like arrow up/down; Large is like page up/down.
            /// </summary>
            /// <param name="amount">The amount of lines to scroll.</param>
            public void ScrollVertical(ScrollAmount amount)
            {
                var pattern = Patterns.GetScrollPattern(_automationElement);

                pattern.ScrollVertical(amount);
            }
        void IScrollProvider.Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
        {
            if (!IsEnabled())
            {
                throw new ElementNotEnabledException();
            }

            bool scrollHorizontally = (horizontalAmount != ScrollAmount.NoAmount);
            bool scrollVertically = (verticalAmount != ScrollAmount.NoAmount);

            if (scrollHorizontally && !this.HorizontallyScrollable || scrollVertically && !this.VerticallyScrollable)
            {
                // 



                return;
            }

            switch (horizontalAmount)
            {
                // In the small increment and decrement calls, ScrollHorizontally will adjust the
                // ScrollBar.Value itself, so we don't need to do it here
                case ScrollAmount.SmallIncrement:
                    this.OwningDataGrid.ProcessHorizontalScroll(ScrollEventType.SmallIncrement);
                    break;
                case ScrollAmount.LargeIncrement:
                    this.OwningDataGrid.HorizontalScrollBar.Value += this.OwningDataGrid.HorizontalScrollBar.LargeChange;
                    this.OwningDataGrid.ProcessHorizontalScroll(ScrollEventType.LargeIncrement);
                    break;
                case ScrollAmount.SmallDecrement:
                    this.OwningDataGrid.ProcessHorizontalScroll(ScrollEventType.SmallDecrement);
                    break;
                case ScrollAmount.LargeDecrement:
                    this.OwningDataGrid.HorizontalScrollBar.Value -= this.OwningDataGrid.HorizontalScrollBar.LargeChange;
                    this.OwningDataGrid.ProcessHorizontalScroll(ScrollEventType.LargeDecrement);
                    break;
                case ScrollAmount.NoAmount:
                    break;
                default:
                    // 



                    return;
            }

            switch (verticalAmount)
            {
                // In the small increment and decrement calls, ScrollVertically will adjust the
                // ScrollBar.Value itself, so we don't need to do it here
                case ScrollAmount.SmallIncrement:
                    this.OwningDataGrid.ProcessVerticalScroll(ScrollEventType.SmallIncrement);
                    break;
                case ScrollAmount.LargeIncrement:
                    this.OwningDataGrid.VerticalScrollBar.Value += this.OwningDataGrid.VerticalScrollBar.LargeChange;
                    this.OwningDataGrid.ProcessVerticalScroll(ScrollEventType.LargeIncrement);
                    break;
                case ScrollAmount.SmallDecrement:
                    this.OwningDataGrid.ProcessVerticalScroll(ScrollEventType.SmallDecrement);
                    break;
                case ScrollAmount.LargeDecrement:
                    this.OwningDataGrid.VerticalScrollBar.Value -= this.OwningDataGrid.VerticalScrollBar.LargeChange;
                    this.OwningDataGrid.ProcessVerticalScroll(ScrollEventType.LargeDecrement);
                    break;
                case ScrollAmount.NoAmount:
                    break;
                default:
                    // 



                    return;
            }
        }
示例#33
0
 public void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
 {
     ComCallWrapper.Call(() => NativePattern.Scroll((UIA.ScrollAmount)horizontalAmount, (UIA.ScrollAmount)verticalAmount));
 }
示例#34
0
 public void ScrollVertical(ScrollAmount amount)
 {
     Source.Scroll(ScrollAmount.NoAmount, amount);
 }
 /// <inheritdoc/>
 public abstract void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount);
示例#36
0
        void pattern_ScrollWithEvent(ScrollAmount hozAmount, ScrollAmount vertAmount, int milliseconds, CheckType checkType)
        {
            _notifiedEvent.Reset();
            pattern_Scroll(hozAmount, vertAmount, null, checkType);
            _notifiedEvent.WaitOne(milliseconds, false);

        }
        // ------------------------------------------------------
        //
        // Private Methods
        //
        // ------------------------------------------------------

        #region Private Methods

        // Scroll by a given amount
        private void Scroll (ScrollAmount amount, int style)
        {
            IntPtr parentHwnd = _sbFlag == NativeMethods.SB_CTL ? Misc.GetWindowParent(_hwnd) : _hwnd;
            int wParam = 0;

            switch (amount)
            {
                case ScrollAmount.LargeDecrement :
                    wParam = NativeMethods.SB_PAGEUP;
                    break;

                case ScrollAmount.SmallDecrement :
                    wParam = NativeMethods.SB_LINEUP;
                    break;

                case ScrollAmount.LargeIncrement :
                    wParam = NativeMethods.SB_PAGEDOWN;
                    break;

                case ScrollAmount.SmallIncrement :
                    wParam = NativeMethods.SB_LINEDOWN;
                    break;
            }

            NativeMethods.ScrollInfo si = new NativeMethods.ScrollInfo ();
            si.fMask = NativeMethods.SIF_ALL;
            si.cbSize = Marshal.SizeOf (si.GetType ());

            if (!Misc.GetScrollInfo(_hwnd, _sbFlag, ref si))
            {
                return;
            }

            // If the scrollbar is at the maximum position and the user passes
            // pagedown or linedown, just return
            if ((si.nPos == si.nMax) && (wParam == NativeMethods.SB_PAGEDOWN || wParam == NativeMethods.SB_LINEDOWN))
            {
                return;
            }

            // If the scrollbar is at the minimum position and the user passes
            // pageup or lineup, just return
            if ((si.nPos == si.nMin) && (wParam == NativeMethods.SB_PAGEUP || wParam == NativeMethods.SB_LINEUP))
            {
                return;
            }

            int msg = (style == NativeMethods.SBS_HORZ) ? NativeMethods.WM_HSCROLL : NativeMethods.WM_VSCROLL;

            Misc.ProxySendMessage(parentHwnd, msg, (IntPtr)wParam, (IntPtr)(parentHwnd == _hwnd ? IntPtr.Zero : _hwnd));
        }
示例#38
0
        /// -------------------------------------------------------------------
        /// <summary>Some controls do not support this method of scrolling</summary>
        /// -------------------------------------------------------------------
        private void TS_ControlsSupportsLargeIncrementOrDecrement(AutomationElement le, ScrollAmount arg_HScrollAmount, ScrollAmount arg_VScrollAmount, CheckType checkType)
        {
            if (le.Current.ControlType == ControlType.Tab && (arg_HScrollAmount == ScrollAmount.LargeDecrement || arg_HScrollAmount == ScrollAmount.LargeIncrement))
                ThrowMe(checkType, le.Current.ControlType.ProgrammaticName + " does not support LargeIncrement or LargeDecrement");

            m_TestStep++;
        }
示例#39
0
        // Request to scroll a control horizontally or vertically by a specified amount.
        static private bool SetScrollPercent(IntPtr hwnd, double fScrollPos, int sbFlag, out bool forceResults)
        {
            forceResults = false;
            // Check param
            if ((int)fScrollPos == (int)ScrollPattern.NoScroll)
            {
                return(true);
            }

            if (!Scrollable(hwnd, sbFlag))
            {
                return(false);
            }

            if (fScrollPos < 0 || fScrollPos > 100)
            {
                throw new ArgumentOutOfRangeException(sbFlag == NativeMethods.SB_HORZ ? "horizontalPercent" : "verticalPercent", SR.Get(SRID.ScrollBarOutOfRange));
            }

            // Get Max & min
            NativeMethods.ScrollInfo si = new NativeMethods.ScrollInfo();
            si.fMask  = NativeMethods.SIF_ALL;
            si.cbSize = Marshal.SizeOf(si.GetType());

            // if no scroll bar return false
            // on Win 6.0 success is false
            // on other system check through the scroll info is a scroll bar is there
            if (!Misc.GetScrollInfo(hwnd, sbFlag, ref si) ||
                !((si.nMax != si.nMin && si.nPage != si.nMax - si.nMin + 1)))
            {
                return(false);
            }

            // Set position
            int delta = (si.nPage > 0) ? si.nPage - 1 : 0;

            int newPos = (int)Math.Round(((si.nMax - delta) - si.nMin) * fScrollPos / 100.0 + si.nMin);

            // No move, exit
            if (newPos == si.nPos)
            {
                return(true);
            }
            si.nPos = newPos;

            forceResults = true;

            int message = sbFlag == NativeMethods.SB_HORZ ? NativeMethods.WM_HSCROLL : NativeMethods.WM_VSCROLL;

            int  wParam = NativeMethods.Util.MAKELONG(NativeMethods.SB_THUMBPOSITION, si.nPos);
            bool fRet   = Misc.ProxySendMessageInt(hwnd, message, (IntPtr)wParam, IntPtr.Zero) == 0;

            if (fRet && Misc.GetScrollInfo(hwnd, sbFlag, ref si) && si.nPos != newPos)
            {
                // [....] treeview has some problems.  The first is that the SendMessage with WM_HSCROLL/WM_VSCROLL
                // with SB_THUMBPOSITION is not moving the scroll position. The second problem is that SetScrollInfo()
                // lose the theming for the scroll bars and it really does not move the scroll position.  The
                // scrollbars change but it does not scroll the treeview control.

                int          prevPos    = newPos;
                ScrollAmount prevAmount = si.nPos > newPos ? ScrollAmount.SmallDecrement : ScrollAmount.SmallIncrement;
                do
                {
                    ScrollAmount amount = si.nPos > newPos ? ScrollAmount.SmallDecrement : ScrollAmount.SmallIncrement;

                    // If we were moving in one direction and overshoot, break to prevent getting into infant loop.
                    // If ScrollCursor() can not set the new position, also break to prevent infant loop.
                    if (prevAmount != amount || prevPos == si.nPos)
                    {
                        break;
                    }
                    prevPos = si.nPos;
                    fRet    = ScrollCursor(hwnd, amount, sbFlag, forceResults);
                } while (fRet && Misc.GetScrollInfo(hwnd, sbFlag, ref si) && si.nPos != newPos);
            }

            return(fRet);
        }
示例#40
0
 public void ScrollByAmount(ScrollAmount amount)
 {
     switch (amount)
     {
         case ScrollAmount.LargeDecrement:
             this.LargeDecrement();
             break;
         case ScrollAmount.SmallDecrement:
             this.SmallDecrement();
             break;
         case ScrollAmount.LargeIncrement:
             this.LargeIncrement();
             break;
         case ScrollAmount.SmallIncrement:
             this.SmallIncrement();
             break;
     }
 }
示例#41
0
 public void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
 {
     ComCallWrapper.Call(() => NativePattern.Scroll((interop.UIAutomationCore.ScrollAmount)horizontalAmount, (interop.UIAutomationCore.ScrollAmount)verticalAmount));
 }
示例#42
0
        void IScrollProvider.Scroll (ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
        {
            // Make sure that the control is enabled
            if (!SafeNativeMethods.IsWindowEnabled(_hwnd))
            {
                throw new ElementNotEnabledException();
            }

            if (!IsScrollable())
            {
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
            }

            if (verticalAmount != ScrollAmount.NoAmount)
            {
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
            }

            if (!Scroll(horizontalAmount))
            {
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
            }
        }
示例#43
0
文件: Table.cs 项目: mono/uia2atk
		public void ScrollHorizontal (ScrollAmount amount)
		{
			ScrollHorizontal (amount, true);
		}
示例#44
0
 /// <summary>
 /// Does the programmatic scrolling for this element.
 /// </summary>
 /// <param name="scrollDirection">The direction to scroll.</param>
 /// <param name="scrollAmount">The amount to scroll.</param>
 /// <seealso cref="InitializeProgrammaticScroll"/>
 public override void ScrollProgrammatically(ScrollDirection scrollDirection, ScrollAmount scrollAmount)
 {
     // Should never get called because InitializeProgrammaticScroll() returns false.
     throw new NotSupportedException();
 }
示例#45
0
 public void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
 {
     Source.Scroll(horizontalAmount, verticalAmount);
 }
示例#46
0
		public void Scroll (ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
		{
			Source.Scroll (horizontalAmount, verticalAmount);
		}
 // Request to scroll horizontally and vertically by the specified scrolling amount
 void IScrollProvider.Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
 {
     WindowScroll.Scroll(_hwnd, horizontalAmount, verticalAmount, true);
 }
示例#48
0
		public void ScrollVertical (ScrollAmount amount)
		{
			Source.Scroll (ScrollAmount.NoAmount, amount);
		}
        //-------------------------------------------------------------------
        //
        //  IScrollProvider
        //
        //-------------------------------------------------------------------

        /// <summary>
        /// Request to scroll horizontally and vertically by the specified amount.
        /// The ability to call this method and simultaneously scroll horizontally
        /// and vertically provides simple panning support.
        /// </summary>
        /// <see cref="IScrollProvider.Scroll"/>
        void IScrollProvider.Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
        {
            if (!IsEnabled())
            {
                throw new ElementNotEnabledException();
            }

            bool scrollHorizontally = (horizontalAmount != ScrollAmount.NoAmount);
            bool scrollVertically   = (verticalAmount != ScrollAmount.NoAmount);

            ScrollViewer owner = (ScrollViewer)Owner;

            if (scrollHorizontally && !HorizontallyScrollable || scrollVertically && !VerticallyScrollable)
            {
                throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed));
            }

            switch (horizontalAmount)
            {
            case ScrollAmount.LargeDecrement:
                owner.PageLeft();
                break;

            case ScrollAmount.SmallDecrement:
                owner.LineLeft();
                break;

            case ScrollAmount.SmallIncrement:
                owner.LineRight();
                break;

            case ScrollAmount.LargeIncrement:
                owner.PageRight();
                break;

            case ScrollAmount.NoAmount:
                break;

            default:
                throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed));
            }

            switch (verticalAmount)
            {
            case ScrollAmount.LargeDecrement:
                owner.PageUp();
                break;

            case ScrollAmount.SmallDecrement:
                owner.LineUp();
                break;

            case ScrollAmount.SmallIncrement:
                owner.LineDown();
                break;

            case ScrollAmount.LargeIncrement:
                owner.PageDown();
                break;

            case ScrollAmount.NoAmount:
                break;

            default:
                throw new InvalidOperationException(SR.Get(SRID.UIA_OperationCannotBePerformed));
            }
        }
示例#50
0
文件: Table.cs 项目: mono/uia2atk
		public void Scroll (ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
		{
			Scroll (horizontalAmount, verticalAmount, true);
		}
示例#51
0
        private bool Scroll(ScrollAmount amount)
        {
            // Done
            if (amount == ScrollAmount.NoAmount)
            {
                return(true);
            }

            // Get up/down control's hwnd
            IntPtr updownHwnd = this.GetUpDownHwnd();

            if (updownHwnd == IntPtr.Zero)
            {
                return(false);
            }

            //

            int newPos = Misc.ProxySendMessageInt(updownHwnd, NativeMethods.UDM_GETPOS, IntPtr.Zero, IntPtr.Zero);
            int range  = Misc.ProxySendMessageInt(updownHwnd, NativeMethods.UDM_GETRANGE, IntPtr.Zero, IntPtr.Zero);
            int max    = NativeMethods.Util.LOWORD(range);
            int min    = NativeMethods.Util.HIWORD(range);

            if (NativeMethods.Util.HIWORD(newPos) == 0)
            {
                throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
            }

            newPos = NativeMethods.Util.LOWORD(newPos);
            switch (amount)
            {
            case ScrollAmount.LargeDecrement:
            case ScrollAmount.LargeIncrement:
                // Not supported.
                return(false);

            case ScrollAmount.SmallDecrement:
                newPos--;
                break;

            case ScrollAmount.SmallIncrement:
                newPos++;
                break;

            default:       // should never get here
                return(false);
            }

            if (newPos < min || newPos > max)
            {
                // Attempt to scroll before beginning or past end.
                // As long as this is a supported operation (namely,
                // SmallIncrement or SmallDecrement), do nothing but
                // return success.
                return(true);
            }

            // Update both the spiner and the tabs
            Misc.ProxySendMessage(updownHwnd, NativeMethods.UDM_SETPOS, IntPtr.Zero, (IntPtr)newPos);
            Misc.ProxySendMessage(_hwnd, NativeMethods.WM_HSCROLL, NativeMethods.Util.MAKELPARAM(NativeMethods.SB_THUMBPOSITION, newPos), IntPtr.Zero);

            return(true);
        }
示例#52
0
文件: Table.cs 项目: mono/uia2atk
		public void ScrollVertical (ScrollAmount amount)
		{
			ScrollVertical (amount, true);
		}
 public override void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
 {
     Com.Call(() => NativePattern.Scroll((UIA.ScrollAmount)horizontalAmount, (UIA.ScrollAmount)verticalAmount));
 }