Skip to content

Commit 862f026

Browse files
author
soheil_h_y
committed
1. isActive is chagned to j2sIsActive
2. setParent is not completely implemented
1 parent 3aea039 commit 862f026

File tree

1 file changed

+11
-6
lines changed
  • sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets

1 file changed

+11
-6
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ public boolean forceFocus () {
661661
if (display.focusEvent == SWT.FocusOut) return false;
662662
Decorations shell = menuShell ();
663663
shell.setSavedFocus (this);
664-
if (!isEnabled () || !isVisible () || !isActive ()) return false;
664+
if (!isEnabled () || !isVisible () || !j2sIsActive ()) return false;
665665
if (isFocusControl ()) return true;
666666
shell.setSavedFocus (null);
667667
/*
@@ -1250,8 +1250,7 @@ public void internal_dispose_GC (int hDC, GCData data) {
12501250
}
12511251
}
12521252
*/
1253-
1254-
boolean isActive () {
1253+
boolean j2sIsActive () {
12551254
Shell dialogShell = display.getModalDialogShell ();
12561255
if (dialogShell != null && dialogShell != getShell ()) {
12571256
return false;
@@ -3398,15 +3397,21 @@ public boolean setParent (Composite parent) {
33983397
fixChildren (newShell, oldShell, newDecorations, oldDecorations, menus);
33993398
}
34003399
//TODO
3401-
// Element topHandle = topHandle ();
3400+
Control[] children = parent.children;
3401+
children[children.length + 1] = this;
3402+
Element topHandle = topHandle ();
3403+
topHandle.parentNode.removeChild(handle);
3404+
parent.topHandle().appendChild(handle);
34023405
// if (OS.SetParent (topHandle, parent.handle) == 0) return false;
34033406
// Element newHandle = this.handle.cloneNode(true);
34043407
// parent.handle.appendChild(this.handle.cloneNode(true));
34053408
// this.parent.handle.removeChild(this.handle);
3406-
// display.sendMessage(new MESSAGE(parent, MESSAGE.CONTROL_LAYOUT, null));
3409+
Composite oldParent = this.parent;
34073410
this.parent = parent;
34083411
// this.handle = newHandle;
3409-
// display.sendMessage(new MESSAGE(parent, MESSAGE.CONTROL_LAYOUT, null));
3412+
// parent.layout(true);
3413+
display.sendMessage(new MESSAGE(oldParent, MESSAGE.CONTROL_LAYOUT, null));
3414+
display.sendMessage(new MESSAGE(parent, MESSAGE.CONTROL_LAYOUT, null));
34103415
// int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
34113416
// SetWindowPos (topHandle, OS.HWND_BOTTOM, 0, 0, 0, 0, flags);
34123417
return true;

0 commit comments

Comments
 (0)