private Object GetAccessibleOption(Object Struct, Int32 StructSize, AccessType AccessType, WinIniFlags IniFlag) { Object ReturnValue; // The return data. // Allocate enough memory to create an unmanaged version // of the data structure. IntPtr DataPtr = Marshal.AllocHGlobal(StructSize); // Point to the managed data stucture using the unmanaged // memory pointer. Marshal.StructureToPtr(Struct, DataPtr, true); // Call the SystemParametersInfo() function using the // unmanaged data structure pointer. Accessible.SystemParametersInfo(AccessType, Convert.ToUInt32(StructSize), DataPtr, IniFlag); // Move the data retrieved from the umnanaged environment to // the managed data structure and return this data structure // as an object. ReturnValue = Marshal.PtrToStructure(DataPtr, Struct.GetType()); // Deallocate the memory we previously allocated. Marshal.FreeHGlobal(DataPtr); // Return the data. return(ReturnValue); }
internal DockNotebookTab(DockNotebook notebook, TabStrip strip) { if (AccessibilityElementProxy.Enabled) { Accessible = AccessibilityElementProxy.ButtonElementProxy(); Accessible.PerformPress += OnPressTab; // FIXME Should Role descriptions be translated? Accessible.SetRole(AtkCocoa.Roles.AXRadioButton, "tab"); Accessible.GtkParent = strip; Accessible.PerformShowMenu += OnShowMenu; Accessible.Identifier = "DockNotebook.Tab"; CloseButtonAccessible = AccessibilityElementProxy.ButtonElementProxy(); CloseButtonAccessible.PerformPress += OnPressCloseButton; CloseButtonAccessible.SetRole(AtkCocoa.Roles.AXButton); CloseButtonAccessible.GtkParent = strip; CloseButtonAccessible.PerformShowMenu += OnCloseButtonShowMenu; CloseButtonAccessible.Title = Core.GettextCatalog.GetString("Close document"); CloseButtonAccessible.Identifier = "DockNotebook.Tab.CloseButton"; Accessible.AddAccessibleChild(CloseButtonAccessible); } this.notebook = notebook; this.strip = strip; }
public IElement [] GetColumnHeaders() { // TODO: would be nice if at-spi made this easier Accessible accessible = table.GetColumnHeader(0); // If that returned null, then maybe we have no // headers, so not going to query every single row if (accessible == null) { return(new Element [0]); } int count = ColumnCount; Element [] elements = new Element [count]; elements [0] = Element.GetElement(accessible); for (int i = 1; i < count; i++) { accessible = table.GetColumnHeader(i); if (accessible != null) { elements [i] = Element.GetElement(accessible); } } return(elements); }
public WelcomePageListButton(string title, string subtitle, Xwt.Drawing.Image icon, string actionUrl) { actionHandler = new ActionDelegate(this); actionHandler.PerformPress += HandlePress; Accessible.Role = Atk.Role.PushButton; Accessible.SetTitle(title); if (!actionUrl.StartsWith("monodevelop://")) { Accessible.Description = string.Format("Opens {0}", title); } VisibleWindow = false; this.title = title; this.subtitle = subtitle; this.icon = icon; this.actionUrl = actionUrl; WidthRequest = Styles.WelcomeScreen.Pad.Solutions.SolutionTile.Width; HeightRequest = Styles.WelcomeScreen.Pad.Solutions.SolutionTile.Height + 2; Events |= (Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask); LeftTextPadding = Styles.WelcomeScreen.Pad.Solutions.SolutionTile.TextLeftPadding; InternalPadding = Styles.WelcomeScreen.Pad.Padding; Gui.Styles.Changed += UpdateStyle; UpdateStyle(); UpdateActions(); }
void OnMarkerRemoved(object sender, TextMarkerEvent e) { if (!IdeTheme.AccessibilityEnabled) { return; } if (markerToAccessible == null) { return; } var proxy = markerToAccessible [e.TextMarker]; if (proxy == null) { throw new Exception("No accessible found for marker"); } Accessible.RemoveAccessibleChild(proxy.Accessible); markerToAccessible.Remove(e.TextMarker); if (focusMarkers != null) { UpdateMarkers(); } }
public StringTagSelectorButton() { this.Build(); Accessible.SetShouldIgnore(true); button.Accessible.SetRole(AtkCocoa.Roles.AXPopUpButton); }
public WelcomePageColumn() { Accessible.SetShouldIgnore(true); Spacing = Styles.WelcomeScreen.Spacing; MinWidth = -1; }
public TextRangePattern(Accessible accessible, int startOffset, int endOffset) { this.accessible = accessible; this.text = accessible.QueryText(); this.startOffset = startOffset; this.endOffset = endOffset; }
private bool SetAccessibleOption(Object Struct, Int32 StructSize, AccessType AccessType, WinIniFlags IniFlag) { bool ReturnValue; // The return value of this method. // Allocate enough memory to create an unmanaged version // of the data structure. IntPtr DataPtr = Marshal.AllocHGlobal(StructSize); // Point to the managed data stucture using the unmanaged // memory pointer. Marshal.StructureToPtr(Struct, DataPtr, true); // Return true if the SystemParametersInfo() function call // successfully modifies the Windows Accessibility features // using the data in the data structure. ReturnValue = Accessible.SystemParametersInfo( AccessType, Convert.ToUInt32(StructSize), DataPtr, IniFlag); // Deallocate the memory we previously allocated. Marshal.FreeHGlobal(DataPtr); // Return the data. return(ReturnValue); }
//------------------------------------------------------ // // Interface IRawElementProviderHwndOverride // //------------------------------------------------------ IRawElementProviderSimple IRawElementProviderHwndOverride.GetOverrideProviderForHwnd(IntPtr hwnd) { // return the appropriate placeholder for the given hwnd... // loop over all the band to find it. // Only [....] StatusBars can have children. if (_acc != null) { Accessible accChild = _acc.FirstChild; IntPtr hwndChild = IntPtr.Zero; for (int i = 0; accChild != null; i++, accChild = accChild.NextSibling(_acc)) { hwndChild = accChild.Window; if (hwndChild == IntPtr.Zero) { hwndChild = GetChildHwnd(_hwnd, accChild.Location); } if (hwndChild == hwnd) { return(new WindowsStatusBarPaneChildOverrideProxy(hwnd, this, i)); } } } return(null); }
public override void Dispose() { base.Dispose(); StopTimer(); animationStage.ActorStep -= AnimationStage_ActorStep; animationStage.Exeunt(); editor.TextArea.MouseHover -= TextArea_MouseHover; editor.TextArea.MouseLeft -= TextArea_MouseLeft; editor.Caret.PositionChanged -= HandleEditorCaretPositionChanged; editor.Caret.PositionChanged -= EditorCarethandlePositionChanged; editor.Document.FoldTreeUpdated -= HandleEditorDocumentFoldTreeUpdated; layout = layout.Kill(); foldings = null; drawer = null; if (updateAccessibilityId > 0) { GLib.Source.Remove(updateAccessibilityId); updateAccessibilityId = 0; } if (accessibles != null) { foreach (var a in accessibles.Values) { Accessible.RemoveAccessibleChild(a.Accessible); a.Dispose(); } accessibles.Clear(); } }
// Static Create method called by UIAutomation to create a Button proxy for [....] Buttons. // returns null if unsuccessful internal static IRawElementProviderSimple CreateButton(IntPtr hwnd) { // Currently there is an issue with CLR remoting that causes Accessible.CreateNativeFromEvent() to fail // for [....] controls. Until that is resolved use AccessibleObjectFromWindow() instead. It will // return a Native IAccessble and not a OleAcc implementaion. [....] does provide a Native IAccessible. Accessible acc = null; if (Accessible.AccessibleObjectFromWindow(hwnd, NativeMethods.OBJID_CLIENT, ref acc) != NativeMethods.S_OK || acc == null) { return(null); } switch (acc.Role) { case AccessibleRole.CheckButton: return(new WindowsButton(hwnd, null, WindowsButton.ButtonType.CheckBox, Misc.GetWindowStyle(hwnd) & NativeMethods.BS_TYPEMASK, acc)); case AccessibleRole.Grouping: return(new WindowsButton(hwnd, null, WindowsButton.ButtonType.GroupBox, Misc.GetWindowStyle(hwnd) & NativeMethods.BS_TYPEMASK, acc)); case AccessibleRole.PushButton: return(new WindowsButton(hwnd, null, WindowsButton.ButtonType.PushButton, Misc.GetWindowStyle(hwnd) & NativeMethods.BS_TYPEMASK, acc)); case AccessibleRole.RadioButton: return(new WindowsButton(hwnd, null, WindowsButton.ButtonType.RadioButton, Misc.GetWindowStyle(hwnd) & NativeMethods.BS_TYPEMASK, acc)); default: break; } return(null); }
void UpdatePathAccessibility() { if (!AccessibilityElementProxy.Enabled) { return; } var elements = new AtkCocoaHelper.AccessibilityElementProxy [leftPath.Length + rightPath.Length]; int idx = 0; foreach (var entry in leftPath) { elements [idx] = entry.Accessible; entry.Accessible.GtkParent = this; entry.PerformShowMenu += PerformShowMenu; idx++; } foreach (var entry in rightPath) { elements [idx] = entry.Accessible; entry.Accessible.GtkParent = this; entry.PerformShowMenu += PerformShowMenu; idx++; } Accessible.ReplaceAccessibilityElements(elements); }
// Process all the Logical and Raw Element Properties internal override object GetElementProperty(AutomationProperty idProp) { if (idProp == AutomationElement.IsControlElementProperty) { // // // In IE6, the rebar band HWND tree was only one level deep: // // rebar / rebar band / rebar item (Toolbar32) // // In IE7, the HWND tree is the same but the rebar item is // a window acting as another container, for instance: // // rebar / rebar band / rebar item (FavBandClass) / children (Toolbar32) // // Hide windows that are intermediate containers from the control view Accessible accThis = Accessible.Wrap(this.AccessibleObject); if ((accThis != null) && (accThis.ChildCount == 1)) { Accessible accWind = accThis.FirstChild; if ((accWind != null) && (accWind.Role == AccessibleRole.Window)) { return(false); } } } // No property should be handled by the override proxy // Overrides the ProxySimple implementation. return(null); }
// ------------------------------------------------------ // // Internal Methods // // ------------------------------------------------------ #region Internal Methods // Create a WindowsToolbar instance. Needs to be internal because // ApplicationWindow pattern needs to call this so needs to be internal internal ProxySimple CreateToolbarItem(int item) { NativeMethods.TBBUTTON tbb = new NativeMethods.TBBUTTON(); // During the FocusChanged WinEvent (EVENT_OBJECT_FOCUS), // some "ToolbarWindow32" children report an item ID (child id) // of 0x80000001, 0x80000002, etc. instead of 1, 2, etc. // However, when created as children of the parent toolbar, // these same items are assigned IDs of 1, 2, etc. // Therefore, map negative item IDs of the form 0x80000001, // 0x80000002, etc. to 1, 2, etc. item = (int)(~0x80000000 & (uint)item); if (!XSendMessage.GetItem(_hwnd, item, ref tbb)) { // If failed to get button infromation the button must not exist, so return null. return(null); } if (Misc.ProxySendMessageInt(_hwnd, NativeMethods.TB_ISBUTTONHIDDEN, new IntPtr(tbb.idCommand), IntPtr.Zero) == 0) { Accessible acc = Accessible.CreateNativeFromEvent(_hwnd, NativeMethods.OBJID_CLIENT, item + 1); if (acc != null) { if (acc.Role == AccessibleRole.MenuItem) { return(new ToolbarItemAsMenuItem(_hwnd, this, item, tbb.idCommand, acc)); } } return(new ToolbarItem(_hwnd, this, item, tbb.idCommand)); } return(null); }
internal static IRawElementProviderSimple Create(IntPtr hwnd, int idChild) { WindowsToolbar wtv = null; // By calling Accessible.CreateNativeFromEvent() instead of AccessibleObjectFromWindow() only controls with a native // implementation of IAccessible will be found. OleAcc will not create a IAccessible proxy, since // Accessible.CreateNativeFromEvent() by passes OleAcc by sending a WM_GETOBJECT directly to the control and creating // IAccessible from the return, if it can. Accessible acc = Accessible.CreateNativeFromEvent(hwnd, NativeMethods.OBJID_CLIENT, NativeMethods.CHILD_SELF); if (acc != null) { AccessibleRole role = acc.Role; if (role == AccessibleRole.MenuBar || role == AccessibleRole.MenuPopup) { wtv = new WindowsToolbarAsMenu(hwnd, null, 0, acc); } } if (wtv == null) { wtv = new WindowsToolbar(hwnd, null, 0); } return(idChild == 0 ? wtv : wtv.CreateToolbarItem(idChild - 1)); }
bool UpdateAccessibilityTimer() { updateAccessibilityId = 0; if (accessibles == null) { accessibles = new Dictionary <FoldSegment, FoldingAccessible> (); } foreach (var a in accessibles.Values) { Accessible.RemoveAccessibleChild(a.Accessible); a.Dispose(); } accessibles.Clear(); // Add any folds var segments = editor.Document.FoldSegments; foreach (var f in segments) { var accessible = new FoldingAccessible(f, this, editor); accessibles [f] = accessible; Accessible.AddAccessibleChild(accessible.Accessible); } return(false); }
public WelcomePageSection(string title = null) { if (!string.IsNullOrEmpty(title)) { Accessible.SetTitle(title); } this.title = title; VisibleWindow = false; root.Accessible.SetShouldIgnore(true); Add(root); root.Show(); uint p = Styles.WelcomeScreen.Pad.ShadowSize * 2; root.SetPadding(p, p, p, p); TitleAlignment = new Alignment(0f, 0f, 1f, 1f); TitleAlignment.Accessible.SetShouldIgnore(true); p = Styles.WelcomeScreen.Pad.Padding; TitleAlignment.SetPadding(p, Styles.WelcomeScreen.Pad.LargeTitleMarginBottom, p, p); ContentAlignment = new Alignment(0f, 0f, 1f, 1f); ContentAlignment.SetPadding(0, p, p, p); ContentAlignment.Accessible.SetShouldIgnore(true); Gui.Styles.Changed += UpdateStyle; }
void CalcAccessibility() { var columnElement = new AtkCocoaHelper.AccessibilityElementProxy(); columnElement.GtkParent = this; columnElement.SetRole(AtkCocoa.Roles.AXColumn); Accessible.AddAccessibleElement(columnElement); for (int i = 0; i < win.DataProvider.IconCount; i++) { var rowElement = new AtkCocoaHelper.AccessibilityElementProxy(); rowElement.GtkParent = this; rowElement.SetRole(AtkCocoa.Roles.AXRow); Accessible.AddAccessibleElement(rowElement); var cellElement = new AtkCocoaHelper.AccessibilityElementProxy(); cellElement.GtkParent = this; cellElement.SetRole(AtkCocoa.Roles.AXCell); columnElement.AddAccessibleChild(cellElement); rowElement.AddAccessibleChild(cellElement); var textElement = new TextElement(); textElement.RowIndex = i; textElement.PerformPress += PerformPress; textElement.GtkParent = this; textElement.Value = win.DataProvider.GetMarkup(i); cellElement.AddAccessibleChild(textElement); } }
public static List <List <string> > GetContents(this Ranorex.Table table) { if (table.Visible) { List <List <string> > contents = new List <List <string> >(); // contents contains rows and columns int rows = table.Rows.Count; // Get total rows first rows--; for (int x = 0; x < rows; x++) { // get text from row Accessible accValue = new Accessible(table.FindSingle(string.Format("/?/?/row[@accessiblename='Row {0}']", x))); string tableValues = accValue.Value; // remove all "(null)" here // figure out how to remove space tableValues = tableValues.Replace("(null)", " "); // split line into a list and add into list of list List <string> lsRow = tableValues.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList(); // split the string into an array of rows separated by new line characters contents.Add(lsRow); } return(contents); } else { return(null); } }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods // Retrieves the bounding rectangle of the Status Bar Pane. static internal Rect GetBoundingRectangle(IntPtr hwnd, int item) { if (!WindowsFormsHelper.IsWindowsFormsControl(hwnd)) { return(XSendMessage.GetItemRect(hwnd, NativeMethods.SB_GETRECT, item)); } else { Accessible acc = null; if (Accessible.AccessibleObjectFromWindow(hwnd, NativeMethods.OBJID_CLIENT, ref acc) != NativeMethods.S_OK || acc == null) { return(Rect.Empty); } else { // OLEACC's Win32 proxy does use a 1, 2, 3... scheme, but the [....] // controls in some cases supply their own children, using a different scheme. // Using the "ByIndex" approach avoids having to know what the underlying // object's idChild scheme is. acc = Accessible.GetFullAccessibleChildByIndex(acc, item); if (acc == null) { return(Rect.Empty); } else { return(acc.Location); } } } }
/// <summary> /// Helper Method to get the IHTMLDocument2 /// </summary> /// <param name="mainWindow"></param> /// <returns></returns> private static IHTMLDocument2 GetHtmlDocument(IInteropWindow mainWindow) { var ieServer = "Internet Explorer_Server".Equals(mainWindow.GetClassname()) ? mainWindow : mainWindow.GetChildren().FirstOrDefault(window => window.GetClassname() == "Internet Explorer_Server"); if (ieServer == null) { Log.Warn().WriteLine("No Internet Explorer_Server for {0}", mainWindow.Text); return(null); } var windowMessage = WindowsMessage.RegisterWindowsMessage("WM_HTML_GETOBJECT"); if (windowMessage == 0) { Log.Warn().WriteLine("Couldn't register WM_HTML_GETOBJECT"); return(null); } Log.Debug().WriteLine("Trying WM_HTML_GETOBJECT on {0}", ieServer.Classname); if (User32Api.TrySendMessage(ieServer.Handle, windowMessage, IntPtr.Zero, out UIntPtr response)) { var document2 = (IHTMLDocument2)Accessible.ObjectFromLresult(response, typeof(IHTMLDocument).GUID, IntPtr.Zero); if (document2 != null) { return(document2); } Log.Error().WriteLine(null, "No IHTMLDocument2 found"); return(null); } Log.Error().WriteLine(null, "No answer on WM_HTML_GETOBJECT."); return(null); }
public TextRangePattern(Accessible accessible) { this.accessible = accessible; this.text = accessible.QueryText(); this.startOffset = 0; this.endOffset = text.CharacterCount; }
internal ProxySimple CreateStatusBarPane(int index) { // Use the Accessible object if this is a [....] control. Only [....] StatusBars // can have children. Accessible accChild = null; if (_acc != null) { // OLEACC's Win32 proxy does use a 1, 2, 3... scheme, but the [....] // controls in some cases supply their own children, using a different scheme. // Using the "ByIndex" approach avoids having to know what the underlying // object's idChild scheme is. accChild = Accessible.GetFullAccessibleChildByIndex(_acc, index); if (accChild != null && accChild.Role != AccessibleRole.PushButton) { // [....] toolbars have full IAccessibles for their children, but // return the overall hwnd; treat those same as regular items. // We only want to special-case actual child hwnds for overriding. IntPtr hwndChild = accChild.Window; if (hwndChild == IntPtr.Zero || hwndChild == _hwnd) { hwndChild = GetChildHwnd(_hwnd, accChild.Location); } if (hwndChild != IntPtr.Zero && hwndChild != _hwnd) { // We have an actual child hwnd. return(new WindowsStatusBarPaneChildOverrideProxy(hwndChild, this, index)); } } } return(new WindowsStatusBarPane(_hwnd, this, index, accChild)); }
internal void UpdateRole(bool isTab, TabStrip strip) { Atk.Object fromAccessible = null, toAccessible = null; if (!isTab) { Accessible.SetRole(AtkCocoa.Roles.AXGroup, "pad header"); Accessible.SetSubRole("XAPadHeader"); // Take the button accessibles back from the strip if (strip != null) { fromAccessible = strip.Accessible; toAccessible = Accessible; } } else { Accessible.SetRole(AtkCocoa.Roles.AXRadioButton, "tab"); Accessible.SetSubRole(""); // Give the button accessibles to the strip if (strip != null) { fromAccessible = Accessible; toAccessible = strip.Accessible; } } if (fromAccessible != null && toAccessible != null) { fromAccessible.TransferAccessibleChild(toAccessible, btnDock.Accessible); fromAccessible.TransferAccessibleChild(toAccessible, btnClose.Accessible); } }
public void InsertTab(int index, Tab tab) { if (index < 0 || index >= tabs.Count) { tabs.Add(tab); tabSizes.Add(tab.Size); } else { tabs.Insert(index, tab); tabSizes.Insert(index, tab.Size); } if (tabs.Count == 1) { tab.Active = true; } else if (activeTab >= index) { activeTab++; } if (focusedTab >= index) { focusedTab++; } QueueResize(); tab.Allocation = GetBounds(tab); Accessible.AddAccessibleElement(tab.Accessible); tab.AccessibilityPressed += OnTabPressed; UpdateAccessibilityTabs(); }
void UpdateAccessibility() { if (!IdeTheme.AccessibilityEnabled) { return; } if (accessibles == null) { accessibles = new Dictionary <FoldSegment, FoldingAccessible> (); } foreach (var a in accessibles.Values) { Accessible.RemoveAccessibleChild(a.Accessible); a.Dispose(); } accessibles.Clear(); // Add any folds var segments = editor.Document.FoldSegments; foreach (var f in segments) { var accessible = new FoldingAccessible(f, this, editor); accessibles [f] = accessible; Accessible.AddAccessibleChild(accessible.Accessible); } }
public SplitterWidget() { Accessible.SetRole(AtkCocoa.Roles.AXSplitter); this.VisibleWindow = false; this.AboveChild = true; }
public void ReplaceTab(int position, Tab tab) { var oldTab = tabs [position]; tabs [position] = tab; tabSizes [position] = tab.Size; if (oldTab.Active) { tab.Active = tab.Visible; } if (oldTab.Accessible != null) { Accessible.RemoveAccessibleElement(oldTab.Accessible); oldTab.AccessibilityPressed -= OnTabPressed; UpdateAccessibilityTabs(); } oldTab.Dispose(); QueueResize(); tab.Allocation = GetBounds(tab); if (tab.Accessible != null) { Accessible.AddAccessibleElement(tab.Accessible); tab.AccessibilityPressed += OnTabPressed; UpdateAccessibilityTabs(); } }
// This is only here to implement AutomationElementFromPoint; // it doesn't really work. public IElement GetElementFromHandle(IntPtr handle) { var win = Gdk.Window.ForeignNew((uint)handle); if (win == null) { return(null); } int x, y, width, height, depth; win.GetGeometry(out x, out y, out width, out height, out depth); win.GetOrigin(out x, out y); foreach (IElement element in GetRootElements()) { Component component = ((Element)element).Accessible.QueryComponent(); if (component != null) { BoundingBox extents = component.GetExtents(CoordType.Screen); if (SizeFits(extents, x, y, width, height)) { Accessible ret = component.GetAccessibleAtPoint(x, y, CoordType.Screen); if (ret == null) { return(element); } return(Element.GetElement(ret)); } } } return(null); }
/// <summary> /// Player skipped a reachable. /// </summary> /// <param name="reachableId">Reachable identifier.</param> /// <param name="type">Reachable type.</param> public void Skipped(string reachableId, Accessible type) { tracker.Trace(Tracker.Verb.Skipped.ToString().ToLower(), type.ToString().ToLower(), reachableId); }