import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
this.currentLcdHeight = resolutionH;
this.currentScale = scale;
this.currentRotationId = rotationId;
- this.currentAngle = SkinRotation.getAngle( rotationId );
+ this.currentAngle = SkinRotation.getAngle(rotationId);
+
+ /* arrange the lcd */
+ Rectangle lcdBounds = SkinUtil.adjustLcdGeometry(
+ lcdCanvas, currentLcdWidth, currentLcdHeight, scale, rotationId,
+ skinInfo.isPhoneShape());
if (skinInfo.isPhoneShape() == false) {
/* folding button */
foldingButton = new Button(shell, SWT.PUSH);
foldingButton.setText(">");
- FormData dataFoldingButton = new FormData();
- dataFoldingButton.left = new FormAttachment(lcdCanvas, 0);
- dataFoldingButton.top = new FormAttachment(0, 0);
- foldingButton.setLayoutData(dataFoldingButton);
-
foldingButton.addMouseListener(new MouseListener() {
@Override
public void mouseDown(MouseEvent e) {
public void mouseUp(MouseEvent e) {
if (skinInfo.getSkinOption() == 0) {
skinInfo.setSkinOption(1);
-
foldingButton.setText("<");
} else {
skinInfo.setSkinOption(0);
-
foldingButton.setText(">");
}
/* do nothing */
}
});
+
+ shell.pack();
}
+ FormData dataFoldingButton = new FormData();
+ dataFoldingButton.left = new FormAttachment(lcdCanvas, 0);
+ dataFoldingButton.top = new FormAttachment(
+ 0, (lcdBounds.height / 2) - (foldingButton.getSize().y / 2));
+ foldingButton.setLayoutData(dataFoldingButton);
+
if (skinInfo.getSkinOption() == 0) {
/* HW keys region */
if (decoration == null) {
SkinUtil.trimShell(shell, currentImage);
}
- /* arrange the lcd */
- SkinUtil.adjustLcdGeometry(lcdCanvas, currentLcdWidth, currentLcdHeight,
- scale, rotationId, skinInfo.isPhoneShape());
-
/* set window size */
if (null != currentImage) {
ImageData imageData = currentImage.getImageData();
return sdbPath;
}
- public static void adjustLcdGeometry(
+ public static Rectangle adjustLcdGeometry(
Canvas lcdCanvas, int resolutionW, int resolutionH,
int scale, short rotationId, boolean isPhoneShape) {
float convertedScale = convertScale(scale);
- int l = 0, t = 0, w = 0, h = 0;
+ Rectangle lcdBounds = new Rectangle(0, 0, 0, 0);
if (isPhoneShape == false) {
RotationInfo rotation = RotationInfo.getValue(rotationId);
/* resoultion, that is lcd size in general skin mode */
if (RotationInfo.LANDSCAPE == rotation ||
RotationInfo.REVERSE_LANDSCAPE == rotation) {
- w = (int)(resolutionH * convertedScale);
- h = (int)(resolutionW * convertedScale);
+ lcdBounds.width = (int)(resolutionH * convertedScale);
+ lcdBounds.height = (int)(resolutionW * convertedScale);
} else {
- w = (int)(resolutionW * convertedScale);
- h = (int)(resolutionH * convertedScale);
+ lcdBounds.width = (int)(resolutionW * convertedScale);
+ lcdBounds.height = (int)(resolutionH * convertedScale);
}
} else {
RotationType rotation = SkinRotation.getRotation(rotationId);
Integer width = region.getWidth();
Integer height = region.getHeight();
- l = (int) (left * convertedScale);
- t = (int) (top * convertedScale);
- w = (int) (width * convertedScale);
- h = (int) (height * convertedScale);
+ lcdBounds.x = (int) (left * convertedScale);
+ lcdBounds.y = (int) (top * convertedScale);
+ lcdBounds.width = (int) (width * convertedScale);
+ lcdBounds.height = (int) (height * convertedScale);
}
FormData data = new FormData();
- data.left = new FormAttachment(0, l);
- data.top = new FormAttachment(0, t);
- data.width = w;
- data.height = h;
+ data.left = new FormAttachment(0, lcdBounds.x);
+ data.top = new FormAttachment(0, lcdBounds.y);
+ data.width = lcdBounds.width;
+ data.height = lcdBounds.height;
lcdCanvas.setLayoutData(data);
+
+ return lcdBounds;
}
public static SkinRegion getHardKeyArea( int currentX, int currentY, short rotationId, int scale ) {