Skip to content

Commit b992dae

Browse files
author
soheil_h_y
committed
1. CheckBox enhancement for FF.
1 parent ef9bc32 commit b992dae

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Button.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ public void run() {
12741274
HTMLEvent e = (HTMLEvent) getEvent();
12751275
if ((style & SWT.CHECK) != 0) {
12761276
// Still buggy on check button with image
1277-
if (e.srcElement != btnHandle) {
1277+
if (e.srcElement != btnHandle && e.target != btnHandle) {
12781278
setSelection (!getSelection ());
12791279
}
12801280
} else {
@@ -1307,6 +1307,9 @@ public void run() {
13071307
handle.onclick = handle.ondblclick = eventHandler;
13081308
if ((style & (SWT.RADIO | SWT.CHECK)) != 0) {
13091309
btnText.onclick = eventHandler;
1310+
}
1311+
if((style & SWT.CHECK) != 0){
1312+
13101313
}
13111314
handle.onkeydown = new RunnableCompatibility() {
13121315
public void run() {

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Control.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public abstract class Control extends Widget implements Drawable {
7171
protected int height;
7272
protected int width;
7373
//private int lastLeft, lastTop, lastHeight, lastWidth;
74-
74+
boolean boundsSet = false;
7575
/**
7676
* Prevents uninitialized instances from being created outside the package.
7777
* @j2sIgnore
@@ -2076,6 +2076,7 @@ void setBounds (int x, int y, int width, int height, int flags, boolean defer) {
20762076
/**
20772077
* A patch to send bounds to support mirroring features like what Windows have.
20782078
*/
2079+
boundsSet = true;
20792080
int tempX = x;
20802081
if(parent != null){
20812082
if((parent.style & SWT.RIGHT_TO_LEFT) != 0){

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Decorations.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ public void run() {
657657
if ((defaultButton.style & (SWT.CHECK | SWT.TOGGLE)) != 0) {
658658

659659
if ((defaultButton.style & SWT.CHECK) != 0) {
660-
if (e.srcElement != defaultButton.btnHandle) {
660+
if (e.srcElement != defaultButton.btnHandle && e.target != defaultButton.btnHandle) {
661661
defaultButton.setSelection (!defaultButton.getSelection ());
662662
}
663663
} else {
@@ -681,6 +681,13 @@ public void run() {
681681
}
682682

683683
void nextWindowLocation(int wHint, int hHint) {
684+
/*
685+
* if the user has set the bounds of the shell we should not override it!
686+
*/
687+
if(boundsSet) {
688+
return;
689+
}
690+
684691
int delta = OS.getStringPlainHeight("A") + 4 + 6 + 1;
685692
if (window.defaultWindowLeft == null) {
686693
window.defaultWindowLeft = "64";
@@ -1708,6 +1715,7 @@ public void setMaximized (boolean maximized) {
17081715
Monitor monitor = getMonitor();
17091716
boolean updateBody = (monitor.handle == document.body); // update with current body client area
17101717
if (maximized) {
1718+
17111719
if (updateBody) {
17121720
lastBodyScrollLeft = node.scrollLeft;
17131721
lastBodyScrollTop = node.scrollTop;
@@ -1755,10 +1763,13 @@ public void setMaximized (boolean maximized) {
17551763
* @j2sNative
17561764
* isOptMaximized = window["ShellManager"] != null;
17571765
*/ {}
1766+
1767+
17581768
if (!isOptMaximized) {
17591769
setBounds(computeTrim(0, 0, width, height - titleHeight));
17601770
} else {
1761-
setBounds(computeTrim(0, -titleHeight, width, height));
1771+
Rectangle trim = computeTrim(0, -titleHeight, width, height);
1772+
setBounds(trim.x, trim.y, trim.width, trim.height);
17621773
toUpdateMax = true;
17631774
}
17641775
}
@@ -2401,6 +2412,7 @@ protected boolean SetWindowPos(Object hWnd, Object hWndInsertAfter, int X, int Y
24012412
el.style.top = Y + "px";
24022413
el.style.width = (cx > 0 ? cx : 0) + "px";
24032414
el.style.height = (cy > 0 ? cy : 0) + "px";
2415+
24042416
return true;
24052417
// return super.SetWindowPos(hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
24062418
}

0 commit comments

Comments
 (0)