├── .gitignore ├── screenshots └── AccessBridgeExplorer.png ├── src ├── AccessBridgeExplorer │ ├── Resources │ │ ├── Minus.png │ │ ├── Plus.png │ │ ├── Crosshair.png │ │ ├── ErrorIcon.png │ │ ├── InfoIcon.png │ │ ├── WarningIcon.png │ │ └── SmallCloseButton.png │ ├── App.config │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ └── AssemblyInfo.cs │ ├── AccessBridgeExplorer.csproj.DotSettings │ ├── NotificationPanelIcon.cs │ ├── Utils │ │ ├── Settings │ │ │ ├── UserSettingsProvider.cs │ │ │ ├── WeakEventHandlers.cs │ │ │ ├── StringUserSetting.cs │ │ │ ├── IntUserSetting.cs │ │ │ ├── BoolUserSetting.cs │ │ │ ├── SyncEventArgs.cs │ │ │ ├── IUserSettings.cs │ │ │ ├── ChangedEventArgs.cs │ │ │ ├── SettingValueChangedEventArgs.cs │ │ │ ├── UserSetting.cs │ │ │ ├── UserSettingImpl.cs │ │ │ ├── UserSettingsExtensions.cs │ │ │ ├── UserSettingBase.cs │ │ │ └── EnumUserSetting.cs │ │ ├── IWindowsHotKeyHandler.cs │ │ ├── IMessageQueue.cs │ │ ├── EnumerableExtensions.cs │ │ ├── ExceptionUtils.cs │ │ ├── TreeListViewNodeArgs.cs │ │ ├── WindowsHotKeyHandlerFactory.cs │ │ ├── TreeNodeViewModel.cs │ │ ├── SingleDelayedTask.cs │ │ ├── TreeNodeCollectionExtensions.cs │ │ ├── TreeListViewModel.cs │ │ ├── ListViewItemCollectionExtensions.cs │ │ └── ScreenUtils.cs │ ├── NotificationPanelEntry.cs │ ├── AccessibleRectInfoSelectedEventArgs.cs │ ├── UpdateInfoArgs.cs │ ├── RoundButton.cs │ ├── PropertyGroupErrorEventArgs.cs │ ├── Model │ │ ├── AccessibleNodeModelResources.cs │ │ ├── AccessibleNodeModel.cs │ │ └── NodeModel.cs │ ├── Program.cs │ ├── IExplorerFormNavigation.cs │ ├── UpdateChecker.Designer.cs │ ├── OverlayWindow.cs │ ├── TooltipWindow.cs │ ├── OverlayWindow.Designer.cs │ ├── AboutForm.cs │ ├── EventForm.cs │ ├── TooltipWindow.Designer.cs │ ├── IExplorerFormView.cs │ ├── ExceptionForm.cs │ └── PropertyListTreeViewModel.cs ├── CodeGen │ ├── App.config │ ├── Interop │ │ ├── WindowHandle.cs │ │ ├── JavaObjectHandle.cs │ │ ├── StatusResult.cs │ │ ├── NativeStructures │ │ │ ├── AccessibleActionInfo.cs │ │ │ ├── AccessibleTextSelectionInfo.cs │ │ │ ├── AccessibleRelationSetInfo.cs │ │ │ ├── AccessibleTextInfo.cs │ │ │ ├── AccessibleTextRectInfo.cs │ │ │ ├── AccessibleKeyBindingInfo.cs │ │ │ ├── AccessibleTextItemsInfo.cs │ │ │ ├── AccessibleInterfaces.cs │ │ │ ├── VisibleChildrenInfo.cs │ │ │ ├── AccessibleKeyBindings.cs │ │ │ ├── AccessibleIcons.cs │ │ │ ├── AccessibleTableCellInfo.cs │ │ │ ├── AccessibleTableInfo.cs │ │ │ ├── AccessibleIconInfo.cs │ │ │ ├── AccessibleActions.cs │ │ │ ├── AccessibleActionsToDo.cs │ │ │ ├── AccessibleRelationInfo.cs │ │ │ ├── AccessibleKeyCode.cs │ │ │ ├── AccessibleModifiers.cs │ │ │ ├── AccessibleHypertextInfo.cs │ │ │ ├── AccessibleHyperlinkInfo.cs │ │ │ ├── AccessBridgeVersionInfo.cs │ │ │ ├── AccessibleTextAttributesInfo.cs │ │ │ └── AccessibleContextInfo.cs │ │ └── Constants.cs │ ├── Definitions │ │ ├── ClassDefinition.cs │ │ ├── StructDefinition.cs │ │ ├── XmlDocDefinition.cs │ │ ├── EnumMemberDefinition.cs │ │ ├── NameTypeReference.cs │ │ ├── TypeReference.cs │ │ ├── FieldDefinition.cs │ │ ├── EventDefinition.cs │ │ ├── ArrayTypeReference.cs │ │ ├── EnumDefintion.cs │ │ ├── TypeDefinition.cs │ │ ├── ParameterDefinition.cs │ │ ├── WindowsAccessBridgeModel.cs │ │ ├── FunctionDefinition.cs │ │ └── XmlDocCommentCollector.cs │ ├── ElementCountAttribute.cs │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs └── WindowsAccessBridgeInterop │ ├── VersionNumber.cs │ ├── EnumerableExtensions.cs │ ├── PropertyNode.cs │ ├── Win32 │ └── NativeMethods.cs │ ├── PropertyList.cs │ ├── AccessBridgeNativeEvents.cs │ ├── AccessBridgeNativeEventsLegacy.cs │ ├── PropertyOptions.cs │ ├── AccessBridgeNativeFunctions.cs │ ├── AccessBridgeNativeFunctionsLegacy.cs │ ├── AccessibleNodeExtensions.cs │ ├── Path.cs │ ├── JOBJECT32.cs │ ├── JOBJECT64.cs │ ├── PathCursor.cs │ ├── PropertyGroup.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── AccessibleRectInfo.cs │ ├── AccessibleTextReader.cs │ ├── WindowsAccessBridgeInterop.csproj │ └── AccessibleWindow.cs ├── new-feature-ideas.txt ├── new-release-checklist.txt ├── CONTRIBUTING.md ├── CHANGES.md └── AccessBridgeExplorer.sln /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | Debug/ 3 | Release/ 4 | *.suo 5 | *.sdf 6 | *.opensdf 7 | *.user 8 | *.log 9 | -------------------------------------------------------------------------------- /screenshots/AccessBridgeExplorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/access-bridge-explorer/HEAD/screenshots/AccessBridgeExplorer.png -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Resources/Minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/access-bridge-explorer/HEAD/src/AccessBridgeExplorer/Resources/Minus.png -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Resources/Plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/access-bridge-explorer/HEAD/src/AccessBridgeExplorer/Resources/Plus.png -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Resources/Crosshair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/access-bridge-explorer/HEAD/src/AccessBridgeExplorer/Resources/Crosshair.png -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Resources/ErrorIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/access-bridge-explorer/HEAD/src/AccessBridgeExplorer/Resources/ErrorIcon.png -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Resources/InfoIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/access-bridge-explorer/HEAD/src/AccessBridgeExplorer/Resources/InfoIcon.png -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Resources/WarningIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/access-bridge-explorer/HEAD/src/AccessBridgeExplorer/Resources/WarningIcon.png -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Resources/SmallCloseButton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/access-bridge-explorer/HEAD/src/AccessBridgeExplorer/Resources/SmallCloseButton.png -------------------------------------------------------------------------------- /src/CodeGen/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/AccessBridgeExplorer.csproj.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | No -------------------------------------------------------------------------------- /new-feature-ideas.txt: -------------------------------------------------------------------------------- 1 | * Search function 2 | * Allow searching the accessibility tree for nodes with a specific role, name, etc. 3 | * Scope: Abitility to define which part of the tree to searching 4 | * What: Ability to define what to search for (role, name, position, etc.) 5 | 6 | * Option to define maximum # of events to display in the "Events" list view 7 | 8 | * Ability to filter events by JVM id, window, etc. 9 | 10 | * Move all options into a "Settings" dialog (menu is getting clutered) 11 | 12 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/WindowHandle.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Interop { 16 | public struct WindowHandle { 17 | } 18 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/JavaObjectHandle.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Interop { 16 | public struct JavaObjectHandle { 17 | } 18 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/ClassDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Definitions { 16 | public class ClassDefinition : TypeDefinition { 17 | } 18 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/StructDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Definitions { 16 | public class StructDefinition : TypeDefinition { 17 | } 18 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/XmlDocDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Definitions { 16 | public class XmlDocDefinition { 17 | public string Summary { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/NotificationPanelIcon.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer { 16 | public enum NotificationPanelIcon { 17 | Info, 18 | Warning, 19 | Error, 20 | } 21 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/EnumMemberDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Definitions { 16 | public class EnumMemberDefinition { 17 | public string Name { get; set; } 18 | public string Value { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/UserSettingsProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer.Utils.Settings { 16 | public static class UserSettingsProvider { 17 | public static IUserSettings Instance { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/VersionNumber.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace WindowsAccessBridgeInterop { 16 | public static class VersionNumber { 17 | public const string Product = "1.1.0"; 18 | public const string File = Product + ".0"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/IWindowsHotKeyHandler.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils { 18 | public interface IWindowsHotKeyHandler : IDisposable { 19 | bool IsRegistered { get; set; } 20 | 21 | event EventHandler KeyPressed; 22 | } 23 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/IMessageQueue.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils { 18 | public interface IMessageQueue { 19 | void InvokeLater(Action action); 20 | void Invoke(Action action); 21 | T Compute(Func function); 22 | } 23 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/NameTypeReference.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Definitions { 16 | public class NameTypeReference : TypeReference { 17 | public string Name { get; set; } 18 | 19 | public override string ToString() { 20 | return Name; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/TypeReference.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Definitions { 16 | /// 17 | /// Common abstraction of a and . 19 | /// 20 | public abstract class TypeReference { 21 | } 22 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/NotificationPanelEntry.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer { 18 | public class NotificationPanelEntry { 19 | public string Text { get; set; } 20 | public NotificationPanelIcon Icon { get; set; } 21 | public Func IsExpired { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/FieldDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.InteropServices; 16 | 17 | namespace CodeGen.Definitions { 18 | public class FieldDefinition { 19 | public TypeReference Type { get; set; } 20 | public string Name { get; set; } 21 | public MarshalAsAttribute MarshalAs { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/WeakEventHandlers.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils.Settings { 18 | public class WeakEventHandlers : WeakDelegateList { 19 | } 20 | 21 | public class WeakEventHandlers : WeakDelegateList> where T : EventArgs { 22 | } 23 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/AccessibleRectInfoSelectedEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using WindowsAccessBridgeInterop; 17 | 18 | namespace AccessBridgeExplorer { 19 | public class AccessibleRectInfoSelectedEventArgs : EventArgs { 20 | public PropertyNode PropertyNode { get; set; } 21 | public AccessibleRectInfo AccessibleRectInfo { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/EventDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Definitions { 16 | public class EventDefinition { 17 | public string Name { get; set; } 18 | public TypeReference Type { get; set; } 19 | public FunctionDefinition DelegateFunction { get; set; } 20 | public XmlDocDefinition XmlDocDefinition { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/StatusResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Interop { 16 | /// 17 | /// Indicates an entry point that returns a BOOLEAN value indicating 18 | /// success/failure. This is important to make sure that we don't look at the 19 | /// result of out/ref parameters in case of failures. 20 | /// 21 | public struct StatusResult { 22 | } 23 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/EnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | 18 | namespace AccessBridgeExplorer.Utils { 19 | public static class EnumerableExtensions { 20 | public static void ForEach(this IEnumerable source, Action action) { 21 | foreach (var item in source) { 22 | action(item); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/CodeGen/Definitions/ArrayTypeReference.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace CodeGen.Definitions { 16 | public class ArrayTypeReference : TypeReference { 17 | public TypeReference ElementType { get; set; } 18 | public ElementCountAttribute ElementCountAttribute { get; set; } 19 | 20 | public override string ToString() { 21 | return string.Format("{0}[]", ElementType); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/CodeGen/ElementCountAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace CodeGen { 18 | public class ElementCountAttribute : Attribute { 19 | private readonly string _fieldName; 20 | 21 | public ElementCountAttribute(string fieldName) { 22 | _fieldName = fieldName; 23 | } 24 | 25 | public string FieldName { 26 | get { return _fieldName; } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/EnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | 18 | namespace WindowsAccessBridgeInterop { 19 | internal static class EnumerableExtensions { 20 | public static void ForEach(this IEnumerable source, Action action) { 21 | foreach (var item in source) { 22 | action(item); 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/StringUserSetting.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer.Utils.Settings { 16 | public class StringUserSetting : UserSettingImpl { 17 | public StringUserSetting(IUserSettings userSettings, string key, string defaultValue) : 18 | base(userSettings, key, defaultValue, 19 | userSettings.GetValue, 20 | userSettings.SetValue, 21 | s => s) { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/UpdateInfoArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer { 18 | public class UpdateInfoArgs : EventArgs { 19 | /// 20 | /// Version # of the latest release. 21 | /// 22 | public Version Version { get; set; } 23 | /// 24 | /// Url where the latest release installation can be found. 25 | /// 26 | public Uri Url { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/IntUserSetting.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer.Utils.Settings { 16 | public class IntUserSetting : UserSettingImpl { 17 | public IntUserSetting(IUserSettings userSettings, string key, int defaultValue) : 18 | base(userSettings, key, defaultValue, 19 | userSettings.GetIntValue, 20 | userSettings.SetIntValue, 21 | s => UserSettingsExtensions.ConvertIntValue(s, defaultValue)) { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/RoundButton.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Drawing.Drawing2D; 16 | using System.Windows.Forms; 17 | 18 | namespace AccessBridgeExplorer { 19 | public class RoundButton : Button { 20 | protected override void OnPaint(PaintEventArgs e) { 21 | var grPath = new GraphicsPath(); 22 | grPath.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height); 23 | Region = new System.Drawing.Region(grPath); 24 | base.OnPaint(e); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/BoolUserSetting.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer.Utils.Settings { 16 | public class BoolUserSetting : UserSettingImpl { 17 | public BoolUserSetting(IUserSettings userSettings, string key, bool defaultValue) : 18 | base(userSettings, key, defaultValue, 19 | userSettings.GetBoolValue, 20 | userSettings.SetBoolValue, 21 | s => UserSettingsExtensions.ConvertBoolValue(s, defaultValue)) { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/EnumDefintion.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | 17 | namespace CodeGen.Definitions { 18 | public class EnumDefinition { 19 | private List _members = new List(); 20 | 21 | public string Name { get; set; } 22 | public NameTypeReference Type { get; set; } 23 | public bool IsFlags { get; set; } 24 | 25 | public List Members { 26 | get { return _members; } 27 | set { _members = value; } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/PropertyGroupErrorEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.IO; 17 | using WindowsAccessBridgeInterop; 18 | 19 | namespace AccessBridgeExplorer { 20 | public class PropertyGroupErrorEventArgs : ErrorEventArgs { 21 | private readonly PropertyGroup _propertyGroup; 22 | 23 | public PropertyGroupErrorEventArgs(PropertyGroup propertyGroup, Exception exception) : base(exception) { 24 | _propertyGroup = propertyGroup; 25 | } 26 | 27 | public PropertyGroup PropertyGroup { 28 | get { return _propertyGroup; } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/TypeDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | 17 | namespace CodeGen.Definitions { 18 | /// 19 | /// Common abstraction of a and . 21 | /// 22 | public abstract class TypeDefinition { 23 | private List _fields = new List(); 24 | 25 | public string Name { get; set; } 26 | 27 | public List Fields { 28 | get { return _fields; } 29 | set { _fields = value; } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace AccessBridgeExplorer.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/PropertyNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace WindowsAccessBridgeInterop { 16 | /// 17 | /// A (name, value) pair. 18 | /// 19 | public class PropertyNode { 20 | private readonly string _name; 21 | private readonly object _value; 22 | 23 | public PropertyNode(string name, object value) { 24 | _name = name; 25 | _value = value; 26 | } 27 | 28 | public string Name { 29 | get { return _name; } 30 | } 31 | 32 | public object Value { 33 | get { return _value; } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/SyncEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils.Settings { 18 | public class SyncEventArgs : EventArgs { 19 | private readonly UserSetting _userSetting; 20 | private readonly T _value; 21 | 22 | public SyncEventArgs(UserSetting userSetting, T value) { 23 | _userSetting = userSetting; 24 | _value = value; 25 | } 26 | 27 | public UserSetting Setting { 28 | get { return _userSetting; } 29 | } 30 | 31 | public T Value { 32 | get { return _value; } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/Win32/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Drawing; 17 | using System.Runtime.InteropServices; 18 | 19 | namespace WindowsAccessBridgeInterop.Win32 { 20 | public static class NativeMethods { 21 | [DllImport("user32.dll")] 22 | public static extern IntPtr WindowFromPoint(Point p); 23 | 24 | [DllImport("user32.dll")] 25 | [return: MarshalAs(UnmanagedType.Bool)] 26 | public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam); 27 | 28 | public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleActionInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | 18 | namespace CodeGen.Interop.NativeStructures { 19 | /// 20 | /// an action assocated with a component 21 | /// 22 | [SuppressMessage("ReSharper", "InconsistentNaming")] 23 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 24 | public struct AccessibleActionInfo { 25 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 26 | public string name; // action name 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleTextSelectionInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | [SuppressMessage("ReSharper", "InconsistentNaming")] 21 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 22 | public struct AccessibleTextSelectionInfo { 23 | public jint selectionStartIndex; 24 | public jint selectionEndIndex; 25 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.MAX_STRING_SIZE)] 26 | public string selectedText; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleRelationSetInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | [SuppressMessage("ReSharper", "InconsistentNaming")] 21 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 22 | public struct AccessibleRelationSetInfo { 23 | public jint relationCount; 24 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_RELATIONS)] 25 | [ElementCount("relationCount")] 26 | public AccessibleRelationInfo[] relations; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleTextInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | [SuppressMessage("ReSharper", "InconsistentNaming")] 21 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 22 | public struct AccessibleTextInfo { 23 | public jint charCount; // # of characters in this text object 24 | public jint caretIndex; // index of caret 25 | public jint indexAtPoint; // index at the passsed in point 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleTextRectInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | [SuppressMessage("ReSharper", "InconsistentNaming")] 21 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 22 | public struct AccessibleTextRectInfo { 23 | public jint x; // bounding rect of char at index 24 | public jint y; // " 25 | public jint width; // " 26 | public jint height; // " 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleKeyBindingInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | 18 | namespace CodeGen.Interop.NativeStructures { 19 | /// 20 | /// a key binding associates with a component 21 | /// 22 | [SuppressMessage("ReSharper", "InconsistentNaming")] 23 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 24 | public struct AccessibleKeyBindingInfo { 25 | public AccessibleKeyCode character; // the key character 26 | public AccessibleModifiers modifiers; // the key modifiers 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleTextItemsInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | 18 | namespace CodeGen.Interop.NativeStructures { 19 | [SuppressMessage("ReSharper", "InconsistentNaming")] 20 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 21 | public struct AccessibleTextItemsInfo { 22 | public char letter; 23 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 24 | public string word; 25 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.MAX_STRING_SIZE)] 26 | public string sentence; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Model/AccessibleNodeModelResources.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Drawing; 17 | using System.Windows.Forms; 18 | 19 | namespace AccessBridgeExplorer.Model { 20 | public class AccessibleNodeModelResources { 21 | private readonly TreeView _treeView; 22 | private readonly Lazy _ephemeralFont; 23 | 24 | public AccessibleNodeModelResources(TreeView treeView) { 25 | _treeView = treeView; 26 | _ephemeralFont = new Lazy(() => new Font(_treeView.Font, FontStyle.Italic)); 27 | } 28 | 29 | public Font ManagedDescendantFont { 30 | get { return _ephemeralFont.Value; } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/PropertyList.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | 17 | namespace WindowsAccessBridgeInterop { 18 | /// 19 | /// A list of . 20 | /// 21 | public class PropertyList : List { 22 | public PropertyNode AddProperty(string name, object value) { 23 | var prop = new PropertyNode(name, value); 24 | Add(prop); 25 | return prop; 26 | } 27 | 28 | public PropertyGroup AddGroup(string name, object value = null) { 29 | var group = new PropertyGroup(name, value); 30 | Add(group); 31 | return group; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleInterfaces.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Diagnostics.CodeAnalysis; 17 | 18 | namespace CodeGen.Interop.NativeStructures { 19 | [Flags] 20 | [SuppressMessage("ReSharper", "InconsistentNaming")] 21 | public enum AccessibleInterfaces { 22 | cAccessibleValueInterface = 1, // 1 << 1 (TRUE) 23 | cAccessibleActionInterface = 2, // 1 << 2 24 | cAccessibleComponentInterface = 4, // 1 << 3 25 | cAccessibleSelectionInterface = 8, // 1 << 4 26 | cAccessibleTableInterface = 16, // 1 << 5 27 | cAccessibleTextInterface = 32, // 1 << 6 28 | cAccessibleHypertextInterface = 64 // 1 << 7 29 | } 30 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/ExceptionUtils.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Text; 17 | 18 | namespace AccessBridgeExplorer.Utils { 19 | public static class ExceptionUtils { 20 | public static string FormatExceptionMessage(Exception e) { 21 | var sb = new StringBuilder(); 22 | sb.Append(e.Message); 23 | sb.AppendLine(); 24 | if (e.InnerException != null) { 25 | sb.Append("Details:"); 26 | sb.AppendLine(); 27 | for (var ex = e.InnerException; ex != null; ex = ex.InnerException) { 28 | sb.AppendFormat(" * {0}", ex.Message); 29 | sb.AppendLine(); 30 | } 31 | } 32 | return sb.ToString(); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Reflection; 17 | using System.Windows.Forms; 18 | using AccessBridgeExplorer.Utils.Settings; 19 | 20 | namespace AccessBridgeExplorer { 21 | static class Program { 22 | /// 23 | /// The main entry point for the application. 24 | /// 25 | [STAThread] 26 | static void Main() { 27 | UserSettingsProvider.Instance = new UserSettings(Assembly.GetEntryAssembly().GetName().Name); 28 | 29 | Application.EnableVisualStyles(); 30 | Application.SetCompatibleTextRenderingDefault(false); 31 | Application.Run(new ExplorerForm()); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/AccessBridgeNativeEvents.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace WindowsAccessBridgeInterop { 16 | partial class AccessBridgeNativeEvents { 17 | private readonly AccessBridgeEntryPoints _entryPoints; 18 | 19 | public AccessBridgeNativeEvents(AccessBridgeEntryPoints entryPoints) { 20 | _entryPoints = entryPoints; 21 | } 22 | 23 | public AccessBridgeEntryPoints EntryPoints { 24 | get { return _entryPoints; } 25 | } 26 | 27 | public override void Dispose() { 28 | DetachForwarders(); 29 | } 30 | 31 | private JavaObjectHandle Wrap(int vmid, JOBJECT64 handle) { 32 | return new JavaObjectHandle(vmid, handle); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/VisibleChildrenInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using AccessibleContext = CodeGen.Interop.JavaObjectHandle; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | [SuppressMessage("ReSharper", "InconsistentNaming")] 21 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 22 | public struct VisibleChildrenInfo { 23 | public int returnedChildrenCount; // number of children returned 24 | 25 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_VISIBLE_CHILDREN)] 26 | [ElementCount("returnedChildrenCount")] 27 | public AccessibleContext[] children; // the visible children 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/AccessBridgeNativeEventsLegacy.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace WindowsAccessBridgeInterop { 16 | partial class AccessBridgeNativeEventsLegacy { 17 | private readonly AccessBridgeEntryPointsLegacy _entryPoints; 18 | 19 | public AccessBridgeNativeEventsLegacy(AccessBridgeEntryPointsLegacy entryPoints) { 20 | _entryPoints = entryPoints; 21 | } 22 | 23 | public AccessBridgeEntryPointsLegacy EntryPoints { 24 | get { return _entryPoints; } 25 | } 26 | 27 | public override void Dispose() { 28 | DetachForwarders(); 29 | } 30 | 31 | private JavaObjectHandle Wrap(int vmid, JOBJECT32 handle) { 32 | return new JavaObjectHandle(vmid, handle); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/Constants.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | 17 | namespace CodeGen.Interop { 18 | [SuppressMessage("ReSharper", "InconsistentNaming")] 19 | public static class Constants { 20 | public const int MAX_STRING_SIZE = 1024; 21 | public const int SHORT_STRING_SIZE = 256; 22 | public const int MAX_RELATIONS = 5; 23 | public const int MAX_VISIBLE_CHILDREN = 256; 24 | public const int MAX_ACTION_INFO = 256; 25 | public const int MAX_ACTIONS_TO_DO = 32; 26 | public const int MAX_KEY_BINDINGS = 10; 27 | public const int MAX_ICON_INFO = 8; 28 | public const int MAX_RELATION_TARGETS = 25; 29 | public const int MAX_HYPERLINKS = 64; // maximum number of hyperlinks returned 30 | } 31 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleKeyBindings.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | 18 | namespace CodeGen.Interop.NativeStructures { 19 | /// 20 | /// all of the key bindings associated with a component 21 | /// 22 | [SuppressMessage("ReSharper", "InconsistentNaming")] 23 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 24 | public struct AccessibleKeyBindings { 25 | public int keyBindingsCount; // number of key bindings 26 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_KEY_BINDINGS)] 27 | [ElementCount("keyBindingsCount")] 28 | public AccessibleKeyBindingInfo[] keyBindingInfo; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/IUserSettings.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.IO; 17 | 18 | namespace AccessBridgeExplorer.Utils.Settings { 19 | /// 20 | /// Abstraction over a central dictionary of settings, with eventing model 21 | /// for load/save/changes. 22 | /// 23 | public interface IUserSettings { 24 | event EventHandler Error; 25 | event EventHandler Loaded; 26 | event EventHandler Saving; 27 | event EventHandler ValueChanged; 28 | 29 | string GetValue(string key, string defaultValue); 30 | void SetValue(string key, string defaultValue, string value); 31 | 32 | void Load(); 33 | void Save(); 34 | void Clear(); 35 | } 36 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleIcons.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | /// 21 | /// all of the icons associated with a component 22 | /// 23 | [SuppressMessage("ReSharper", "InconsistentNaming")] 24 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 25 | public struct AccessibleIcons { 26 | public jint iconsCount; // number of icons 27 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_ICON_INFO)] 28 | [ElementCount("iconsCount")] 29 | public AccessibleIconInfo[] iconInfo; // the icons 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleTableCellInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using AccessibleContext = CodeGen.Interop.JavaObjectHandle; 18 | using jint = System.Int32; 19 | using jboolean = System.Byte; 20 | 21 | namespace CodeGen.Interop.NativeStructures { 22 | 23 | [SuppressMessage("ReSharper", "InconsistentNaming")] 24 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 25 | public class AccessibleTableCellInfo { 26 | public AccessibleContext accessibleContext; 27 | public jint index; 28 | public jint row; 29 | public jint column; 30 | public jint rowExtent; 31 | public jint columnExtent; 32 | public jboolean isSelected; 33 | } 34 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleTableInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using AccessibleContext = CodeGen.Interop.JavaObjectHandle; 18 | using jint = System.Int32; 19 | 20 | namespace CodeGen.Interop.NativeStructures { 21 | [SuppressMessage("ReSharper", "InconsistentNaming")] 22 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 23 | public class AccessibleTableInfo { 24 | public AccessibleContext caption; // AccessibleContext 25 | public AccessibleContext summary; // AccessibleContext 26 | public jint rowCount; 27 | public jint columnCount; 28 | public AccessibleContext accessibleContext; 29 | public AccessibleContext accessibleTable; 30 | } 31 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/TreeListViewNodeArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils { 18 | public class NodeArgs : EventArgs where TNode : class { 19 | private readonly TNode _node; 20 | 21 | public NodeArgs(TNode node) { 22 | _node = node; 23 | } 24 | 25 | public TNode Node { 26 | get { return _node; } 27 | } 28 | } 29 | 30 | public class NodeVisibilityChangedArg : NodeArgs where TNode : class { 31 | private readonly bool _visible; 32 | 33 | public NodeVisibilityChangedArg(TNode node, bool visible) 34 | : base(node) { 35 | _visible = visible; 36 | } 37 | 38 | public bool Visible { 39 | get { return _visible; } 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /new-release-checklist.txt: -------------------------------------------------------------------------------- 1 | When making a new release 2 | 3 | Master branch 4 | ============= 5 | 1. Update version # in WindowsAccessBridgeInterop\VersionNumber.cs 6 | 7 | 2. Run "Build | Batch Build..." in Visual Studio, selecting all 8 | configuration entries checkboxes, then click "Rebuild". 9 | 10 | 3. Go to the "bin\Release" directory and create a zip file containing all files 11 | (including the x86 directory) named "AccessBridgeExplorer-x.y.z.zip", where 12 | x.y.z is the version number (e.g. "0.9.0"). 13 | The layout should be 14 | * AccessBridgeExplorer.exe 15 | * AccessBridgeExplorer.exe.config 16 | * AccessBridgeExplorer.pdb 17 | * x86\AccessBridgeExplorer.exe 18 | * x86\AccessBridgeExplorer.exe.config 19 | * x86\AccessBridgeExplorer.pdb 20 | 21 | 4. Commit and push to github 22 | 23 | 5. Create a release named "vx.y.x" (e.g. v0.2.2) on github 24 | * Create the tag "vx.y.z" 25 | * Enter a short description as well as "What's new" 26 | * Attach the zip file built in step 3. 27 | 28 | 29 | gh-pages branch 30 | =============== 31 | 32 | 1. Update the file "latest_version.txt" with the version # and 33 | the github URL of the new release 34 | 35 | version: x.y.z 36 | url: https://github.com/google/access-bridge-explorer/releases/tag/vx.y.z 37 | 38 | 3. Commit and push -- this will ensure people running older version get 39 | a "new version available" message 40 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleIconInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | /// 21 | /// an icon assocated with a component 22 | /// 23 | [SuppressMessage("ReSharper", "InconsistentNaming")] 24 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 25 | public struct AccessibleIconInfo { 26 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 27 | public string description; // icon description 28 | public jint height; // icon height 29 | public jint width; // icon width 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleActions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | /// 21 | /// all of the actions associated with a component 22 | /// 23 | [SuppressMessage("ReSharper", "InconsistentNaming")] 24 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 25 | public class AccessibleActions { 26 | public jint actionsCount; // number of actions 27 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_ACTION_INFO)] 28 | [ElementCount("actionsCount")] 29 | public AccessibleActionInfo[] actionInfo; // the action information 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/IExplorerFormNavigation.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | 18 | namespace AccessBridgeExplorer { 19 | public interface IExplorerFormNavigation { 20 | int Version { get; } 21 | bool ForwardAvailable { get; } 22 | bool BackwardAvailable { get; } 23 | 24 | IEnumerable BackwardEntries { get; } 25 | IEnumerable ForwardEntries { get; } 26 | 27 | void Clear(); 28 | void AddNavigationAction(NavigationEntry entry); 29 | void NavigateForward(); 30 | void NavigateBackward(); 31 | void NavigateTo(NavigationEntry entry); 32 | } 33 | 34 | public class NavigationEntry { 35 | public string Description { get; set; } 36 | public Action Action { get; set; } 37 | } 38 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleActionsToDo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | /// 21 | /// list of AccessibleActions to do 22 | /// 23 | [SuppressMessage("ReSharper", "InconsistentNaming")] 24 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 25 | public struct AccessibleActionsToDo { 26 | public jint actionsCount; // number of actions to do 27 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_ACTIONS_TO_DO)] 28 | [ElementCount("actionsCount")] 29 | public AccessibleActionInfo[] actions;// the accessible actions to do 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleRelationInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | using AccessibleContext = CodeGen.Interop.JavaObjectHandle; 19 | 20 | namespace CodeGen.Interop.NativeStructures { 21 | [SuppressMessage("ReSharper", "InconsistentNaming")] 22 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 23 | public struct AccessibleRelationInfo { 24 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 25 | public string key; 26 | public jint targetCount; 27 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_RELATION_TARGETS)] 28 | [ElementCount("targetCount")] 29 | public AccessibleContext[] targets; // AccessibleContexts 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/ChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils.Settings { 18 | public class ChangedEventArgs : EventArgs { 19 | private readonly UserSetting _userSetting; 20 | private readonly T _previousValue; 21 | private readonly T _newValue; 22 | 23 | public ChangedEventArgs(UserSetting userSetting, T previousValue, T newValue) { 24 | _userSetting = userSetting; 25 | _previousValue = previousValue; 26 | _newValue = newValue; 27 | } 28 | 29 | public UserSetting Setting { 30 | get { return _userSetting; } 31 | } 32 | 33 | public T PreviousValue { 34 | get { return _previousValue; } 35 | } 36 | 37 | public T NewValue { 38 | get { return _newValue; } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleKeyCode.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | 17 | namespace CodeGen.Interop.NativeStructures { 18 | /// 19 | /// The supported control code keys are: 20 | /// 21 | [SuppressMessage("ReSharper", "InconsistentNaming")] 22 | public enum AccessibleKeyCode : ushort { 23 | ACCESSIBLE_VK_BACK_SPACE = 8, 24 | ACCESSIBLE_VK_DELETE = 127, 25 | ACCESSIBLE_VK_DOWN = 40, 26 | ACCESSIBLE_VK_END = 35, 27 | ACCESSIBLE_VK_HOME = 36, 28 | ACCESSIBLE_VK_INSERT = 155, 29 | ACCESSIBLE_VK_KP_DOWN = 225, 30 | ACCESSIBLE_VK_KP_LEFT = 226, 31 | ACCESSIBLE_VK_KP_RIGHT = 227, 32 | ACCESSIBLE_VK_KP_UP = 224, 33 | ACCESSIBLE_VK_LEFT = 37, 34 | ACCESSIBLE_VK_PAGE_DOWN = 34, 35 | ACCESSIBLE_VK_PAGE_UP = 33, 36 | ACCESSIBLE_VK_RIGHT = 39, 37 | ACCESSIBLE_VK_UP = 38, 38 | } 39 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleModifiers.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Diagnostics.CodeAnalysis; 17 | 18 | namespace CodeGen.Interop.NativeStructures { 19 | /// 20 | /// keyboard character modifiers 21 | /// 22 | [Flags] 23 | [SuppressMessage("ReSharper", "InconsistentNaming")] 24 | public enum AccessibleModifiers { 25 | ACCESSIBLE_SHIFT_KEYSTROKE = 1, 26 | ACCESSIBLE_CONTROL_KEYSTROKE = 2, 27 | ACCESSIBLE_META_KEYSTROKE = 4, 28 | ACCESSIBLE_ALT_KEYSTROKE = 8, 29 | ACCESSIBLE_ALT_GRAPH_KEYSTROKE = 16, 30 | ACCESSIBLE_BUTTON1_KEYSTROKE = 32, 31 | ACCESSIBLE_BUTTON2_KEYSTROKE = 64, 32 | ACCESSIBLE_BUTTON3_KEYSTROKE = 128, 33 | ACCESSIBLE_FKEY_KEYSTROKE = 256, // F key pressed, character contains 1-24 34 | ACCESSIBLE_CONTROLCODE_KEYSTROKE = 512, // Control code key pressed, character contains control code. 35 | } 36 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/ParameterDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.InteropServices; 16 | using System.Text; 17 | 18 | namespace CodeGen.Definitions { 19 | public class ParameterDefinition { 20 | public string Name { get; set; } 21 | public MarshalAsAttribute MarshalAs { get; set; } 22 | public TypeReference Type { get; set; } 23 | public bool IsOut { get; set; } 24 | public bool IsRef { get; set; } 25 | public bool IsOutAttribute { get; set; } 26 | 27 | public override string ToString() { 28 | var sb = new StringBuilder(); 29 | if (IsOutAttribute) { 30 | sb.Append("[Out]"); 31 | } 32 | 33 | if (IsOut) { 34 | sb.Append("out "); 35 | } else if (IsRef) { 36 | sb.Append("ref "); 37 | } 38 | sb.Append(Type); 39 | sb.Append(" "); 40 | sb.Append(Name); 41 | return sb.ToString(); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleHypertextInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | using AccessibleContext = CodeGen.Interop.JavaObjectHandle; 19 | 20 | namespace CodeGen.Interop.NativeStructures { 21 | /// 22 | /// Hypertext information 23 | /// 24 | [SuppressMessage("ReSharper", "InconsistentNaming")] 25 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 26 | public struct AccessibleHypertextInfo { 27 | /// number of hyperlinks 28 | public jint linkCount; 29 | 30 | /// the hyperlinks 31 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_HYPERLINKS)] 32 | [ElementCount("linkCount")] 33 | public AccessibleHyperlinkInfo[] links; 34 | 35 | /// AccessibleHypertext object 36 | public AccessibleContext accessibleHypertext; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/PropertyOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace WindowsAccessBridgeInterop { 18 | /// 19 | /// Flags specifiying what properties to include in . 20 | /// 21 | [Flags] 22 | public enum PropertyOptions { 23 | AccessibleContextInfo = 1 << 1, 24 | ObjectDepth = 1 << 2, 25 | ParentContext = 1 << 3, 26 | TopLevelWindowInfo = 1 << 4, 27 | ActiveDescendent = 1 << 5, 28 | VisibleChildren = 1 << 6, 29 | AccessibleActions = 1 << 7, 30 | AccessibleKeyBindings = 1 << 8, 31 | AccessibleIcons = 1 << 9, 32 | AccessibleRelationSet = 1 << 10, 33 | AccessibleText = 1 << 11, 34 | AccessibleHyperText = 1 << 12, 35 | AccessibleValue = 1 << 13, 36 | AccessibleSelection = 1 << 14, 37 | AccessibleTable = 1 << 15, 38 | AccessibleTableCells = 1 << 16, 39 | AccessibleTableCellsSelect = 1 << 17, 40 | Children = 1 << 18, 41 | } 42 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/AccessBridgeNativeFunctions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace WindowsAccessBridgeInterop { 16 | partial class AccessBridgeNativeFunctions { 17 | private readonly AccessBridgeEntryPoints _nativeEntryPoints; 18 | 19 | public AccessBridgeNativeFunctions(AccessBridgeEntryPoints nativeEntryPoints) { 20 | _nativeEntryPoints = nativeEntryPoints; 21 | } 22 | 23 | public AccessBridgeEntryPoints EntryPoints { 24 | get { return _nativeEntryPoints; } 25 | } 26 | 27 | private bool ToBool(int value) { 28 | return value != 0; 29 | } 30 | 31 | private bool Succeeded(int value) { 32 | return ToBool(value); 33 | } 34 | 35 | private JavaObjectHandle Wrap(int vmid, JOBJECT64 handle) { 36 | return new JavaObjectHandle(vmid, handle); 37 | } 38 | 39 | // ReSharper disable once UnusedParameter.Local 40 | private JOBJECT64 Unwrap(int vmid, JavaObjectHandle objectHandle) { 41 | return objectHandle.Handle; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/SettingValueChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils.Settings { 18 | public class SettingValueChangedEventArgs : EventArgs { 19 | private readonly IUserSettings _userSettings; 20 | private readonly string _key; 21 | private readonly string _previousValue; 22 | private readonly string _newValue; 23 | 24 | public SettingValueChangedEventArgs(IUserSettings userSettings, string key, string previousValue, string newValue) { 25 | _userSettings = userSettings; 26 | _key = key; 27 | _previousValue = previousValue; 28 | _newValue = newValue; 29 | } 30 | 31 | public IUserSettings UserSettings { 32 | get { return _userSettings; } 33 | } 34 | 35 | public string Key { 36 | get { return _key; } 37 | } 38 | 39 | public string PreviousValue { 40 | get { return _previousValue; } 41 | } 42 | 43 | public string NewValue { 44 | get { return _newValue; } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/AccessBridgeNativeFunctionsLegacy.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace WindowsAccessBridgeInterop { 16 | partial class AccessBridgeNativeFunctionsLegacy { 17 | private readonly AccessBridgeEntryPointsLegacy _nativeEntryPoints; 18 | 19 | public AccessBridgeNativeFunctionsLegacy(AccessBridgeEntryPointsLegacy nativeEntryPoints) { 20 | _nativeEntryPoints = nativeEntryPoints; 21 | } 22 | 23 | public AccessBridgeEntryPointsLegacy EntryPoints { 24 | get { return _nativeEntryPoints; } 25 | } 26 | 27 | private bool ToBool(int value) { 28 | return value != 0; 29 | } 30 | 31 | private bool Succeeded(int value) { 32 | return ToBool(value); 33 | } 34 | 35 | private JavaObjectHandle Wrap(int vmid, JOBJECT32 handle) { 36 | return new JavaObjectHandle(vmid, handle); 37 | } 38 | 39 | // ReSharper disable once UnusedParameter.Local 40 | private JOBJECT32 Unwrap(int vmid, JavaObjectHandle objectHandle) { 41 | return objectHandle.HandleLegacy; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/AccessibleNodeExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Linq; 17 | 18 | namespace WindowsAccessBridgeInterop { 19 | public static class AccessibleNodeExtensions { 20 | public static Path BuildNodePath(this AccessibleNode childNode) { 21 | var path = new Path(); 22 | while (childNode != null) { 23 | path.AddRoot(childNode); 24 | childNode = childNode.GetParent(); 25 | if (path.Count > 1024) { 26 | throw new InvalidOperationException("Node path is too deep (more than 1024 parents). Is there a cycle in the parent chain?"); 27 | } 28 | } 29 | 30 | // Set the "manageDescendants" flag where needed 31 | var managesDescendants = false; 32 | foreach (var node in path.OfType()) { 33 | node.SetManagedDescendant(managesDescendants); 34 | if (!managesDescendants && node.GetInfo().states.Contains("manages descendants")) { 35 | managesDescendants = true; 36 | } 37 | } 38 | return path; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleHyperlinkInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | using AccessibleContext = CodeGen.Interop.JavaObjectHandle; 19 | 20 | namespace CodeGen.Interop.NativeStructures { 21 | /// 22 | /// Hyperlink information 23 | /// 24 | [SuppressMessage("ReSharper", "InconsistentNaming")] 25 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 26 | public struct AccessibleHyperlinkInfo { 27 | /// the hyperlink text 28 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 29 | public string text; 30 | 31 | /// index in the hypertext document where the link begins 32 | public jint startIndex; 33 | 34 | /// index in the hypertext document where the link ends 35 | public jint endIndex; 36 | 37 | /// AccessibleHyperlink object 38 | public AccessibleContext accessibleHyperlink; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/WindowsHotKeyHandlerFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Windows.Forms; 16 | 17 | namespace AccessBridgeExplorer.Utils { 18 | public class WindowsHotKeyHandlerFactory { 19 | private readonly IWin32Window _owner; 20 | 21 | public WindowsHotKeyHandlerFactory(IWin32Window owner) { 22 | _owner = owner; 23 | } 24 | 25 | /// The identifier of the hot key. If a hot key already 26 | /// exists with the same control and id parameters, see Remarks for the 27 | /// action taken. An application must specify an id value in the range 28 | /// 0x0000 through 0xBFFF. A shared DLL must specify a value in the range 29 | /// 0xC000 through 0xFFFF (the range returned by the GlobalAddAtom 30 | /// function). To avoid conflicts with hot-key identifiers defined by other 31 | /// shared DLLs, a DLL should use the GlobalAddAtom function to obtain the 32 | /// hot-key identifier. 33 | /// 34 | public IWindowsHotKeyHandler CreateHandler(int id, Keys key) { 35 | return new WindowsHotKeyHandler(_owner, id, key); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/WindowsAccessBridgeModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | 17 | namespace CodeGen.Definitions { 18 | public class WindowsAccessBridgeModel { 19 | private readonly List _functions = new List(); 20 | private readonly List _events = new List(); 21 | private readonly List _enums = new List(); 22 | private readonly List _structs = new List(); 23 | private readonly List _classes = new List(); 24 | 25 | public List Functions { 26 | get { return _functions; } 27 | } 28 | 29 | public List Events { 30 | get { return _events; } 31 | } 32 | 33 | public List Enums { 34 | get { return _enums; } 35 | } 36 | 37 | public List Structs { 38 | get { return _structs; } 39 | } 40 | 41 | public List Classes { 42 | get { return _classes; } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/UserSetting.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils.Settings { 18 | /// 19 | /// Abstraction over a user setting with a unique key and a strongly typed value. 20 | /// 21 | public abstract class UserSetting { 22 | /// 23 | /// The unique key of the setting 24 | /// 25 | public abstract string Key { get; } 26 | /// 27 | /// The current value of the setting 28 | /// 29 | public abstract T Value { get; set; } 30 | 31 | /// 32 | /// Invoked when the setting is (initially) loaded from the user settings store. 33 | /// 34 | public abstract event EventHandler Loaded; 35 | /// 36 | /// Invoked when the setting value is changed. 37 | /// 38 | public abstract event EventHandler> Changed; 39 | /// 40 | /// Invoked when the setting value is (initially) loaded or changed. 41 | /// 42 | public abstract event EventHandler> Sync; 43 | } 44 | } -------------------------------------------------------------------------------- /src/CodeGen/Definitions/FunctionDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | using System.Runtime.InteropServices; 17 | using System.Text; 18 | 19 | namespace CodeGen.Definitions { 20 | public class FunctionDefinition { 21 | private List _parameters = new List(); 22 | 23 | public TypeReference ReturnType { get; set; } 24 | public string Name { get; set; } 25 | public MarshalAsAttribute MarshalAs { get; set; } 26 | 27 | public List Parameters { 28 | get { return _parameters; } 29 | set { _parameters = value; } 30 | } 31 | 32 | public XmlDocDefinition XmlDocDefinition { get; set; } 33 | 34 | 35 | public override string ToString() { 36 | var sb = new StringBuilder(); 37 | sb.Append(ReturnType); 38 | sb.Append(" "); 39 | sb.Append(Name ?? ""); 40 | sb.Append("("); 41 | bool first = true; 42 | foreach (var p in Parameters) { 43 | if (first) 44 | first = false; 45 | else { 46 | sb.Append(", "); 47 | } 48 | sb.Append(p); 49 | } 50 | sb.Append(")"); 51 | return sb.ToString(); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessBridgeVersionInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | 18 | namespace CodeGen.Interop.NativeStructures { 19 | [SuppressMessage("ReSharper", "InconsistentNaming")] 20 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 21 | public struct AccessBridgeVersionInfo { 22 | /// 23 | /// output of "java -version" 24 | /// 25 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 26 | public string VMversion; 27 | 28 | /// 29 | /// version of the AccessBridge.class 30 | /// 31 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 32 | public string bridgeJavaClassVersion; 33 | 34 | /// 35 | /// version of JavaAccessBridge.dll 36 | /// 37 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 38 | public string bridgeJavaDLLVersion; 39 | 40 | /// 41 | /// version of WindowsAccessBridge.dll 42 | /// 43 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 44 | public string bridgeWinDLLVersion; 45 | 46 | } 47 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/Path.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | 19 | namespace WindowsAccessBridgeInterop { 20 | /// 21 | /// Represents a path from a root node to a leaf node. 22 | /// 23 | public class Path : IEnumerable { 24 | private readonly List _items = new List(); 25 | 26 | public T Root { 27 | get { return _items.FirstOrDefault(); } 28 | } 29 | 30 | public T Leaf { 31 | get { return _items.LastOrDefault(); } 32 | } 33 | 34 | public int Count { 35 | get { return _items.Count; } 36 | } 37 | 38 | public void AddRoot(T item) { 39 | //TODO: Make this more efficient (N^2 when adding parents). 40 | _items.Insert(0, item); 41 | } 42 | 43 | public void AddLeaf(T item) { 44 | _items.Add(item); 45 | } 46 | 47 | public void RemoveLeaf() { 48 | _items.RemoveAt(_items.Count - 1); 49 | } 50 | 51 | public PathCursor CreateCursor() { 52 | return new PathCursor(_items, 0, _items.Count); 53 | } 54 | 55 | public IEnumerator GetEnumerator() { 56 | return _items.GetEnumerator(); 57 | } 58 | 59 | IEnumerator IEnumerable.GetEnumerator() { 60 | return GetEnumerator(); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/JOBJECT32.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | 18 | namespace WindowsAccessBridgeInterop { 19 | /// 20 | /// Wrapper around a 32-bit integer. This makes code slightly more typesafe 21 | /// than using Int32 values directly. 22 | /// 23 | [SuppressMessage("ReSharper", "InconsistentNaming")] 24 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 25 | public struct JOBJECT32 { 26 | public static JOBJECT32 Zero = default(JOBJECT32); 27 | 28 | private readonly int _value; 29 | 30 | public JOBJECT32(int value) { 31 | _value = value; 32 | } 33 | 34 | public int Value { 35 | get { return _value; } 36 | } 37 | 38 | public static bool operator ==(JOBJECT32 x, JOBJECT32 y) { 39 | return x._value == y._value; 40 | } 41 | 42 | public static bool operator !=(JOBJECT32 x, JOBJECT32 y) { 43 | return x._value == y._value; 44 | } 45 | 46 | public override bool Equals(object obj) { 47 | if (obj is JOBJECT32) { 48 | return this == (JOBJECT32) obj; 49 | } 50 | return false; 51 | } 52 | 53 | public override int GetHashCode() { 54 | return _value.GetHashCode(); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/JOBJECT64.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | 18 | namespace WindowsAccessBridgeInterop { 19 | /// 20 | /// Wrapper around a 64-bit integer. This makes code slightly more typesafe 21 | /// than using Int64 values directly. 22 | /// 23 | [SuppressMessage("ReSharper", "InconsistentNaming")] 24 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 25 | public struct JOBJECT64 { 26 | public static JOBJECT64 Zero = default(JOBJECT64); 27 | 28 | private readonly long _value; 29 | 30 | public JOBJECT64(long value) { 31 | _value = value; 32 | } 33 | 34 | public long Value { 35 | get { return _value; } 36 | } 37 | 38 | public static bool operator ==(JOBJECT64 x, JOBJECT64 y) { 39 | return x._value == y._value; 40 | } 41 | 42 | public static bool operator !=(JOBJECT64 x, JOBJECT64 y) { 43 | return x._value == y._value; 44 | } 45 | 46 | public override bool Equals(object obj) { 47 | if (obj is JOBJECT64) { 48 | return this == (JOBJECT64) obj; 49 | } 50 | return false; 51 | } 52 | 53 | public override int GetHashCode() { 54 | return _value.GetHashCode(); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/PathCursor.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections.Generic; 16 | 17 | namespace WindowsAccessBridgeInterop { 18 | /// 19 | /// Ability to move in a path, or in a subset of a path, without mutating 20 | /// the path itself. 21 | /// 22 | public class PathCursor { 23 | private readonly List _items; 24 | private readonly int _start; 25 | private readonly int _end; 26 | private int _index; 27 | 28 | public PathCursor(List items, int start, int end) { 29 | _items = items; 30 | _start = start; 31 | _end = end; 32 | _index = start; 33 | } 34 | 35 | public T Node { 36 | get { 37 | if (_start <= _index && _index < _end) { 38 | return _items[_index]; 39 | } 40 | return default(T); 41 | } 42 | } 43 | 44 | public bool IsValid { 45 | get { return Node != null; } 46 | } 47 | 48 | public PathCursor Clone() { 49 | return new PathCursor(_items, _index, _end); 50 | } 51 | 52 | public PathCursor MoveNext() { 53 | if (_index < _end) { 54 | _index++; 55 | } 56 | return this; 57 | } 58 | 59 | public PathCursor MovePrevious() { 60 | if (_index >= _start) { 61 | _index--; 62 | } 63 | return this; 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/UpdateChecker.Designer.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer { 16 | partial class UpdateChecker { 17 | /// 18 | /// Required designer variable. 19 | /// 20 | private System.ComponentModel.IContainer components = null; 21 | 22 | /// 23 | /// Clean up any resources being used. 24 | /// 25 | /// true if managed resources should be disposed; otherwise, false. 26 | protected override void Dispose(bool disposing) { 27 | if (disposing && (components != null)) { 28 | components.Dispose(); 29 | } 30 | base.Dispose(disposing); 31 | } 32 | 33 | #region Component Designer generated code 34 | 35 | /// 36 | /// Required method for Designer support - do not modify 37 | /// the contents of this method with the code editor. 38 | /// 39 | private void InitializeComponent() { 40 | this.components = new System.ComponentModel.Container(); 41 | this.checkTimer = new System.Windows.Forms.Timer(this.components); 42 | // 43 | // checkTimer 44 | // 45 | this.checkTimer.Tick += new System.EventHandler(this.checkTimer_Tick); 46 | 47 | } 48 | 49 | #endregion 50 | 51 | private System.Windows.Forms.Timer checkTimer; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/OverlayWindow.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.InteropServices; 16 | using System.Windows.Forms; 17 | using AccessBridgeExplorer.Utils; 18 | 19 | namespace AccessBridgeExplorer { 20 | public partial class OverlayWindow : Form { 21 | public OverlayWindow() { 22 | InitializeComponent(); 23 | AllowTransparency = true; 24 | Opacity = 0.5; 25 | } 26 | 27 | protected override CreateParams CreateParams { 28 | get { 29 | var result = base.CreateParams; 30 | result.ExStyle |= (int)User32Utils.WindowStylesEx.WS_EX_TOOLWINDOW; 31 | result.ExStyle |= (int)User32Utils.WindowStylesEx.WS_EX_TRANSPARENT; 32 | result.ExStyle |= (int)User32Utils.WindowStylesEx.WS_EX_NOACTIVATE; 33 | result.ExStyle |= (int)User32Utils.WindowStylesEx.WS_EX_LAYERED; 34 | return result; 35 | } 36 | } 37 | 38 | protected override void CreateHandle() { 39 | base.CreateHandle(); 40 | // Note: We need this because the Form.TopMost property does not respect 41 | // the "ShowWithoutActivation" flag, meaning the window will steal the 42 | // focus every time it is made visible. 43 | User32Utils.SetTopMost(new HandleRef(this, Handle), true); 44 | } 45 | 46 | protected override bool ShowWithoutActivation { 47 | get { return true; } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/TooltipWindow.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Runtime.InteropServices; 16 | using System.Windows.Forms; 17 | using AccessBridgeExplorer.Utils; 18 | 19 | namespace AccessBridgeExplorer { 20 | public partial class TooltipWindow : Form { 21 | public TooltipWindow() { 22 | InitializeComponent(); 23 | AllowTransparency = true; 24 | Opacity = 0.9; 25 | } 26 | 27 | protected override CreateParams CreateParams { 28 | get { 29 | var result = base.CreateParams; 30 | result.ExStyle |= (int)User32Utils.WindowStylesEx.WS_EX_TOOLWINDOW; 31 | result.ExStyle |= (int)User32Utils.WindowStylesEx.WS_EX_TRANSPARENT; 32 | result.ExStyle |= (int)User32Utils.WindowStylesEx.WS_EX_NOACTIVATE; 33 | result.ExStyle |= (int)User32Utils.WindowStylesEx.WS_EX_LAYERED; 34 | return result; 35 | } 36 | } 37 | 38 | protected override void CreateHandle() { 39 | base.CreateHandle(); 40 | // Note: We need this because the Form.TopMost property does not respect 41 | // the "ShowWithoutActivation" flag, meaning the window will steal the 42 | // focus every time it is made visible. 43 | User32Utils.SetTopMost(new HandleRef(this, Handle), true); 44 | } 45 | 46 | protected override bool ShowWithoutActivation { 47 | get { return true; } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/CodeGen/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Diagnostics; 17 | using System.IO; 18 | using System.Reflection; 19 | 20 | namespace CodeGen { 21 | class Program { 22 | static void Main(string[] args) { 23 | var programLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); 24 | Debug.Assert(programLocation != null, "programLocation != null"); 25 | 26 | var path1 = Path.Combine(programLocation, @"..\..\..\WindowsAccessBridgeInterop\Generated.cs"); 27 | if (args.Length >= 1) { 28 | path1 = Path.Combine(Environment.CurrentDirectory, args[0]); 29 | } 30 | var path2 = Path.Combine(programLocation, @"..\..\..\WindowsAccessBridgeInterop\Generated.Internal.cs"); 31 | if (args.Length >= 2) { 32 | path2 = Path.Combine(Environment.CurrentDirectory, args[1]); 33 | } 34 | var path3 = Path.Combine(programLocation, @"..\..\..\WindowsAccessBridgeInterop\Generated.Internal.Legacy.cs"); 35 | if (args.Length >= 3) { 36 | path3 = Path.Combine(Environment.CurrentDirectory, args[2]); 37 | } 38 | 39 | var codeGen = new CodeGen(new CodeGenOptions { 40 | PublicClassesOutputFileName = path1, 41 | InternalClassesOutputFileName = path2, 42 | InternalLegacyClassesOutputFileName = path3, 43 | }); 44 | codeGen.Generate(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/UserSettingImpl.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils.Settings { 18 | public class UserSettingImpl : UserSettingBase { 19 | private readonly Func _getter; 20 | private readonly Action _setter; 21 | private readonly Func _stringConverter; 22 | private readonly string _key; 23 | private readonly T _defaultValue; 24 | 25 | public UserSettingImpl(IUserSettings userSettings, string key, T defaultValue, 26 | Func getter, 27 | Action setter, 28 | Func stringConverter) : 29 | base(userSettings) { 30 | _getter = getter; 31 | _setter = setter; 32 | _stringConverter = stringConverter; 33 | _key = key; 34 | _defaultValue = defaultValue; 35 | } 36 | 37 | public override T ConvertString(string value) { 38 | return _stringConverter(value); 39 | } 40 | 41 | public override Func Getter { 42 | get { return _getter; } 43 | } 44 | 45 | public override Action Setter { 46 | get { return _setter; } 47 | } 48 | 49 | public override string Key { 50 | get { return _key; } 51 | } 52 | 53 | public override T DefaultValue { 54 | get { return _defaultValue; } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/TreeNodeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Windows.Forms; 16 | 17 | namespace AccessBridgeExplorer.Utils { 18 | /// 19 | /// Implementation of using a single 20 | /// as input. 21 | /// 22 | public class TreeNodeViewModel : TreeListViewModel { 23 | private readonly TreeNode _rootNode; 24 | private readonly bool _isRootVisible; 25 | 26 | public TreeNodeViewModel(TreeNode rootNode, bool isRootVisible) { 27 | _rootNode = rootNode; 28 | _isRootVisible = isRootVisible; 29 | } 30 | 31 | public override bool IsRootVisible() { 32 | return _isRootVisible; 33 | } 34 | 35 | public override TreeNode GetRootNode() { 36 | return _rootNode; 37 | } 38 | 39 | public override bool IsNodeExpandable(TreeNode node) { 40 | return node.Nodes.Count > 0; 41 | } 42 | 43 | public override bool IsNodeExpanded(TreeNode node) { 44 | return node.IsExpanded; 45 | } 46 | 47 | public override int GetChildCount(TreeNode node) { 48 | return node.Nodes.Count; 49 | } 50 | 51 | public override TreeNode GetChildAt(TreeNode node, int index) { 52 | return node.Nodes[index]; 53 | } 54 | 55 | public override string GetNodeText(TreeNode node) { 56 | return node.Text; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/SingleDelayedTask.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Timers; 17 | 18 | namespace AccessBridgeExplorer.Utils { 19 | /// 20 | /// Execution of callbacks driven by a queue with a single element. Each new 21 | /// posted callback overrides the previously enqueued callback. The callback 22 | /// executes on a thread of the default . 24 | /// 25 | public class SingleDelayedTask { 26 | private readonly Timer _timer = new Timer(); 27 | private ElapsedEventHandler _currentHandler; 28 | 29 | public SingleDelayedTask() { 30 | _timer.AutoReset = false; 31 | } 32 | 33 | /// 34 | /// Enqeue to be executed after the specified 35 | /// . The currently enqueued callback is removed 36 | /// from the queue and won't be executed. 37 | /// 38 | public void Post(TimeSpan delay, Action callback) { 39 | Cancel(); 40 | 41 | _currentHandler = (obj, args) => { 42 | callback(); 43 | }; 44 | _timer.Elapsed += _currentHandler; 45 | _timer.Interval = delay.TotalMilliseconds; 46 | _timer.Start(); 47 | } 48 | 49 | /// 50 | /// Cancels the currently enqueued delayed task if there is one. 51 | /// 52 | public void Cancel() { 53 | _timer.Stop(); 54 | if (_currentHandler != null) { 55 | _timer.Elapsed -= _currentHandler; 56 | _currentHandler = null; 57 | } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleTextAttributesInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | using jfloat = System.Single; 19 | using BOOL = System.Int32; 20 | 21 | namespace CodeGen.Interop.NativeStructures { 22 | // standard attributes for text; note: tabstops are not supported 23 | [SuppressMessage("ReSharper", "InconsistentNaming")] 24 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 25 | public class AccessibleTextAttributesInfo { 26 | public BOOL bold; 27 | public BOOL italic; 28 | public BOOL underline; 29 | public BOOL strikethrough; 30 | public BOOL superscript; 31 | public BOOL subscript; 32 | 33 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 34 | public string backgroundColor; 35 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 36 | public string foregroundColor; 37 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 38 | public string fontFamily; 39 | public jint fontSize; 40 | 41 | public jint alignment; 42 | public jint bidiLevel; 43 | 44 | public jfloat firstLineIndent; 45 | public jfloat leftIndent; 46 | public jfloat rightIndent; 47 | public jfloat lineSpacing; 48 | public jfloat spaceAbove; 49 | public jfloat spaceBelow; 50 | 51 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.MAX_STRING_SIZE)] 52 | public string fullAttributesString; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/PropertyGroup.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.IO; 17 | 18 | namespace WindowsAccessBridgeInterop { 19 | /// 20 | /// A property node that can have children (as a ). 21 | /// 22 | public class PropertyGroup : PropertyNode { 23 | private readonly PropertyList _children = new PropertyList(); 24 | 25 | public PropertyGroup(string name, object value = null) : base(name, value) { 26 | } 27 | 28 | public bool Expanded { get; set; } 29 | 30 | public event EventHandler Error; 31 | 32 | public PropertyNode AddProperty(string name, object value) { 33 | return _children.AddProperty(name, value); 34 | } 35 | 36 | public PropertyGroup AddGroup(string name, object value = null) { 37 | return _children.AddGroup(name, value); 38 | } 39 | 40 | public Action LoadChildren { get; set; } 41 | 42 | public PropertyList Children { 43 | get { 44 | if (LoadChildren != null) { 45 | var temp = LoadChildren; 46 | LoadChildren = null; 47 | try { 48 | temp(); 49 | } catch (Exception e) { 50 | OnError(new ErrorEventArgs(e)); 51 | } 52 | } 53 | return _children; 54 | } 55 | } 56 | 57 | public override string ToString() { 58 | return string.Format("Group: {0}-{1}", Name, Value ?? ""); 59 | } 60 | 61 | protected virtual void OnError(ErrorEventArgs e) { 62 | var handler = Error; 63 | if (handler != null) 64 | handler(this, e); 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/UserSettingsExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer.Utils.Settings { 16 | public static class UserSettingsExtensions { 17 | public static void SetIntValue(this IUserSettings userSettings, string key, int defaultValue, int value) { 18 | userSettings.SetValue(key, defaultValue.ToString(), value.ToString()); 19 | } 20 | 21 | public static void SetBoolValue(this IUserSettings userSettings, string key, bool defaultValue, bool value) { 22 | userSettings.SetValue(key, defaultValue ? "true" : "false", value ? "true" : "false"); 23 | } 24 | 25 | public static int GetIntValue(this IUserSettings userSettings, string key, int defaultValue) { 26 | var value = userSettings.GetValue(key, null); 27 | if (value == null) { 28 | return defaultValue; 29 | } 30 | return ConvertIntValue(value, defaultValue); 31 | } 32 | 33 | public static int ConvertIntValue(string value, int defaultValue) { 34 | int result; 35 | if (!int.TryParse(value, out result)) { 36 | return defaultValue; 37 | } 38 | return result; 39 | } 40 | 41 | public static bool GetBoolValue(this IUserSettings userSettings, string key, bool defaultValue) { 42 | var value = userSettings.GetValue(key, null); 43 | if (value == null) { 44 | return defaultValue; 45 | } 46 | 47 | return ConvertBoolValue(value, defaultValue); 48 | } 49 | 50 | public static bool ConvertBoolValue(string value, bool defaultValue) { 51 | return value == "true" ? true : value == "false" ? false : defaultValue; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Reflection; 16 | using System.Runtime.InteropServices; 17 | using WindowsAccessBridgeInterop; 18 | 19 | // General Information about an assembly is controlled through the following 20 | // set of attributes. Change these attribute values to modify the information 21 | // associated with an assembly. 22 | [assembly: AssemblyTitle("Access Bridge Explorer")] 23 | [assembly: AssemblyDescription("")] 24 | [assembly: AssemblyConfiguration("")] 25 | [assembly: AssemblyCompany("")] 26 | [assembly: AssemblyProduct("Access Bridge Explorer")] 27 | [assembly: AssemblyCopyright("Copyright 2016 Google Inc. All Rights Reserved.")] 28 | [assembly: AssemblyTrademark("")] 29 | [assembly: AssemblyCulture("")] 30 | 31 | // Setting ComVisible to false makes the types in this assembly not visible 32 | // to COM components. If you need to access a type in this assembly from 33 | // COM, set the ComVisible attribute to true on that type. 34 | [assembly: ComVisible(false)] 35 | 36 | // The following GUID is for the ID of the typelib if this project is exposed to COM 37 | [assembly: Guid("902e9f38-ef1a-4ed5-86bc-25881dbdabed")] 38 | 39 | // Version information for an assembly consists of the following four values: 40 | // 41 | // Major Version 42 | // Minor Version 43 | // Build Number 44 | // Revision 45 | // 46 | // You can specify all the values or you can default the Build and Revision Numbers 47 | // by using the '*' as shown below: 48 | // [assembly: AssemblyVersion("1.0.*")] 49 | [assembly: AssemblyVersion(VersionNumber.File)] 50 | [assembly: AssemblyFileVersion(VersionNumber.File)] 51 | -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Reflection; 16 | using System.Runtime.InteropServices; 17 | using WindowsAccessBridgeInterop; 18 | 19 | // General Information about an assembly is controlled through the following 20 | // set of attributes. Change these attribute values to modify the information 21 | // associated with an assembly. 22 | [assembly: AssemblyTitle("WindowsAccessBridgeInterop")] 23 | [assembly: AssemblyDescription("")] 24 | [assembly: AssemblyConfiguration("")] 25 | [assembly: AssemblyCompany("")] 26 | [assembly: AssemblyProduct("WindowsAccessBridgeInterop")] 27 | [assembly: AssemblyCopyright("Copyright 2016 Google Inc. All Rights Reserved.")] 28 | [assembly: AssemblyTrademark("")] 29 | [assembly: AssemblyCulture("")] 30 | 31 | // Setting ComVisible to false makes the types in this assembly not visible 32 | // to COM components. If you need to access a type in this assembly from 33 | // COM, set the ComVisible attribute to true on that type. 34 | [assembly: ComVisible(false)] 35 | 36 | // The following GUID is for the ID of the typelib if this project is exposed to COM 37 | [assembly: Guid("4b5de0e1-2f0a-426d-bb12-becb0f6f8b51")] 38 | 39 | // Version information for an assembly consists of the following four values: 40 | // 41 | // Major Version 42 | // Minor Version 43 | // Build Number 44 | // Revision 45 | // 46 | // You can specify all the values or you can default the Build and Revision Numbers 47 | // by using the '*' as shown below: 48 | // [assembly: AssemblyVersion("1.0.*")] 49 | [assembly: AssemblyVersion(VersionNumber.File)] 50 | [assembly: AssemblyFileVersion(VersionNumber.File)] 51 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/OverlayWindow.Designer.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer { 16 | partial class OverlayWindow { 17 | /// 18 | /// Required designer variable. 19 | /// 20 | private System.ComponentModel.IContainer components = null; 21 | 22 | /// 23 | /// Clean up any resources being used. 24 | /// 25 | /// true if managed resources should be disposed; otherwise, false. 26 | protected override void Dispose(bool disposing) { 27 | if (disposing && (components != null)) { 28 | components.Dispose(); 29 | } 30 | base.Dispose(disposing); 31 | } 32 | 33 | #region Windows Form Designer generated code 34 | 35 | /// 36 | /// Required method for Designer support - do not modify 37 | /// the contents of this method with the code editor. 38 | /// 39 | private void InitializeComponent() { 40 | this.SuspendLayout(); 41 | // 42 | // OverlayWindow 43 | // 44 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; 45 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); 46 | this.ClientSize = new System.Drawing.Size(379, 321); 47 | this.ControlBox = false; 48 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; 49 | this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 50 | this.Name = "OverlayWindow"; 51 | this.ShowInTaskbar = false; 52 | this.ResumeLayout(false); 53 | 54 | } 55 | 56 | #endregion 57 | } 58 | } -------------------------------------------------------------------------------- /src/CodeGen/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Reflection; 16 | using System.Runtime.InteropServices; 17 | 18 | // General Information about an assembly is controlled through the following 19 | // set of attributes. Change these attribute values to modify the information 20 | // associated with an assembly. 21 | [assembly: AssemblyTitle("Access Bridge Explorer Code Generation")] 22 | [assembly: AssemblyDescription("")] 23 | [assembly: AssemblyConfiguration("")] 24 | [assembly: AssemblyCompany("")] 25 | [assembly: AssemblyProduct("Access Bridge Explorer Code Generation")] 26 | [assembly: AssemblyCopyright("Copyright 2016 Google Inc. All Rights Reserved.")] 27 | [assembly: AssemblyTrademark("")] 28 | [assembly: AssemblyCulture("")] 29 | 30 | // Setting ComVisible to false makes the types in this assembly not visible 31 | // to COM components. If you need to access a type in this assembly from 32 | // COM, set the ComVisible attribute to true on that type. 33 | [assembly: ComVisible(false)] 34 | 35 | // The following GUID is for the ID of the typelib if this project is exposed to COM 36 | [assembly: Guid("60fb05ed-62d8-41f1-9287-df4183b7fe4f")] 37 | 38 | // Version information for an assembly consists of the following four values: 39 | // 40 | // Major Version 41 | // Minor Version 42 | // Build Number 43 | // Revision 44 | // 45 | // You can specify all the values or you can default the Build and Revision Numbers 46 | // by using the '*' as shown below: 47 | // [assembly: AssemblyVersion("1.0.*")] 48 | [assembly: AssemblyVersion(WindowsAccessBridgeInterop.VersionNumber.File)] 49 | [assembly: AssemblyFileVersion(WindowsAccessBridgeInterop.VersionNumber.File)] 50 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Model/AccessibleNodeModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Linq; 17 | using System.Windows.Forms; 18 | using WindowsAccessBridgeInterop; 19 | using AccessBridgeExplorer.Utils; 20 | 21 | namespace AccessBridgeExplorer.Model { 22 | public class AccessibleNodeModel : NodeModel { 23 | private readonly AccessibleNodeModelResources _resources; 24 | private AccessibleNode _accessibleNode; 25 | 26 | public AccessibleNodeModel(AccessibleNodeModelResources resources, AccessibleNode accessibleNode) { 27 | _resources = resources; 28 | _accessibleNode = accessibleNode; 29 | } 30 | 31 | public AccessibleNode AccessibleNode { 32 | get { return _accessibleNode; } 33 | set { _accessibleNode = value; } 34 | } 35 | 36 | public override void AddChildren(TreeNode node) { 37 | _accessibleNode.GetChildren() 38 | .Select(x => new AccessibleNodeModel(_resources, x)) 39 | .ForEach(x => { 40 | node.Nodes.Add(x.CreateTreeNode()); 41 | }); 42 | } 43 | 44 | public override void SetupTreeNode(TreeNode node) { 45 | bool hasChildren; 46 | try { 47 | hasChildren = _accessibleNode.GetChildren().Any(); 48 | } catch { 49 | hasChildren = false; 50 | } 51 | 52 | if (hasChildren) { 53 | AddFakeChild(node); 54 | } 55 | 56 | try { 57 | node.Text = _accessibleNode.GetTitle(); 58 | } catch (Exception e) { 59 | node.Text = string.Format("Error: {0}", e.Message); 60 | } 61 | 62 | if (_accessibleNode.IsManagedDescendant) { 63 | node.NodeFont = _resources.ManagedDescendantFont; 64 | } 65 | } 66 | } 67 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/UserSettingBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | 17 | namespace AccessBridgeExplorer.Utils.Settings { 18 | public abstract class UserSettingBase : UserSetting { 19 | private readonly IUserSettings _userSettings; 20 | 21 | protected UserSettingBase(IUserSettings userSettings) { 22 | _userSettings = userSettings; 23 | _userSettings.Loaded += (sender, args) => { 24 | OnLoaded(); 25 | OnSync(new SyncEventArgs(this, Value)); 26 | }; 27 | _userSettings.ValueChanged += (sender, args) => { 28 | if (Equals(Key, args.Key)) { 29 | OnChanged(new ChangedEventArgs(this, ConvertString(args.PreviousValue), ConvertString(args.NewValue))); 30 | OnSync(new SyncEventArgs(this, Value)); 31 | } 32 | }; 33 | } 34 | 35 | public override event EventHandler> Sync; 36 | public override event EventHandler Loaded; 37 | public override event EventHandler> Changed; 38 | 39 | public IUserSettings UserSettings { 40 | get { return _userSettings; } 41 | } 42 | 43 | public abstract T DefaultValue { get; } 44 | 45 | public abstract T ConvertString(string value); 46 | 47 | public abstract Func Getter { get; } 48 | 49 | public abstract Action Setter { get; } 50 | 51 | public override T Value { 52 | get { return Getter(Key, DefaultValue); } 53 | set { Setter(Key, DefaultValue, value); } 54 | } 55 | 56 | protected virtual void OnChanged(ChangedEventArgs e) { 57 | var handler = Changed; 58 | if (handler != null) handler(this, e); 59 | } 60 | 61 | protected virtual void OnSync(SyncEventArgs e) { 62 | var handler = Sync; 63 | if (handler != null) handler(this, e); 64 | } 65 | 66 | protected virtual void OnLoaded() { 67 | var handler = Loaded; 68 | if (handler != null) handler(this, EventArgs.Empty); 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/AboutForm.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Reflection; 17 | using System.Windows.Forms; 18 | using WindowsAccessBridgeInterop; 19 | 20 | namespace AccessBridgeExplorer { 21 | public partial class AboutForm : Form { 22 | public AboutForm() { 23 | InitializeComponent(); 24 | } 25 | 26 | public void FillForm(Assembly application, AccessBridge accessBridge) { 27 | applicationNameText.Text = GetAttribute(application).Title; 28 | applicationCopyrightText.Text = GetAttribute(application).Copyright; 29 | applicationVersionText.Text = string.Format("Version {0}", application.GetName().Version); 30 | 31 | try { 32 | var libraryVersion = accessBridge.LibraryVersion; 33 | accessBridgePathText.Text = string.Format("{0}", libraryVersion.FileName); 34 | accessBridgeProductText.Text = string.Format("{0}", libraryVersion.ProductName); 35 | accessBridgeVersionText.Text = string.Format("{0}", libraryVersion.FileVersion); 36 | accessBridgeLegacyText.Text = accessBridge.IsLegacy ? "Yes" : "No"; 37 | } catch (Exception e) { 38 | accessBridgePathText.Text = e.Message; 39 | accessBridgeProductText.Text = @""; 40 | accessBridgeVersionText.Text = @""; 41 | accessBridgeLegacyText.Text = @""; 42 | } 43 | } 44 | 45 | private T GetAttribute(Assembly assembly) where T : Attribute { 46 | return (T)Attribute.GetCustomAttribute(assembly, typeof(T), false); 47 | } 48 | 49 | protected override bool ProcessDialogKey(Keys keyData) { 50 | if (ModifierKeys == Keys.None && keyData == Keys.Escape) { 51 | Close(); 52 | return true; 53 | } 54 | return base.ProcessDialogKey(keyData); 55 | } 56 | 57 | private void githubUrlLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { 58 | System.Diagnostics.Process.Start(githubUrlLinkLabel.Text); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribute 2 | 3 | We'd love to accept your patches and contributions to this project. There are a 4 | just a few small guidelines you need to follow. 5 | 6 | ## Contributor License Agreement 7 | 8 | Contributions to any Google project must be accompanied by a Contributor License 9 | Agreement. This is not a copyright **assignment**, it simply gives Google 10 | permission to use and redistribute your contributions as part of the project. 11 | 12 | * If you are an individual writing original source code and you're sure you 13 | own the intellectual property, then you'll need to sign an [individual 14 | CLA][individual CLA]. 15 | 16 | * If you work for a company that wants to allow you to contribute your work, 17 | then you'll need to sign a [corporate CLA]. 18 | 19 | You generally only need to submit a CLA once, so if you've already submitted one 20 | (even if it was for a different project), you probably don't need to do it 21 | again. 22 | 23 | [individual CLA]: https://developers.google.com/open-source/cla/individual 24 | [corporate CLA]: https://developers.google.com/open-source/cla/corporate 25 | 26 | ## Submitting a patch 27 | 28 | 1. It's generally best to start by opening a new issue describing the bug or 29 | feature you're intending to fix. Even if you think it's relatively minor, 30 | it's helpful to know what people are working on. Mention in the initial 31 | issue that you are planning to work on that bug or feature so that it can be 32 | assigned to you. 33 | 34 | 2. Follow the normal process of [forking] the project, and setup a new branch 35 | to work in. It's important that each group of changes be done in separate 36 | branches in order to ensure that a pull request only includes the commits 37 | related to that bug or feature. 38 | 39 | 3. Any significant changes should almost always be accompanied by tests. The 40 | project already has good test coverage, so look at some of the existing 41 | tests if you're unsure how to go about it. 42 | 43 | 4. All contributions must be licensed Apache 2.0 and all files must have a copy 44 | of the boilerplate licence comment (can be copied from an existing file). 45 | 46 | 5. Do your best to have [well-formed commit messages] for each change. This 47 | provides consistency throughout the project, and ensures that commit 48 | messages are able to be formatted properly by various git tools. 49 | 50 | 6. Finally, push the commits to your fork and submit a [pull request]. 51 | 52 | [forking]: https://help.github.com/articles/fork-a-repo 53 | [well-formed commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html 54 | [pull request]: https://help.github.com/articles/creating-a-pull-request 55 | -------------------------------------------------------------------------------- /src/CodeGen/Definitions/XmlDocCommentCollector.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics; 16 | using System.Linq; 17 | using System.Reflection; 18 | using System.Text; 19 | using System.Xml.Linq; 20 | 21 | namespace CodeGen.Definitions { 22 | public class XmlDocCommentCollector { 23 | public XDocument Document { get; set; } 24 | 25 | public XmlDocDefinition CreateMethodDefinition(MethodInfo methodInfo) { 26 | Debug.Assert(methodInfo.DeclaringType != null, "methodInfo.DeclaringType != null"); 27 | var sb = new StringBuilder(); 28 | sb.Append("M:"); 29 | sb.Append(methodInfo.DeclaringType.FullName); 30 | sb.Append("."); 31 | sb.Append(methodInfo.Name); 32 | var parameters = methodInfo.GetParameters(); 33 | if (parameters.Length > 0) { 34 | sb.Append("("); 35 | int index = 0; 36 | foreach (var p in parameters) { 37 | if (index > 0) { 38 | sb.Append(","); 39 | } 40 | index++; 41 | sb.Append(p.ParameterType.FullName); 42 | } 43 | sb.Append(")"); 44 | } 45 | 46 | return CreateMemberDefinition(sb.ToString()); 47 | } 48 | 49 | public XmlDocDefinition CreateEventDefinition(EventInfo eventInfo) { 50 | Debug.Assert(eventInfo.DeclaringType != null, "eventInfo.DeclaringType != null"); 51 | var sb = new StringBuilder(); 52 | sb.Append("E:"); 53 | sb.Append(eventInfo.DeclaringType.FullName); 54 | sb.Append("."); 55 | sb.Append(eventInfo.Name); 56 | 57 | return CreateMemberDefinition(sb.ToString()); 58 | } 59 | 60 | public XmlDocDefinition CreateMemberDefinition(string id) { 61 | Debug.Assert(Document.Root != null, "Document.Root != null"); 62 | var element = Document.Root 63 | .Descendants("member") 64 | .Where(x => x.Attribute("name") != null && x.Attribute("name").Value == id) 65 | .FirstOrDefault(); 66 | 67 | if (element == null) 68 | return null; 69 | 70 | var summary = element.Element("summary"); 71 | return new XmlDocDefinition { 72 | Summary = summary != null ? summary.ToString() : "" 73 | }; 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/EventForm.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Windows.Forms; 17 | using WindowsAccessBridgeInterop; 18 | 19 | namespace AccessBridgeExplorer { 20 | public partial class EventForm : Form { 21 | private readonly PropertyListView _accessibleContextPropertyList; 22 | private readonly PropertyListView _oldValuePropertyList; 23 | private readonly PropertyListView _newValuePropertyList; 24 | 25 | public EventForm() { 26 | InitializeComponent(); 27 | _accessibleContextPropertyList = new PropertyListView(accessibleContextPropertyList, propertyImageList); 28 | _oldValuePropertyList = new PropertyListView(oldValuePropertyList, propertyImageList); 29 | _newValuePropertyList = new PropertyListView(newValuePropertyList, propertyImageList); 30 | 31 | //accessibleContextTabPage.Enter += (sender, args) => OnContextNodeSelect(); 32 | //oldValuePage.Enter += (sender, args) => OnOldValueSelect(); 33 | //newValuePage.Enter += (sender, args) => OnNewValueSelect(); 34 | } 35 | 36 | public event EventHandler ContextNodeSelect; 37 | public event EventHandler OldValueSelect; 38 | public event EventHandler NewValueSelect; 39 | 40 | public void SetContextNodePropertyList(PropertyList propertyList) { 41 | _accessibleContextPropertyList.SetPropertyList(propertyList); 42 | } 43 | 44 | public void SetOldValuePropertyList(PropertyList propertyList) { 45 | _oldValuePropertyList.SetPropertyList(propertyList); 46 | } 47 | 48 | public void SetNewValuePropertyList(PropertyList propertyList) { 49 | _newValuePropertyList.SetPropertyList(propertyList); 50 | } 51 | 52 | protected virtual void OnContextNodeSelect() { 53 | var handler = ContextNodeSelect; 54 | if (handler != null) handler(this, EventArgs.Empty); 55 | } 56 | 57 | protected virtual void OnOldValueSelect() { 58 | var handler = OldValueSelect; 59 | if (handler != null) handler(this, EventArgs.Empty); 60 | } 61 | 62 | protected virtual void OnNewValueSelect() { 63 | var handler = NewValueSelect; 64 | if (handler != null) handler(this, EventArgs.Empty); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/Settings/EnumUserSetting.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Reflection; 19 | 20 | namespace AccessBridgeExplorer.Utils.Settings { 21 | public class EnumUserSetting : UserSettingBase { 22 | private readonly string _key; 23 | private readonly T _defaultValue; 24 | private readonly Func _getter; 25 | private readonly Action _setter; 26 | 27 | public EnumUserSetting(IUserSettings userSettings, string key, T defaultValue) : base(userSettings) { 28 | if (!typeof(T).IsEnum) { 29 | throw new ArgumentException("Type must be an enum type"); 30 | } 31 | _key = key; 32 | _defaultValue = defaultValue; 33 | _getter = (k, d) => FromStringValue(UserSettings.GetValue(k, "")); 34 | _setter = (k, d, v) => UserSettings.SetValue(k, ToStringValue(d), ToStringValue(v)); 35 | } 36 | 37 | public override T ConvertString(string value) { 38 | return FromStringValue(value); 39 | } 40 | 41 | public override Func Getter { 42 | get { return _getter; } 43 | } 44 | 45 | public override Action Setter { 46 | get { return _setter; } 47 | } 48 | 49 | public override string Key { 50 | get { return _key; } 51 | } 52 | 53 | public override T DefaultValue { 54 | get { return _defaultValue; } 55 | } 56 | 57 | private IEnumerable> GetEnumValues() { 58 | return typeof (T) 59 | .GetFields(BindingFlags.Static | BindingFlags.Public) 60 | .Select(x => new KeyValuePair((T)x.GetValue(null), x.Name)); 61 | } 62 | 63 | private T FromStringValue(string value) { 64 | var enumValue = GetEnumValues().Where(x => x.Value == value).Select(x => x.Key).ToList(); 65 | if (enumValue.Any()) 66 | return enumValue.First(); 67 | return DefaultValue; 68 | } 69 | 70 | private string ToStringValue(T value) { 71 | var enumValue = GetEnumValues().Where(x => Equals(x.Key, value)).Select(x => x.Value).ToList(); 72 | if (enumValue.Any()) 73 | return enumValue.First(); 74 | return ""; 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/AccessibleRectInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Drawing; 17 | 18 | namespace WindowsAccessBridgeInterop { 19 | public class AccessibleRectInfo : IEquatable { 20 | private readonly AccessibleContextNode _node; 21 | 22 | public AccessibleRectInfo(AccessibleContextNode node, int x, int y, int width, int height) { 23 | _node = node; 24 | X = x; 25 | Y = y; 26 | Width = width; 27 | Height = height; 28 | } 29 | 30 | public AccessibleRectInfo(AccessibleContextNode node, Point location, Size size) : 31 | this(node, location.X, location.Y, size.Width, size.Height) { 32 | } 33 | 34 | public AccessibleRectInfo(AccessibleContextNode node, AccessibleTextRectInfo rect) : 35 | this(node, rect.x, rect.y, rect.width, rect.height) { 36 | } 37 | 38 | public AccessibleRectInfo(AccessibleContextNode node, Rectangle rect) : 39 | this(node, rect.X, rect.Y, rect.Width, rect.Width) { 40 | } 41 | 42 | public int X { get; private set; } 43 | public int Y { get; private set; } 44 | public int Width { get; private set; } 45 | public int Height { get; private set; } 46 | 47 | public Point Location { 48 | get { return new Point(X, Y); } 49 | } 50 | 51 | public Size Size { 52 | get { 53 | return new Size(Width, Height); 54 | } 55 | } 56 | 57 | public bool IsVisible { 58 | get { return Width >= 0 && Height >= 0; } 59 | } 60 | 61 | public Rectangle Rectangle { 62 | get { return new Rectangle(Location, Size); } 63 | } 64 | 65 | public AccessibleContextNode AccessibleNode { 66 | get { return _node; } 67 | } 68 | 69 | public override bool Equals(object obj) { 70 | return Equals(obj as AccessibleRectInfo); 71 | } 72 | 73 | public override int GetHashCode() { 74 | return Rectangle.GetHashCode(); 75 | } 76 | 77 | public bool Equals(AccessibleRectInfo other) { 78 | if (other == null) 79 | return false; 80 | 81 | return Rectangle == other.Rectangle; 82 | } 83 | 84 | public override string ToString() { 85 | return Rectangle.ToString(); 86 | //string.Format("[{0}, {1}, {2}, {3}]", X, Y, Width, Height); 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/TooltipWindow.Designer.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer { 16 | partial class TooltipWindow { 17 | /// 18 | /// Required designer variable. 19 | /// 20 | private System.ComponentModel.IContainer components = null; 21 | 22 | /// 23 | /// Clean up any resources being used. 24 | /// 25 | /// true if managed resources should be disposed; otherwise, false. 26 | protected override void Dispose(bool disposing) { 27 | if (disposing && (components != null)) { 28 | components.Dispose(); 29 | } 30 | base.Dispose(disposing); 31 | } 32 | 33 | #region Windows Form Designer generated code 34 | 35 | /// 36 | /// Required method for Designer support - do not modify 37 | /// the contents of this method with the code editor. 38 | /// 39 | private void InitializeComponent() { 40 | this.Label = new System.Windows.Forms.Label(); 41 | this.SuspendLayout(); 42 | // 43 | // Label 44 | // 45 | this.Label.AutoSize = true; 46 | this.Label.Location = new System.Drawing.Point(0, 0); 47 | this.Label.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 48 | this.Label.Name = "Label"; 49 | this.Label.Size = new System.Drawing.Size(30, 17); 50 | this.Label.TabIndex = 0; 51 | this.Label.Text = "text"; 52 | // 53 | // TooltipWindow 54 | // 55 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; 56 | this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; 57 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); 58 | this.ClientSize = new System.Drawing.Size(105, 53); 59 | this.ControlBox = false; 60 | this.Controls.Add(this.Label); 61 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 62 | this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 63 | this.Name = "TooltipWindow"; 64 | this.ShowInTaskbar = false; 65 | this.ResumeLayout(false); 66 | this.PerformLayout(); 67 | 68 | } 69 | 70 | #endregion 71 | 72 | public System.Windows.Forms.Label Label; 73 | } 74 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/TreeNodeCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Windows.Forms; 19 | 20 | namespace AccessBridgeExplorer.Utils { 21 | public static class TreeNodeCollectionExtensions { 22 | /// 23 | /// Wraps a as an . 25 | /// 26 | public static IList AsList(this TreeNodeCollection collection) { 27 | return new TreeNodeCollectionWrapper(collection); 28 | } 29 | 30 | public class TreeNodeCollectionWrapper : IList { 31 | private readonly TreeNodeCollection _collection; 32 | 33 | public TreeNodeCollectionWrapper(TreeNodeCollection collection) { 34 | _collection = collection; 35 | } 36 | 37 | public IEnumerator GetEnumerator() { 38 | return _collection.Cast().GetEnumerator(); 39 | } 40 | 41 | IEnumerator IEnumerable.GetEnumerator() { 42 | return GetEnumerator(); 43 | } 44 | 45 | public void Add(TreeNode item) { 46 | _collection.Add(item); 47 | } 48 | 49 | public void Clear() { 50 | _collection.Clear(); 51 | } 52 | 53 | public bool Contains(TreeNode item) { 54 | return _collection.Contains(item); 55 | } 56 | 57 | public void CopyTo(TreeNode[] array, int arrayIndex) { 58 | _collection.CopyTo(array, arrayIndex); 59 | } 60 | 61 | public bool Remove(TreeNode item) { 62 | _collection.Remove(item); 63 | return true; 64 | } 65 | 66 | public int Count { 67 | get { return _collection.Count; } 68 | } 69 | 70 | public bool IsReadOnly { 71 | get { return _collection.IsReadOnly; } 72 | } 73 | 74 | public int IndexOf(TreeNode item) { 75 | return _collection.IndexOf(item); 76 | } 77 | 78 | public void Insert(int index, TreeNode item) { 79 | _collection.Insert(index, item); 80 | } 81 | 82 | public void RemoveAt(int index) { 83 | _collection.RemoveAt(index); 84 | } 85 | 86 | public TreeNode this[int index] { 87 | get { return _collection[index]; } 88 | set { _collection[index] = value; } 89 | } 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Model/NodeModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics; 16 | using System.Windows.Forms; 17 | using WindowsAccessBridgeInterop; 18 | 19 | namespace AccessBridgeExplorer.Model { 20 | public abstract class NodeModel { 21 | private static readonly FakeChildNodeModel FakeChildModel = new FakeChildNodeModel(); 22 | private TreeNode _treeNode; 23 | 24 | private class FakeChildNodeModel : NodeModel { 25 | } 26 | 27 | public TreeNode CreateTreeNode() { 28 | var treeNode = new TreeNode(); 29 | treeNode.Tag = this; 30 | SetupTreeNode(treeNode); 31 | _treeNode = treeNode; 32 | return treeNode; 33 | } 34 | 35 | protected void AddFakeChild(TreeNode node) { 36 | var fakeChild = new TreeNode(); 37 | fakeChild.Tag = FakeChildModel; 38 | node.Nodes.Add(fakeChild); 39 | } 40 | 41 | public virtual void SetupTreeNode(TreeNode node) { } 42 | 43 | public void BeforeExpand(object sender, TreeViewCancelEventArgs e) { 44 | Debug.Assert(ReferenceEquals(_treeNode, e.Node)); 45 | if (_treeNode.Nodes.Count == 1 && _treeNode.Nodes[0].Tag == FakeChildModel) { 46 | _treeNode.Nodes.Clear(); 47 | AddChildren(e.Node); 48 | } 49 | } 50 | 51 | public virtual void AddChildren(TreeNode node) { 52 | } 53 | 54 | public void ResetChildren(TreeNode treeNode) { 55 | _treeNode.Nodes.Clear(); 56 | SetupTreeNode(treeNode); 57 | } 58 | 59 | public static void RefreshNode(TreeNode treeNode) { 60 | var nodeModel = treeNode.Tag as AccessibleNodeModel; 61 | if (nodeModel == null) 62 | return; 63 | 64 | // First thing first: tell the accessible node to forget about what it 65 | // knows 66 | nodeModel.AccessibleNode.Refresh(); 67 | 68 | // Update the treeview children so they get refreshed 69 | var expanded = treeNode.IsExpanded; 70 | if (expanded) { 71 | treeNode.Collapse(); 72 | } 73 | nodeModel.ResetChildren(treeNode); 74 | if (expanded) { 75 | treeNode.Expand(); 76 | } 77 | } 78 | 79 | public static AccessibleNode GetAccessibleNode(TreeNode treeNode) { 80 | var nodeModel = treeNode.Tag as AccessibleNodeModel; 81 | if (nodeModel == null) 82 | return null; 83 | 84 | return nodeModel.AccessibleNode; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/TreeListViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | namespace AccessBridgeExplorer.Utils { 16 | /// 17 | /// Model to use with a . 18 | /// 19 | public abstract class TreeListViewModel where TNode : class { 20 | /// 21 | /// Return the root node of the model. 22 | /// 23 | public abstract TNode GetRootNode(); 24 | 25 | /// 26 | /// Return true is the root node should be displayed at the top 27 | /// level entry. Return false if the children of the root node 28 | /// should be displayed as the top level entries. 29 | /// 30 | public abstract bool IsRootVisible(); 31 | 32 | /// 33 | /// Return the number of children of a given . 34 | /// 35 | public abstract int GetChildCount(TNode node); 36 | 37 | /// 38 | /// Return the child at of a given . 40 | /// 41 | public abstract TNode GetChildAt(TNode node, int index); 42 | 43 | /// 44 | /// Return the expandable state of a given . 45 | /// 46 | public abstract bool IsNodeExpandable(TNode node); 47 | 48 | /// 49 | /// Return the initial expanded state of a given . 50 | /// 51 | public virtual bool IsNodeExpanded(TNode node) { 52 | return false; 53 | } 54 | 55 | /// 56 | /// Return the text of a given . 57 | /// 58 | public abstract string GetNodeText(TNode node); 59 | 60 | /// 61 | /// Return the number of additional text items of a given . 63 | /// 64 | public virtual int GetNodeSubItemCount(TNode node) { 65 | return 0; 66 | } 67 | 68 | /// 69 | /// Return the additional text at of a given 70 | /// . 71 | /// 72 | public virtual string GetNodeSubItemAt(TNode node, int index) { 73 | return ""; 74 | } 75 | 76 | /// 77 | /// Return the path component of a given . 78 | /// 79 | public virtual string GetNodePathComponent(TNode node) { 80 | return GetNodeText(node); 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/ListViewItemCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Collections; 16 | using System.Collections.Generic; 17 | using System.Linq; 18 | using System.Windows.Forms; 19 | 20 | namespace AccessBridgeExplorer.Utils { 21 | public static class ListViewItemCollectionExtensions { 22 | /// 23 | /// Wraps a as an . 25 | /// 26 | public static IList AsList(this ListView.ListViewItemCollection collection) { 27 | return new ListViewItemCollectionWrapper(collection); 28 | } 29 | 30 | public class ListViewItemCollectionWrapper : IList { 31 | private readonly ListView.ListViewItemCollection _collection; 32 | 33 | public ListViewItemCollectionWrapper(ListView.ListViewItemCollection collection) { 34 | _collection = collection; 35 | } 36 | 37 | public IEnumerator GetEnumerator() { 38 | return _collection.Cast().GetEnumerator(); 39 | } 40 | 41 | IEnumerator IEnumerable.GetEnumerator() { 42 | return GetEnumerator(); 43 | } 44 | 45 | public void Add(ListViewItem item) { 46 | _collection.Add(item); 47 | } 48 | 49 | public void Clear() { 50 | _collection.Clear(); 51 | } 52 | 53 | public bool Contains(ListViewItem item) { 54 | return _collection.Contains(item); 55 | } 56 | 57 | public void CopyTo(ListViewItem[] array, int arrayIndex) { 58 | _collection.CopyTo(array, arrayIndex); 59 | } 60 | 61 | public bool Remove(ListViewItem item) { 62 | _collection.Remove(item); 63 | return true; 64 | } 65 | 66 | public int Count { 67 | get { return _collection.Count; } 68 | } 69 | 70 | public bool IsReadOnly { 71 | get { return _collection.IsReadOnly; } 72 | } 73 | 74 | public int IndexOf(ListViewItem item) { 75 | return _collection.IndexOf(item); 76 | } 77 | 78 | public void Insert(int index, ListViewItem item) { 79 | _collection.Insert(index, item); 80 | } 81 | 82 | public void RemoveAt(int index) { 83 | _collection.RemoveAt(index); 84 | } 85 | 86 | public ListViewItem this[int index] { 87 | get { return _collection[index]; } 88 | set { _collection[index] = value; } 89 | } 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /src/CodeGen/Interop/NativeStructures/AccessibleContextInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Diagnostics.CodeAnalysis; 16 | using System.Runtime.InteropServices; 17 | using jint = System.Int32; 18 | 19 | namespace CodeGen.Interop.NativeStructures { 20 | [SuppressMessage("ReSharper", "InconsistentNaming")] 21 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] 22 | public class AccessibleContextInfo { 23 | 24 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.MAX_STRING_SIZE)] 25 | public string name; // the AccessibleName of the object 26 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.MAX_STRING_SIZE)] 27 | public string description; // the AccessibleDescription of the object 28 | 29 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 30 | public string role; // localized AccesibleRole string 31 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 32 | public string role_en_US; // AccesibleRole string in the en_US locale 33 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 34 | public string states; // localized AccesibleStateSet string (comma separated) 35 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.SHORT_STRING_SIZE)] 36 | public string states_en_US; // AccesibleStateSet string in the en_US locale (comma separated) 37 | 38 | public jint indexInParent; // index of object in parent 39 | public jint childrenCount; // # of children, if any 40 | 41 | public jint x; // screen coords in pixels 42 | public jint y; // " 43 | public jint width; // pixel width of object 44 | public jint height; // pixel height of object 45 | 46 | public jint accessibleComponent; // flags for various additional 47 | public jint accessibleAction; // Java Accessibility interfaces 48 | public jint accessibleSelection; // FALSE if this object doesn't 49 | public jint accessibleText; // implement the additional interface 50 | // in question 51 | 52 | // BOOL accessibleValue; // old BOOL indicating whether AccessibleValue is supported 53 | public AccessibleInterfaces accessibleInterfaces; // new bitfield containing additional interface flags 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/IExplorerFormView.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Drawing; 16 | using System.Windows.Forms; 17 | using AccessBridgeExplorer.Utils; 18 | 19 | namespace AccessBridgeExplorer { 20 | public interface IExplorerFormView { 21 | 22 | string Caption { get; } 23 | 24 | Point CursorPosition { get; } 25 | WindowsHotKeyHandlerFactory WindowsHotKeyHandlerFactory { get; } 26 | IMessageQueue MessageQueue { get; } 27 | 28 | ToolStripButton RefreshButton { get; } 29 | ToolStripButton FindComponentButton { get; } 30 | 31 | TabPage AccessibilityTreePage { get; } 32 | TreeView AccessibilityTree { get; } 33 | 34 | PropertyListView AccessibleComponentPropertyListView { get; } 35 | 36 | TabPage MessageListPage { get; } 37 | ListView MessageList { get; } 38 | TabPage EventListPage { get; } 39 | ListView EventList { get; } 40 | 41 | ToolStripMenuItem PropertiesMenu { get; } 42 | ToolStripMenuItem EventsMenu { get; } 43 | 44 | ToolStripMenuItem LimitCollectionSizesMenu { get; } 45 | ToolStripMenuItem LimitTextLineCountMenu { get; } 46 | ToolStripMenuItem LimitTextLineLengthsMenu { get; } 47 | ToolStripMenuItem LimitTextBufferLengthMenu { get; } 48 | 49 | ToolStripMenuItem AutoDetectApplicationsMenuItem { get; } 50 | ToolStripMenuItem AutoReleaseInactiveObjectsMenuItem { get; } 51 | 52 | ToolStripMenuItem EnableOverlayMenuItem { get; } 53 | ToolStripButton EnableOverlayButton { get; } 54 | 55 | ToolStripMenuItem ActivateOverlayOnTreeSelectionMenu { get; } 56 | ToolStripMenuItem ActivateOverlayOnComponentSelectionMenu { get; } 57 | ToolStripMenuItem ActivateOverlayOnFocusMenu { get; } 58 | ToolStripMenuItem ActivateOverlayOnActiveDescendantMenu { get; } 59 | 60 | ToolStripMenuItem ShowTooltipAndOverlayMenuItem { get; } 61 | ToolStripMenuItem ShowTooltipOnlyMenuItem { get; } 62 | ToolStripMenuItem ShowOverlayOnlyMenuItem { get; } 63 | 64 | ToolStripMenuItem SynchronizeTreeMenuItem { get; } 65 | ToolStripMenuItem SynchronizeTreeLogErrorsMenuItem { get; } 66 | 67 | ToolStripMenuItem EnableCaptureHookMenuItem { get; } 68 | ToolStripMenuItem EnableOverlayHookMenuItem { get; } 69 | 70 | ToolStripStatusLabel StatusLabel { get; } 71 | 72 | void ShowMessageBox(string message, string title, MessageBoxButtons buttons, MessageBoxIcon icon); 73 | void ShowDialog(Form form); 74 | void FocusMessageList(); 75 | void ShowNotification(NotificationPanelEntry entry); 76 | } 77 | } -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | # Access Bridge Explorer Version History 2 | 3 | 4 | ## Version 1.1 5 | 6 | * Fix issue where some events are lost 7 | * Show count of active Java Objects in the status bar 8 | * Add a button to manually force a Garbage Collection in the status bar 9 | * Improve support for multi-monitor setups 10 | * Add options (Options | Component Overlay | Hook ...) to enable/disable global 11 | keyboard hooks (Ctrl+\\ and Ctrl+Shft+\\) 12 | * Improve CodeGen to support XML doc comments in generated code 13 | * Add option (Options | Component Overlay | Synchronize Tree) to synchronize 14 | the Accessibility Tree when the Component Overlay is updated. 15 | 16 | 17 | ## Version 1.0 18 | 19 | * Add options (Options | Component Overlay | Activate on xxx) to offer finer 20 | grained control on when to update the component overlay window 21 | * To simulate screen readers, a new options allows activating the component 22 | overlay when the input focus 23 | * There is also an option to activate the overlay when the active descendant 24 | of a container changes (e.g. when the selected item of a list changes) 25 | * Add options (Options | Component Overlay | Show xxx) to allow choosing 26 | between a tooltip window and/or semi-transparent overlay when displaying 27 | the component overlay. 28 | * Auto-refresh list of running application bt reguarly polling the list 29 | of Windows on the system. 30 | * Display the details of errors when double-clicking an error in the 31 | "Messages" window 32 | * "Component Properties" view is improved for tables. It now contains headers, 33 | selections, children. 34 | * "Component Properties" view now contains the list of children 35 | * When the row selection in the "Component Properties" view switches to 36 | a property associated with a screen reactangle, update the component 37 | overlay location to that of the rectangle. 38 | * A few more properties shown in the "Component Properties" view 39 | * Settings/options are saved in a the 40 | "%APPDATA%\Roaming\AccessBridgeExplorer\settings.txt" file 41 | * Fix a bug where the Text of text components contains a "..." suffix, 42 | incorrectly indicating there was more text. 43 | 44 | 45 | ## Version 0.9.3 46 | 47 | * "Component Properties" view 48 | * Improve performance as sub-properties are evaluated on demand (i.e. when 49 | node is expanded) 50 | * For "Text" component, add a node to expose the full text content 51 | * Add a "Focused element" entry 52 | * Fix bug on Windows 7, where component overlay window would flicker 53 | * CodeGen: Improve generated code for "out" parameters 54 | * CodeGen: Generate less code when wrapper classes are not needed 55 | 56 | 57 | ## Version 0.9.2 58 | 59 | * Add support for loading the legacy Windows Access Bridge DLL (version 1.x), 60 | required to work with older Java Application (e.g. OpenOffice 3.x and 61 | earlier) 62 | * The Windows Access Bridge P/Invoke wrapper is now automatically generated. 63 | This was required to make it easier to support the legacy access bridge DLL. 64 | 65 | 66 | ## Version 0.9.1 67 | 68 | * Add notification Window when a new version of Access Bridge Explorer is 69 | available 70 | 71 | 72 | ## Version 0.9.0 73 | 74 | * Initial release 75 | -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/AccessibleTextReader.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.IO; 17 | 18 | namespace WindowsAccessBridgeInterop { 19 | /// 20 | /// Expose a interface over an accessible 21 | /// text component. 22 | /// 23 | public class AccessibleTextReader : TextReader { 24 | private const int TextChunkSize = 4096; 25 | private readonly AccessibleContextNode _node; 26 | private readonly int _charCount; 27 | private readonly char[] _chunk; 28 | private int _chunkLength; 29 | private int _chunkOffset; 30 | private int _streamOffset; 31 | 32 | public AccessibleTextReader(AccessibleContextNode node, int charCount) { 33 | _node = node; 34 | _charCount = charCount; 35 | _chunk = new char[TextChunkSize]; 36 | } 37 | 38 | private bool EndOfFile { 39 | get { return _streamOffset >= _charCount; } 40 | } 41 | 42 | public override int Peek() { 43 | TryEnsureChunk(); 44 | if (EndOfFile) 45 | return -1; 46 | return _chunk[_streamOffset - _chunkOffset]; 47 | } 48 | 49 | public override int Read() { 50 | var result = Peek(); 51 | if (result >= 0) 52 | _streamOffset++; 53 | return result; 54 | } 55 | 56 | private void TryEnsureChunk() { 57 | if (EndOfFile) 58 | return; 59 | 60 | if (_streamOffset < _chunkOffset + _chunkLength) 61 | return; 62 | 63 | // len = output buffer size: we use - 1 to be on the safe size in case 64 | // JAB api decides to include append a NUL terminator, which it 65 | // currently does not seem to do. 66 | // start = offset of first character of range (inclusive) 67 | // end = offset of last character of range (exclusive), except for the 68 | // special case of the end of the range. The JAB API will only accept 69 | // end offset == characterCount - 1. 70 | var len = (short)(_chunk.Length - 1); 71 | var start = _chunkOffset + _chunkLength; 72 | var end = Math.Min(_charCount, start + len); 73 | var fixedupEnd = Math.Min(_charCount - 1, end); 74 | if (Failed(_node.AccessBridge.Functions.GetAccessibleTextRange(_node.JvmId, _node.AccessibleContextHandle, start, fixedupEnd, _chunk, len))) { 75 | _streamOffset = _charCount; 76 | return; 77 | } 78 | 79 | _chunkLength = end - start; 80 | _chunkOffset = start; 81 | } 82 | 83 | private static bool Failed(bool result) { 84 | return !result; 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/ExceptionForm.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Diagnostics; 17 | using System.Windows.Forms; 18 | using AccessBridgeExplorer.Utils; 19 | 20 | namespace AccessBridgeExplorer { 21 | public partial class ExceptionForm : Form { 22 | private readonly TreeListView _treeListView; 23 | 24 | public ExceptionForm() { 25 | InitializeComponent(); 26 | _treeListView = new TreeListView(errorDetailListView, errorDetailListViewImageList); 27 | } 28 | 29 | public void DisplayError(Exception error, StackTrace stackTrace) { 30 | var topLevelNode = new TreeNode(); 31 | CreateNodes(topLevelNode.Nodes, error, stackTrace); 32 | topLevelNode.ExpandAll(); 33 | 34 | _treeListView.SetModel(new TreeNodeViewModel(topLevelNode, false)); 35 | 36 | errorDetailListView.Select(); 37 | } 38 | 39 | private void CreateNodes(TreeNodeCollection parentList, Exception error, StackTrace stackTrace) { 40 | var errorNode = parentList.Add("Exception info"); 41 | CreateErrorNodes(errorNode.Nodes, error); 42 | 43 | var stackNode = parentList.Add("Logger stacktrace"); 44 | CreateStackStraceNodes(stackNode.Nodes, stackTrace); 45 | } 46 | 47 | private static void CreateErrorNodes(TreeNodeCollection parentList, Exception error) { 48 | parentList.Add(string.Format("Message: {0}", error.Message)); 49 | parentList.Add(string.Format("Type: {0}", error.GetType().FullName)); 50 | 51 | var stackTrace = new StackTrace(error, fNeedFileInfo: true); 52 | var node = parentList.Add("Stacktrace"); 53 | CreateStackStraceNodes(node.Nodes, stackTrace); 54 | 55 | if (error.InnerException != null) { 56 | var errorNode = parentList.Add("Inner Exception info"); 57 | CreateErrorNodes(errorNode.Nodes, error.InnerException); 58 | } 59 | } 60 | 61 | private static void CreateStackStraceNodes(TreeNodeCollection parentList, StackTrace stackTrace) { 62 | var frames = stackTrace.GetFrames() ?? new StackFrame[0]; 63 | foreach (var frame in frames) { 64 | 65 | var methodInfo = frame.GetMethod(); 66 | 67 | var methodText = methodInfo == null ? 68 | @"" : 69 | methodInfo.ReflectedType == null ? 70 | string.Format(".{0}()", methodInfo.Name) : 71 | string.Format("{0}.{1}()", methodInfo.ReflectedType.FullName, frame.GetMethod().Name); 72 | 73 | var locationText = frame.GetFileName() == null ? 74 | "" : 75 | string.Format(" - {0}:{1}:{2}", frame.GetFileName(), frame.GetFileLineNumber(), frame.GetFileColumnNumber()); 76 | 77 | var frameNode = new TreeNode { 78 | Text = string.Format("{0}{1}", methodText, locationText) 79 | }; 80 | parentList.Add(frameNode); 81 | } 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/Utils/ScreenUtils.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Drawing; 16 | using System.Linq; 17 | using System.Windows.Forms; 18 | 19 | namespace AccessBridgeExplorer.Utils { 20 | /// 21 | /// Various utilities to position windows relative to other windows taking 22 | /// into account multi-monitor setups if needed. 23 | /// 24 | public static class ScreenUtils { 25 | /// 26 | /// Given a rectangle returned by the Access Bridge API, return the closest 27 | /// possible rectangle that fits into bounds of one of the attached monitor. 28 | /// 29 | public static Rectangle FitToScreen(Rectangle rect) { 30 | var bounds = Screen.GetBounds(rect); 31 | return FitToBounds(bounds, rect); 32 | } 33 | 34 | /// 35 | /// Given a rectangle, return the closest possible 36 | /// rectangle that fits into it. 37 | /// 38 | /// The input rectangle should be considered "user-input", i.e. the X and/or 39 | /// Y coordinates are usually set to "-1" to indicate "no location". Also, 40 | /// the width and height may also be set to "-1" to invicate an invalid 41 | /// rectangle. 42 | /// 43 | /// Finally, for large components inside scroll panes, the coordinates 44 | /// returned by the Access Bridge API corresponding to the "virtual" size of 45 | /// the component, meaning the X and/Y coordinates maybe negative, and/or 46 | /// the width/height values may be much larger than the actual screen size. 47 | /// 48 | public static Rectangle FitToBounds(Rectangle bounds, Rectangle rect) { 49 | // By setting width/height to 1, we ensure we display "something" 50 | // if the x/y coordinates point to a visible location. 51 | if (rect.Width < 0) { 52 | rect.Width = 1; 53 | } 54 | if (rect.Height < 0) { 55 | rect.Height = 1; 56 | } 57 | bounds.Intersect(rect); 58 | return bounds; 59 | } 60 | 61 | /// 62 | /// Return a location that is guaranteed to not overlap with any screen 63 | /// monitors attached to the system. This location is useful to position 64 | /// windows so that they are not visible. 65 | /// 66 | public static Point InvisibleLocation() { 67 | var screen = Screen.AllScreens 68 | .OrderByDescending(x => x.Bounds.X) 69 | .ThenByDescending(x => x.Bounds.Y) 70 | .First(); 71 | 72 | return new Point(screen.Bounds.X - 10, screen.Bounds.Y - 10); 73 | } 74 | 75 | public static Point EnsureVisible(Point point) { 76 | var bounds = Screen.GetBounds(point); 77 | var result = point; 78 | if (point.X < bounds.Left) result.X = bounds.Left; 79 | if (point.X > bounds.Right) result.X = bounds.Right; 80 | if (point.Y < bounds.Top) result.Y = bounds.Top; 81 | if (point.Y > bounds.Bottom) result.Y = bounds.Bottom; 82 | return result; 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /AccessBridgeExplorer.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccessBridgeExplorer", "src\AccessBridgeExplorer\AccessBridgeExplorer.csproj", "{902E9F38-EF1A-4ED5-86BC-25881DBDABED}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51} = {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51} 9 | EndProjectSection 10 | EndProject 11 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{739A6BD0-482B-48A0-97C1-F80A266661B4}" 12 | ProjectSection(SolutionItems) = preProject 13 | screenshots\AccessBridgeExplorer.png = screenshots\AccessBridgeExplorer.png 14 | CONTRIBUTING.md = CONTRIBUTING.md 15 | LICENSE = LICENSE 16 | new-release-checklist.txt = new-release-checklist.txt 17 | README.md = README.md 18 | EndProjectSection 19 | EndProject 20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGen", "src\CodeGen\CodeGen.csproj", "{60FB05ED-62D8-41F1-9287-DF4183B7FE4F}" 21 | EndProject 22 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsAccessBridgeInterop", "src\WindowsAccessBridgeInterop\WindowsAccessBridgeInterop.csproj", "{4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51}" 23 | EndProject 24 | Global 25 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 26 | Debug|Any CPU = Debug|Any CPU 27 | Debug|x86 = Debug|x86 28 | Release|Any CPU = Release|Any CPU 29 | Release|x86 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 32 | {902E9F38-EF1A-4ED5-86BC-25881DBDABED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {902E9F38-EF1A-4ED5-86BC-25881DBDABED}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | {902E9F38-EF1A-4ED5-86BC-25881DBDABED}.Debug|x86.ActiveCfg = Debug|x86 35 | {902E9F38-EF1A-4ED5-86BC-25881DBDABED}.Debug|x86.Build.0 = Debug|x86 36 | {902E9F38-EF1A-4ED5-86BC-25881DBDABED}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {902E9F38-EF1A-4ED5-86BC-25881DBDABED}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {902E9F38-EF1A-4ED5-86BC-25881DBDABED}.Release|x86.ActiveCfg = Release|x86 39 | {902E9F38-EF1A-4ED5-86BC-25881DBDABED}.Release|x86.Build.0 = Release|x86 40 | {60FB05ED-62D8-41F1-9287-DF4183B7FE4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 41 | {60FB05ED-62D8-41F1-9287-DF4183B7FE4F}.Debug|Any CPU.Build.0 = Debug|Any CPU 42 | {60FB05ED-62D8-41F1-9287-DF4183B7FE4F}.Debug|x86.ActiveCfg = Debug|Any CPU 43 | {60FB05ED-62D8-41F1-9287-DF4183B7FE4F}.Debug|x86.Build.0 = Debug|Any CPU 44 | {60FB05ED-62D8-41F1-9287-DF4183B7FE4F}.Release|Any CPU.ActiveCfg = Release|Any CPU 45 | {60FB05ED-62D8-41F1-9287-DF4183B7FE4F}.Release|Any CPU.Build.0 = Release|Any CPU 46 | {60FB05ED-62D8-41F1-9287-DF4183B7FE4F}.Release|x86.ActiveCfg = Release|Any CPU 47 | {60FB05ED-62D8-41F1-9287-DF4183B7FE4F}.Release|x86.Build.0 = Release|Any CPU 48 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 49 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51}.Debug|Any CPU.Build.0 = Debug|Any CPU 50 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51}.Debug|x86.ActiveCfg = Debug|Any CPU 51 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51}.Debug|x86.Build.0 = Debug|Any CPU 52 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51}.Release|Any CPU.ActiveCfg = Release|Any CPU 53 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51}.Release|Any CPU.Build.0 = Release|Any CPU 54 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51}.Release|x86.ActiveCfg = Release|Any CPU 55 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51}.Release|x86.Build.0 = Release|Any CPU 56 | EndGlobalSection 57 | GlobalSection(SolutionProperties) = preSolution 58 | HideSolutionNode = FALSE 59 | EndGlobalSection 60 | EndGlobal 61 | -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/WindowsAccessBridgeInterop.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4B5DE0E1-2F0A-426D-BB12-BECB0F6F8B51} 8 | Library 9 | Properties 10 | WindowsAccessBridgeInterop 11 | WindowsAccessBridgeInterop 12 | v4.0 13 | 512 14 | Client 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 79 | -------------------------------------------------------------------------------- /src/AccessBridgeExplorer/PropertyListTreeViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System.Text; 16 | using WindowsAccessBridgeInterop; 17 | using AccessBridgeExplorer.Utils; 18 | 19 | namespace AccessBridgeExplorer { 20 | /// 21 | /// Implementation of using a single 22 | /// as the input. 23 | /// 24 | public class PropertyListTreeViewModel : TreeListViewModel { 25 | private readonly PropertyGroup _rootNode; 26 | 27 | public PropertyListTreeViewModel(PropertyList propertyList) { 28 | _rootNode = new PropertyGroup(""); 29 | _rootNode.Children.AddRange(propertyList); 30 | } 31 | 32 | public override PropertyNode GetRootNode() { 33 | return _rootNode; 34 | } 35 | 36 | public override bool IsRootVisible() { 37 | return false; 38 | } 39 | 40 | public override int GetChildCount(PropertyNode node) { 41 | var group = node as PropertyGroup; 42 | if (group == null) 43 | return 0; 44 | return group.Children.Count; 45 | } 46 | 47 | public override PropertyNode GetChildAt(PropertyNode node, int index) { 48 | var group = (PropertyGroup)node; 49 | return group.Children[index]; 50 | } 51 | 52 | public override bool IsNodeExpandable(PropertyNode node) { 53 | var group = node as PropertyGroup; 54 | return group != null; 55 | } 56 | 57 | public override bool IsNodeExpanded(PropertyNode node) { 58 | var group = node as PropertyGroup; 59 | if (group != null) 60 | return group.Expanded; 61 | return false; 62 | } 63 | 64 | public override string GetNodeText(PropertyNode node) { 65 | return node.Name; 66 | } 67 | 68 | public override int GetNodeSubItemCount(PropertyNode node) { 69 | return 1; 70 | } 71 | 72 | public override string GetNodeSubItemAt(PropertyNode node, int index) { 73 | return PropertyNodeValueToString(node); 74 | } 75 | 76 | public static string PropertyNodeValueToString(PropertyNode propertyNode) { 77 | var text = ValueToStringImpl(propertyNode); 78 | var sb = new StringBuilder(); 79 | foreach (var c in text) { 80 | sb.Append(TranslateChar(c)); 81 | } 82 | return sb.ToString(); 83 | } 84 | 85 | private static string TranslateChar(char c) { 86 | if (c == '\r') return "\\r"; 87 | if (c == '\n') return "\\n"; 88 | if (c == '\t') return "\\t"; 89 | if (char.IsControl(c)) return "*"; 90 | return c.ToString(); 91 | } 92 | 93 | private static string ValueToStringImpl(PropertyNode propertyNode) { 94 | var value = propertyNode.Value; 95 | string valueText; 96 | if (value == null) { 97 | if (propertyNode is PropertyGroup) 98 | valueText = ""; 99 | else 100 | valueText = "-"; 101 | } else if (value is bool) { 102 | valueText = ((bool)value) ? "Yes" : "No"; 103 | } else if (value is string) { 104 | valueText = string.IsNullOrEmpty((string)value) ? "-" : (string)value; 105 | } else { 106 | valueText = value.ToString(); 107 | } 108 | return valueText; 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /src/WindowsAccessBridgeInterop/AccessibleWindow.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2015 Google Inc. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | using System; 16 | using System.Drawing; 17 | using System.Text; 18 | using WindowsAccessBridgeInterop.Win32; 19 | 20 | namespace WindowsAccessBridgeInterop { 21 | /// 22 | /// Root node of a tree of instances of a 23 | /// specific Java Window. 24 | /// 25 | public class AccessibleWindow : AccessibleContextNode { 26 | private readonly IntPtr _hwnd; 27 | 28 | public AccessibleWindow(AccessBridge accessBridge, IntPtr hwnd, JavaObjectHandle ac) : base(accessBridge, ac) { 29 | _hwnd = hwnd; 30 | } 31 | 32 | public IntPtr Hwnd { 33 | get { return _hwnd; } 34 | } 35 | 36 | public override AccessibleNode GetParent() { 37 | return new AccessibleJvm(AccessBridge, JvmId); 38 | } 39 | 40 | protected override void AddToolTipProperties(PropertyList list, PropertyOptions options) { 41 | base.AddToolTipProperties(list, options); 42 | list.AddProperty("WindowHandle", _hwnd); 43 | } 44 | 45 | protected override void AddProperties(PropertyList list, PropertyOptions options) { 46 | list.AddProperty("WindowHandle", _hwnd); 47 | base.AddProperties(list, options); 48 | var group = list.AddGroup("Focused element"); 49 | group.LoadChildren = () => { 50 | int vmid; 51 | JavaObjectHandle ac; 52 | if (Failed(AccessBridge.Functions.GetAccessibleContextWithFocus(_hwnd, out vmid, out ac))) { 53 | group.AddProperty("", "Error retrieving focused element"); 54 | } else { 55 | AddSubContextProperties(group.Children, options, ac); 56 | } 57 | }; 58 | } 59 | 60 | public string GetDisplaySortString() { 61 | var info = GetInfo(); 62 | 63 | var sb = new StringBuilder(); 64 | if (string.IsNullOrEmpty(info.role)) 65 | sb.Append(" "); 66 | else if (info.role == "frame") 67 | sb.Append("a "); 68 | else 69 | sb.Append("z" + info.role[0]); 70 | 71 | sb.Append('-'); 72 | if (string.IsNullOrEmpty(info.name)) 73 | sb.Append('z'); 74 | else 75 | sb.Append("a" + info.name); 76 | return sb.ToString(); 77 | } 78 | 79 | public override Path GetNodePathAt(Point screenPoint) { 80 | // Bail out early if Windows says this window does not contain "screenPoint" 81 | // See http://blogs.msdn.com/b/oldnewthing/archive/2010/12/30/10110077.aspx 82 | // Multi monitor notes: 83 | // https://msdn.microsoft.com/en-us/library/windows/desktop/dd162827(v=vs.85).aspx 84 | var hwnd = NativeMethods.WindowFromPoint(screenPoint); 85 | if (hwnd != _hwnd) 86 | return null; 87 | 88 | return base.GetNodePathAt(screenPoint); 89 | } 90 | 91 | public override bool Equals(AccessibleNode other) { 92 | if (!base.Equals(other)) 93 | return false; 94 | 95 | if (!(other is AccessibleWindow)) 96 | return false; 97 | 98 | return _hwnd == ((AccessibleWindow) other)._hwnd; 99 | } 100 | 101 | public override string ToString() { 102 | return string.Format("AccessibleWindowNode(hwnd={0})", _hwnd); 103 | } 104 | } 105 | } --------------------------------------------------------------------------------