//------------------------------------------------------ // // Patterns Implementation // //------------------------------------------------------ #region ProxySimple Interface // Returns a pattern interface if supported. internal override object GetPatternProvider(AutomationPattern iid) { if (iid == InvokePattern.Pattern && WindowsListView.ListViewInvokable(_hwnd)) { return(this); } if (iid == SelectionItemPattern.Pattern) { return(this); } if (iid == ValuePattern.Pattern && WindowsListView.ListViewEditable(_hwnd)) { return(this); } if (iid == GridItemPattern.Pattern && IsImplementingGrid(_hwnd)) { return(this); } if (iid == TogglePattern.Pattern && IsItemWithCheckbox(_hwnd, _item)) { return(CreateListViewItemCheckbox()); } if (iid == ScrollItemPattern.Pattern && WindowScroll.IsScrollable(_hwnd)) { return(this); } return(null); }
// Returns a pattern interface if supported, else null. internal override object GetPatternProvider(AutomationPattern iid) { if (iid == ScrollPattern.Pattern && WindowScroll.HasScrollableStyle(_hwnd)) { return(this); } return(null); }
internal NativeMethods.Win32Rect CalculateRectNoHeader() { NativeMethods.Win32Rect rcLv = NativeMethods.Win32Rect.Empty; if (!Misc.GetWindowRect(_hwnd, ref rcLv)) { return(NativeMethods.Win32Rect.Empty); } // set top to the top coordinate of the first item NativeMethods.Win32Rect item; WindowsListView.GetItemRect(_hwnd, _items[0], NativeMethods.LVIR_BOUNDS, out item); NativeMethods.Win32Rect groupRc; groupRc.top = item.top; // left coordinate defined by the left coordinate of the listview groupRc.left = rcLv.left; int count = Count; // bottom defined by the bottom coordinate of the last item if (count > 1) { // get the rect of the last item in the group WindowsListView.GetItemRect(_hwnd, _items[count - 1], NativeMethods.LVIR_BOUNDS, out item); } groupRc.bottom = item.bottom; // right coordinate defined by lv.right groupRc.right = rcLv.right; // when vertical scrollbar is present take it into account if (WindowScroll.Scrollable(_hwnd, NativeMethods.SB_VERT)) { NativeMethods.Win32Rect rc = GetScrollbarRect(); int width = rc.right - rc.left; if (Misc.IsControlRTL(_hwnd)) { // Right to left mirroring style groupRc.left += width; } else { groupRc.right -= width; } } return(groupRc); }
void IScrollItemProvider.ScrollIntoView() { if (_listBox._parentedByCombo && !SafeNativeMethods.IsWindowVisible(_hwnd)) { throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed)); } if (!WindowScroll.IsScrollable(_hwnd)) { throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed)); } // It is assumed that in a listbox an item will always be smaller than the scrolling area Misc.ProxySendMessage(_hwnd, NativeMethods.LB_SETTOPINDEX, new IntPtr(_item), IntPtr.Zero); }
//------------------------------------------------------ // // Patterns Implementation // //------------------------------------------------------ #region ProxySimple Interface // Returns a pattern interface if supported. internal override object GetPatternProvider(AutomationPattern iid) { if (iid == SelectionItemPattern.Pattern) { return(this); } else if (iid == ScrollItemPattern.Pattern && WindowScroll.IsScrollable(_hwnd)) { return(this); } else if (_listBox.IsWinFormCheckedListBox() && iid == TogglePattern.Pattern) { return(this); } return(null); }
//------------------------------------------------------ // // Patterns Implementation // //------------------------------------------------------ #region ProxySimple Interface // Returns a pattern interface if supported. internal override object GetPatternProvider(AutomationPattern iid) { // selection is always supported if (iid == SelectionPattern.Pattern) { return(this); } // the scroll pattern is only supported when the list is scrollable. else if (iid == ScrollPattern.Pattern && WindowScroll.HasScrollableStyle(_hwnd)) { // delegate work to the NonClientArea implementation of IScrollProvider IScrollProvider scroll = NonClientArea.Create(_hwnd, 0) as IScrollProvider; if (scroll != null) { return(scroll); } } return(null); }
//------------------------------------------------------ // // Patterns Implementation // //------------------------------------------------------ #region ProxySimple Interface // Returns a pattern interface if supported. internal override object GetPatternProvider(AutomationPattern iid) { return((iid == RangeValuePattern.Pattern && WindowScroll.Scrollable(_hwnd, _sbFlag) && HasValuePattern(_hwnd, _sbFlag)) ? this : null); }
// Request to scroll horizontally and vertically by the specified scrolling amount void IScrollProvider.Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount) { WindowScroll.Scroll(_hwnd, horizontalAmount, verticalAmount, true); }
// Request to scroll Horizontally and vertically by the specified amount void IScrollProvider.SetScrollPercent(double horizontalPercent, double verticalPercent) { WindowScroll.SetScrollPercent(_hwnd, horizontalPercent, verticalPercent, true); }