Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod2011-10-18 19:22:48 +0000
committerCarolyn MacLeod2011-10-19 17:03:33 +0000
commit5e2e078df6c0aa8281d0fc285d953cc09fa04485 (patch)
tree0f46656274e7684bf742c015dcf474657a865adb
parenta9c3679cd7b6898efb646135a6e0a688b3dba5cf (diff)
downloadeclipse.platform.swt-5e2e078df6c0aa8281d0fc285d953cc09fa04485.tar.gz
eclipse.platform.swt-5e2e078df6c0aa8281d0fc285d953cc09fa04485.tar.xz
eclipse.platform.swt-5e2e078df6c0aa8281d0fc285d953cc09fa04485.zip
Bug 346517 - Add accessible keyboard shortcut to TabFolder and
CTabFolder
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java10
3 files changed, 17 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
index 24698a6de3..6a74223dd1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
@@ -2279,7 +2279,8 @@ public class Accessible {
/* Get the default keyboard shortcut from the OS. */
code = iaccessible.get_accKeyboardShortcut(varChild, pszKeyboardShortcut);
if (code == COM.E_INVALIDARG) code = COM.S_FALSE; // proxy doesn't know about app childID
- if (accessibleListeners.size() == 0) return code;
+ /* Process TabFolder even if there are no apps listening. */
+ if (accessibleListeners.size() == 0 && !(control instanceof TabFolder)) return code;
if (code == COM.S_OK) {
int /*long*/[] pKeyboardShortcut = new int /*long*/[1];
COM.MoveMemory(pKeyboardShortcut, pszKeyboardShortcut, OS.PTR_SIZEOF);
@@ -2295,6 +2296,10 @@ public class Accessible {
AccessibleEvent event = new AccessibleEvent(this);
event.childID = osToChildID(v.lVal);
event.result = osKeyboardShortcut;
+ /* SWT TabFolders use Ctrl+PageDown to switch pages (not Ctrl+Tab). */
+ if (v.lVal == COM.CHILDID_SELF && control instanceof TabFolder) {
+ event.result = "Ctrl+PageDown"; //$NON-NLS-1$
+ }
for (int i = 0; i < accessibleListeners.size(); i++) {
AccessibleListener listener = (AccessibleListener) accessibleListeners.elementAt(i);
listener.getKeyboardShortcut(event);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
index f9f31b7a0c..36875e24f8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
@@ -1064,6 +1064,7 @@ void initAccessible() {
childID = items.length + MAXIMIZE_CHILD_ID;
} else {
Rectangle location = getBounds();
+ location.x = location.y = 0;
location.height = location.height - getClientArea().height;
if (location.contains(testPoint)) {
childID = ACC.CHILDID_SELF;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
index 2f03875289..f469bcdd25 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TabFolder.java
@@ -869,6 +869,16 @@ LRESULT WM_GETDLGCODE (int /*long*/ wParam, int /*long*/ lParam) {
return new LRESULT (OS.DLGC_BUTTON | OS.DLGC_WANTARROWS);
}
+LRESULT WM_GETOBJECT (int /*long*/ wParam, int /*long*/ lParam) {
+ /*
+ * Ensure that there is an accessible object created for this
+ * control because support for publishing the keyboard shortcut
+ * for page switching is implemented in the accessibility package.
+ */
+ if (accessible == null) accessible = new_Accessible (this);
+ return super.WM_GETOBJECT (wParam, lParam);
+}
+
LRESULT WM_KEYDOWN (int /*long*/ wParam, int /*long*/ lParam) {
LRESULT result = super.WM_KEYDOWN (wParam, lParam);
if (result != null) return result;

Back to the top