mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 20:55:44 +02:00
Bug 158301 - provide mac versions of inherit and system history buttons
reverting back to original arrow buttons now that the platform appears to make them tabbable.
This commit is contained in:
parent
1a713cc7e9
commit
4899b31521
2 changed files with 72 additions and 64 deletions
|
@ -56,15 +56,15 @@ public class InheritButton extends Composite {
|
||||||
/**
|
/**
|
||||||
* Value is 12 pixels.
|
* Value is 12 pixels.
|
||||||
*/
|
*/
|
||||||
public static final int DEFAULT_WIDTH = 12;
|
// public static final int DEFAULT_WIDTH = 40;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Value is 20 pixels.
|
* Value is 20 pixels.
|
||||||
*/
|
*/
|
||||||
public static final int DEFAULT_HEIGHT = 20;
|
// public static final int DEFAULT_HEIGHT = 35;
|
||||||
|
|
||||||
private Image leftArrow = null; // arrow points left, value is inherited
|
// private Image leftArrow = null; // arrow points left, value is inherited
|
||||||
private Image rightArrow = null; // arrow points right, value is the local value
|
// private Image rightArrow = null; // arrow points right, value is the local value
|
||||||
private boolean isLocal = false; // default is "inherit"
|
private boolean isLocal = false; // default is "inherit"
|
||||||
private Button toggle = null;
|
private Button toggle = null;
|
||||||
|
|
||||||
|
@ -74,10 +74,10 @@ public class InheritButton extends Composite {
|
||||||
*/
|
*/
|
||||||
public InheritButton(Composite parent) {
|
public InheritButton(Composite parent) {
|
||||||
super(parent, SWT.NONE);
|
super(parent, SWT.NONE);
|
||||||
GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, false);
|
// GridData data = new GridData(SWT.CENTER, SWT.CENTER, false, false);
|
||||||
data.widthHint = DEFAULT_WIDTH;
|
// data.widthHint = DEFAULT_WIDTH;
|
||||||
data.heightHint = DEFAULT_HEIGHT;
|
// data.heightHint = DEFAULT_HEIGHT;
|
||||||
setLayoutData(data);
|
// setLayoutData(data);
|
||||||
GridLayout layout = new GridLayout();
|
GridLayout layout = new GridLayout();
|
||||||
layout.marginHeight = 0;
|
layout.marginHeight = 0;
|
||||||
layout.marginWidth = 0;
|
layout.marginWidth = 0;
|
||||||
|
@ -86,8 +86,9 @@ public class InheritButton extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeToggle(Composite parent) {
|
private void initializeToggle(Composite parent) {
|
||||||
toggle = new Button(parent, SWT.PUSH);
|
// toggle = new Button(parent, SWT.PUSH );
|
||||||
createToggleImages(toggle.getBackground());
|
toggle = new Button(parent, SWT.ARROW );
|
||||||
|
// createToggleImages(toggle.getBackground());
|
||||||
toggle.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
toggle.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
||||||
public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard.
|
public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard.
|
||||||
e.result = "";
|
e.result = "";
|
||||||
|
@ -108,11 +109,11 @@ public class InheritButton extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
toggle.addDisposeListener(new DisposeListener() {
|
// toggle.addDisposeListener(new DisposeListener() {
|
||||||
public void widgetDisposed(DisposeEvent e) {
|
// public void widgetDisposed(DisposeEvent e) {
|
||||||
disposeToggleImages();
|
// disposeToggleImages();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
toggle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
toggle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||||
setToggleImage();
|
setToggleImage();
|
||||||
}
|
}
|
||||||
|
@ -207,7 +208,9 @@ public class InheritButton extends Composite {
|
||||||
* In the "inherit" state, the arrow image points to the left.
|
* In the "inherit" state, the arrow image points to the left.
|
||||||
*/
|
*/
|
||||||
private void setToggleImage() {
|
private void setToggleImage() {
|
||||||
toggle.setImage(isLocal ? rightArrow : leftArrow);
|
// toggle.setImage(isLocal ? rightArrow : leftArrow);
|
||||||
|
int alignment = isLocal ? SWT.RIGHT : SWT.LEFT;
|
||||||
|
toggle.setAlignment(alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,38 +219,38 @@ public class InheritButton extends Composite {
|
||||||
* @param backgroundColor The background color with which the arrow images
|
* @param backgroundColor The background color with which the arrow images
|
||||||
* should be painted. The foreground color is black.
|
* should be painted. The foreground color is black.
|
||||||
*/
|
*/
|
||||||
private void createToggleImages(Color backgroundColor) {
|
// private void createToggleImages(Color backgroundColor) {
|
||||||
Display display = Display.getCurrent();
|
// Display display = Display.getCurrent();
|
||||||
GC gc = null;
|
// GC gc = null;
|
||||||
if (display != null) {
|
// if (display != null) {
|
||||||
leftArrow = new Image(display, 3, 5);
|
// leftArrow = new Image(display, 3, 5);
|
||||||
gc = new GC(leftArrow);
|
// gc = new GC(leftArrow);
|
||||||
gc.setBackground(backgroundColor);
|
// gc.setBackground(backgroundColor);
|
||||||
gc.fillRectangle(leftArrow.getBounds());
|
// gc.fillRectangle(leftArrow.getBounds());
|
||||||
gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
// gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
||||||
gc.drawLine(0, 2, 0, 2);
|
// gc.drawLine(0, 2, 0, 2);
|
||||||
gc.drawLine(1, 1, 1, 3);
|
// gc.drawLine(1, 1, 1, 3);
|
||||||
gc.drawLine(2, 0, 2, 4);
|
// gc.drawLine(2, 0, 2, 4);
|
||||||
gc.dispose();
|
// gc.dispose();
|
||||||
rightArrow = new Image(display, 3, 5);
|
// rightArrow = new Image(display, 3, 5);
|
||||||
gc = new GC(rightArrow);
|
// gc = new GC(rightArrow);
|
||||||
gc.setBackground(backgroundColor);
|
// gc.setBackground(backgroundColor);
|
||||||
gc.fillRectangle(rightArrow.getBounds());
|
// gc.fillRectangle(rightArrow.getBounds());
|
||||||
gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
// gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
|
||||||
gc.drawLine(0, 0, 0, 4);
|
// gc.drawLine(0, 0, 0, 4);
|
||||||
gc.drawLine(1, 1, 1, 3);
|
// gc.drawLine(1, 1, 1, 3);
|
||||||
gc.drawLine(2, 2, 2, 2);
|
// gc.drawLine(2, 2, 2, 2);
|
||||||
gc.dispose();
|
// gc.dispose();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispose of the images used for the arrow graphics. Should be invoked
|
* Dispose of the images used for the arrow graphics. Should be invoked
|
||||||
* when the button is disposed.
|
* when the button is disposed.
|
||||||
*/
|
*/
|
||||||
private void disposeToggleImages() {
|
// private void disposeToggleImages() {
|
||||||
if (leftArrow != null) leftArrow.dispose();
|
// if (leftArrow != null) leftArrow.dispose();
|
||||||
if (rightArrow != null) rightArrow.dispose();
|
// if (rightArrow != null) rightArrow.dispose();
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
|
@ -613,26 +613,31 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
|
||||||
scheme used an SWT.ARROW button style which was not tab enabled and could not provide a focus rectangle.
|
scheme used an SWT.ARROW button style which was not tab enabled and could not provide a focus rectangle.
|
||||||
Changes: made the control a push button, programmatically drew the arrow on the button, and provided accessibility information.
|
Changes: made the control a push button, programmatically drew the arrow on the button, and provided accessibility information.
|
||||||
*/
|
*/
|
||||||
historyButton = new Button(this, SWT.PUSH);
|
/*
|
||||||
Display display = this.getDisplay();
|
* dwd: as of eclipse 3.2 it now appears the arrow buttons are accessible, reverting to previous implementation.
|
||||||
final Image upArrow = new Image(display, 5, 6);
|
*/
|
||||||
GC gc = new GC(upArrow);
|
historyButton = new Button(this, SWT.ARROW);
|
||||||
gc.setBackground(historyButton.getBackground());
|
historyButton.setAlignment(SWT.UP);
|
||||||
gc.fillRectangle(upArrow.getBounds());
|
// historyButton = new Button(this, SWT.PUSH);
|
||||||
gc.setForeground(historyButton.getForeground());
|
// Display display = this.getDisplay();
|
||||||
gc.drawLine(0, 5, 4, 5);
|
// final Image upArrow = new Image(display, 5, 6);
|
||||||
gc.drawLine(0, 4, 4, 4);
|
// GC gc = new GC(upArrow);
|
||||||
gc.drawLine(1, 3, 3, 3);
|
// gc.setBackground(historyButton.getBackground());
|
||||||
gc.drawLine(1, 2, 3, 2);
|
// gc.fillRectangle(upArrow.getBounds());
|
||||||
gc.drawLine(2, 1, 2, 1);
|
// gc.setForeground(historyButton.getForeground());
|
||||||
gc.drawLine(2, 0, 2, 0);
|
// gc.drawLine(0, 5, 4, 5);
|
||||||
gc.dispose();
|
// gc.drawLine(0, 4, 4, 4);
|
||||||
historyButton.addDisposeListener(new DisposeListener() {
|
// gc.drawLine(1, 3, 3, 3);
|
||||||
public void widgetDisposed(DisposeEvent e) {
|
// gc.drawLine(1, 2, 3, 2);
|
||||||
upArrow.dispose();
|
// gc.drawLine(2, 1, 2, 1);
|
||||||
}
|
// gc.drawLine(2, 0, 2, 0);
|
||||||
});
|
// gc.dispose();
|
||||||
historyButton.setImage(upArrow);
|
// historyButton.addDisposeListener(new DisposeListener() {
|
||||||
|
// public void widgetDisposed(DisposeEvent e) {
|
||||||
|
// upArrow.dispose();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// historyButton.setImage(upArrow);
|
||||||
historyButton.setToolTipText(SystemResources.RESID_WORKWITHHISTORY_BUTTON_TIP);
|
historyButton.setToolTipText(SystemResources.RESID_WORKWITHHISTORY_BUTTON_TIP);
|
||||||
historyButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
historyButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
||||||
public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard.
|
public void getHelp(AccessibleEvent e) { // this is the one that should supply the text heard.
|
||||||
|
|
Loading…
Add table
Reference in a new issue