summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets
diff options
context:
space:
mode:
authorCarolyn MacLeod <Carolyn_MacLeod@ca.ibm.com>2012-11-26 16:15:02 -0500
committerCarolyn MacLeod <Carolyn_MacLeod@ca.ibm.com>2012-11-26 16:15:02 -0500
commitb31a2c4fef115f61f56aab574a9b54fe849df0f4 (patch)
tree9327f82f8220381b0949774510e8367878d7a1c6 /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets
parente2eff04a9d010d2f0bb36a6d475a23fe8421fbf8 (diff)
downloadeclipse.platform.swt-b31a2c4fef115f61f56aab574a9b54fe849df0f4.tar.gz
eclipse.platform.swt-b31a2c4fef115f61f56aab574a9b54fe849df0f4.tar.xz
eclipse.platform.swt-b31a2c4fef115f61f56aab574a9b54fe849df0f4.zip
Bug 394016 - Ctrl+PageDown doesn't work multiple times in Classic theme
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java35
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java3
2 files changed, 35 insertions, 3 deletions
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 0907b1b651..7d91d1ddaa 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
@@ -760,7 +760,7 @@ public boolean getBorderVisible() {
}
ToolBar getChevron() {
if (chevronTb == null) {
- chevronTb = new ToolBar(this, SWT.FLAT | SWT.NO_FOCUS);
+ chevronTb = new ToolBar(this, SWT.FLAT);
initAccessibleChevronTb();
addTabControl(chevronTb, SWT.TRAIL, -1, false);
}
@@ -2366,7 +2366,7 @@ void setButtonBounds(GC gc) {
Display display = getDisplay();
if (showMax) {
if (minMaxTb == null) {
- minMaxTb = new ToolBar(this, SWT.FLAT | SWT.NO_FOCUS);
+ minMaxTb = new ToolBar(this, SWT.FLAT);
initAccessibleMinMaxTb();
addTabControl(minMaxTb, SWT.TRAIL, 0, false);
}
@@ -2389,7 +2389,7 @@ void setButtonBounds(GC gc) {
// min button
if (showMin) {
if (minMaxTb == null) {
- minMaxTb = new ToolBar(this, SWT.FLAT | SWT.NO_FOCUS);
+ minMaxTb = new ToolBar(this, SWT.FLAT);
initAccessibleMinMaxTb();
addTabControl(minMaxTb, SWT.TRAIL, 0, false);
}
@@ -2481,6 +2481,35 @@ void setButtonBounds(GC gc) {
controlRects = rects;
if (changed || hovering) updateBkImages();
}
+public boolean setFocus () {
+ checkWidget ();
+
+ /*
+ * Feature in SWT. When a new tab item is selected
+ * and the previous tab item had focus, removing focus
+ * from the previous tab item causes fixFocus() to give
+ * focus to the first child, which is usually one of the
+ * toolbars. This is unexpected.
+ * The fix is to try to set focus on the first tab item
+ * if fixFocus() is called.
+ */
+ Control focusControl = getDisplay().getFocusControl ();
+ boolean fixFocus = isAncestor (focusControl);
+ if (fixFocus) {
+ CTabItem item = getSelection();
+ if (item != null) {
+ if (item.setFocus ()) return true;
+ }
+ }
+ return super.setFocus ();
+}
+/* Copy of isFocusAncestor from Control. */
+boolean isAncestor (Control control) {
+ while (control != null && control != this && !(control instanceof Shell)) {
+ control = control.getParent();
+ }
+ return control == this;
+}
public void setFont(Font font) {
checkWidget();
if (font != null && font.equals(getFont())) return;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
index c3f465e325..f8e2405714 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabItem.java
@@ -325,6 +325,9 @@ public void setDisabledImage (Image image) {
}
this.disabledImage = image;
}
+boolean setFocus () {
+ return control != null && !control.isDisposed() && control.setFocus ();
+}
/**
* Sets the font that the receiver will use to paint textual information
* for this item to the font specified by the argument, or to the default font