public bool AddRowSelection(int row) { if (row < 0 || row >= NRows) { return(false); } if (GridProvider == null) { return(false); } if (tableProvider != null) { IRawElementProviderSimple[] headers = tableProvider.GetColumnHeaders(); if (headers != null && headers.Length > 0) { // In UIA, header rows cannot be selected if (row == 0) { return(false); } row -= 1; } } IRawElementProviderSimple item; try { // UIA doesn't support row selection, so we select the first cell item = GridProvider.GetItem(row, 0); } catch (ArgumentOutOfRangeException e) { Log.Debug(e); return(false); } if (item == null) { return(false); } ISelectionItemProvider selectionItem = (ISelectionItemProvider)item.GetPatternProvider(SelectionItemPatternIdentifiers.Pattern.Id); if (selectionItem == null) { return(false); } try { selectionItem.AddToSelection(); } catch (InvalidOperationException e) { Log.Debug(e); return(false); } return(true); }
public bool RemoveRowSelection(int row) { if (row < 0 || row >= NRows) { return(false); } if (GridProvider == null) { return(false); } if (tableProvider != null) { IRawElementProviderSimple[] headers = tableProvider.GetColumnHeaders(); if (headers != null && headers.Length > 0) { // In UIA, header rows cannot be selected if (row == 0) { return(false); } row--; } } IRawElementProviderSimple item = null; try { item = GridProvider.GetItem(row, 0); } catch (ArgumentOutOfRangeException e) { Log.Debug(e); } if (item == null) { return(false); } ISelectionItemProvider selectionItem = (ISelectionItemProvider)item.AutomationPeer.GetPattern(PatternInterface.SelectionItem); if (selectionItem == null) { return(false); } try { selectionItem.RemoveFromSelection(); } catch (InvalidOperationException e) { Log.Debug(e); return(false); } return(true); }
public bool IsSelected(int row, int column) { if (!AreRowColInBounds(row, column)) { return(false); } if (GridProvider == null) { return(false); } if (tableProvider != null) { IRawElementProviderSimple[] headers = tableProvider.GetColumnHeaders(); if (headers != null && headers.Length > 0) { // In UIA, header rows cannot be selected if (row == 0) { return(false); } row--; } } IRawElementProviderSimple item; try { item = GridProvider.GetItem(row, column); } catch (ArgumentOutOfRangeException e) { Log.Debug(e); return(false); } if (item == null) { return(false); } ISelectionItemProvider selectionItemProvider = (ISelectionItemProvider)item.AutomationPeer.GetPattern(PatternInterface.SelectionItem); if (selectionItemProvider == null) { return(false); } return(selectionItemProvider.IsSelected); }
public Atk.Object RefAt(int row, int column) { if (!AreRowColInBounds(row, column)) { return(null); } IRawElementProviderSimple [] headers = null; if (tableProvider != null) { headers = tableProvider.GetColumnHeaders(); } // Some controls will have column headers that need to // be mapped to row 0 if (row == 0 && headers != null) { if (column >= headers.Length) { return(null); } return(DynamicAdapterFactory.Instance.GetAdapter(headers [column].AutomationPeer)); } // GetItem indexes through only items, not headers, so // we need to remap the row number if (headers != null) { row--; } IRawElementProviderSimple item = null; try { item = GridProvider.GetItem(row, column); } catch (ArgumentOutOfRangeException e) { Log.Debug(e); } if (item == null) { return(null); } return(DynamicAdapterFactory.Instance.GetAdapter(item.AutomationPeer)); }
public int GetRowExtentAt(int row, int column) { if (!AreRowColInBounds(row, column)) { return(-1); } IGridItemProvider g = null; if (tableProvider != null) { IRawElementProviderSimple[] headers = tableProvider.GetColumnHeaders(); if (headers != null && headers.Length > 0) { if (row == 0) { g = headers [column].AutomationPeer.GetPattern(PatternInterface.GridItem) as IGridItemProvider; return((g == null) ? 0 : g.RowSpan); } row--; } } IRawElementProviderSimple item; try { item = GridProvider.GetItem(row, column); } catch (ArgumentOutOfRangeException e) { Log.Debug(e); return(-1); } if (item == null) { return(-1); } g = (IGridItemProvider)item.AutomationPeer.GetPattern(PatternInterface.GridItem); if (g != null) { return(g.RowSpan); } return(1); }
public int GetColumnExtentAt(int row, int column) { if (!AreRowColInBounds(row, column)) { return(-1); } IGridItemProvider g = null; if (tableProvider != null) { IRawElementProviderSimple[] headers = tableProvider.GetColumnHeaders(); if (headers != null && headers.Length > 0) { if (row == 0) { g = headers [column].GetPatternProvider( GridItemPatternIdentifiers.Pattern.Id) as IGridItemProvider; return((g == null) ? 0 : g.ColumnSpan); } row -= 1; } } IRawElementProviderSimple item; try { item = GridProvider.GetItem(row, column); } catch (ArgumentOutOfRangeException e) { Log.Debug(e); return(-1); } g = (IGridItemProvider)item.GetPatternProvider(GridItemPatternIdentifiers.Pattern.Id); if (g != null) { return(g.ColumnSpan); } return(-1); }
public bool IsRowSelected(int row) { if (row < 0 || row >= NRows) { return(false); } if (tableProvider != null) { IRawElementProviderSimple[] headers = tableProvider.GetColumnHeaders(); if (headers != null && headers.Length > 0) { // In UIA, header rows cannot be selected if (row == 0) { return(false); } row -= 1; } } IRawElementProviderSimple item; try { item = GridProvider.GetItem(row, 0); } catch (ArgumentOutOfRangeException e) { Log.Debug(e); return(false); } ISelectionItemProvider selectionItem = (ISelectionItemProvider)item.GetPatternProvider(SelectionItemPatternIdentifiers.Pattern.Id); if (selectionItem == null) { return(false); } return(selectionItem.IsSelected); }