return isControlPanel;
}
- public void openKeyWindow(boolean attach) {
+ public void openKeyWindow(int attach) {
if (controlPanel != null) {
controlPanel.getShell().setVisible(true);
SkinUtil.setTopMost(controlPanel.getShell(), isOnTop);
setIsControlPanel(isControlPanel);
if (isControlPanel == true) {
openKeyWindow((controlPanel == null) ?
- true : controlPanel.isAttach());
+ SWT.NONE : controlPanel.isAttach());
} else { /* hide a key window */
- if (controlPanel != null && controlPanel.isAttach()) {
+ if (controlPanel != null &&
+ controlPanel.isAttach() != SWT.NONE) {
pairTagCanvas.setVisible(false);
controlPanel.getShell().close();
} else {
skin.pairTagCanvas.setVisible(false);
} else {
skin.setIsControlPanel(true);
- skin.openKeyWindow(true);
+ skin.openKeyWindow(SWT.RIGHT | SWT.CENTER);
/* move a key window to right of the emulator window */
if (skin.controlPanel != null) {
skin.controlPanel.setShellPosition(
- SWT.RIGHT | SWT.CENTER, false);
+ SWT.RIGHT | SWT.CENTER, true, false);
}
}
}
}
if (skin.controlPanel != null &&
- skin.controlPanel.isAttach() == true) {
+ skin.controlPanel.isAttach() != SWT.NONE) {
skin.controlPanel.setShellPosition(
- SWT.RIGHT | SWT.CENTER, false);
+ skin.controlPanel.isAttach(), false, false);
}
}
};
shell.setLocation(x, y);
if (skin.controlPanel != null &&
- skin.controlPanel.isAttach() == true) {
+ skin.controlPanel.isAttach() != SWT.NONE) {
skin.controlPanel.setShellPosition(
- SWT.RIGHT | SWT.CENTER, false);
+ skin.controlPanel.isAttach(), false, false);
}
}
}
grabPosition.x = grabPosition.y = 0;
if (skin.controlPanel != null &&
- skin.controlPanel.isAttach() == true) {
+ skin.controlPanel.isAttach() != SWT.NONE) {
skin.controlPanel.setShellPosition(
- SWT.RIGHT | SWT.CENTER, true);
+ skin.controlPanel.isAttach(), false, true);
}
}
}
isGrabbedShell = false;
grabPosition.x = grabPosition.y = 0;
+ /* Let me check whether the key window was landed
+ * on docking area. */
Rectangle parentBounds = parent.getBounds();
Rectangle childBounds = shell.getBounds();
- Rectangle attachBounds = new Rectangle(
- parentBounds.x + parentBounds.width - 5,
- parentBounds.y + (parentBounds.height / 2) - 2,
- 30, 4);
-
- if (childBounds.intersects(attachBounds) == true) {
- setShellPosition(SWT.RIGHT | SWT.CENTER, true);
- isAttach = true;
+ /* right-middle */
+ Rectangle attachBounds1 = new Rectangle(
+ (parentBounds.x + parentBounds.width) - 5,
+ (parentBounds.y + (parentBounds.height / 2)) - 10,
+ 30, 20);
+ /* right-top */
+ Rectangle attachBounds2 = new Rectangle(
+ (parentBounds.x + parentBounds.width) - 5,
+ (parentBounds.y) - 40,
+ 30, 80);
+ /* right-bottom */
+ Rectangle attachBounds3 = new Rectangle(
+ (parentBounds.x + parentBounds.width) - 5,
+ (parentBounds.y + parentBounds.height) - 40,
+ 30, 80);
+
+ if (childBounds.intersects(attachBounds1) == true) {
+ setShellPosition(SWT.RIGHT | SWT.CENTER, false, true);
+ isAttach = SWT.RIGHT | SWT.CENTER;
+ } else if (childBounds.intersects(attachBounds2) == true) {
+ setShellPosition(SWT.RIGHT | SWT.TOP, false, true);
+ isAttach = SWT.RIGHT | SWT.TOP;
+ } else if (childBounds.intersects(attachBounds3) == true) {
+ setShellPosition(SWT.RIGHT | SWT.BOTTOM, false, true);
+ isAttach = SWT.RIGHT | SWT.BOTTOM;
} else {
- isAttach = false;
+ isAttach = SWT.NONE;
}
}
}
protected Shell shell;
protected Shell parent;
private int shellPositionType;
- protected boolean isAttach;
+ protected int isAttach;
public SkinWindow(Shell parent, int shellPositionType) {
this.parent = parent;
this.shellPositionType = shellPositionType;
- this.isAttach = false;
+ this.isAttach = SWT.NONE;
}
public Shell getShell() {
return;
}
- setShellPosition(shellPositionType, true);
- isAttach = true;
+ setShellPosition(shellPositionType, true, true);
+ isAttach = SWT.RIGHT | SWT.CENTER;
shell.open();
}
}
- public void setShellPosition(int shellPositionType, boolean enableLogger) {
+ public void setShellPosition(int shellPositionType,
+ boolean correction, boolean enableLogger) {
int x = 0;
int y = 0;
y = parentBounds.y;
/* correction of location */
- if ((x + childBounds.width) >
- (monitorBounds.x + monitorBounds.width)) {
- x = parentBounds.x - childBounds.width;
- }
+// if ((x + childBounds.width) >
+// (monitorBounds.x + monitorBounds.width)) {
+// x = parentBounds.x - childBounds.width;
+// }
+ } else if (shellPositionType == (SWT.RIGHT | SWT.BOTTOM)) {
+ x = parentBounds.x + parentBounds.width;
+ y = parentBounds.y + parentBounds.height - childBounds.height;
+
+ /* correction of location */
+// int shift = (monitorBounds.x + monitorBounds.width) -
+// (x + childBounds.width);
+// if (shift < 0) {
+// x += shift;
+// parent.setLocation(parentBounds.x + shift, parentBounds.y);
+// }
} else { /* SWT.RIGHT | SWT.CENTER */
x = parentBounds.x + parentBounds.width;
y = parentBounds.y + (parentBounds.height / 2) -
(childBounds.height / 2);
+ }
- /* correction of location */
+ /* correction of location */
+ if (correction == true) {
int shift = (monitorBounds.x + monitorBounds.width) -
(x + childBounds.width);
if (shift < 0) {
shell.setLocation(x, y);
}
- public void setAttach(boolean attach) {
+ public void setAttach(int attach) {
isAttach = attach;
}
- public boolean isAttach() {
+ public int isAttach() {
return isAttach;
}
}