Add CustomProgressBar for booting status.
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.SwtUtil;
import org.tizen.emulator.skin.window.ControlPanel;
+import org.tizen.emulator.skin.window.CustomProgressBar;
/**
*
public ControlPanel controlPanel;
public Color colorPairTag;
public Canvas pairTagCanvas;
+ public CustomProgressBar bootingProgress;
protected ScreenShotDialog screenShotDialog;
protected SocketCommunicator communicator;
imageRegistry = ImageRegistry.getInstance();
if (skinInfo.isPhoneShape() == true) { /* phone shape skin */
- skinComposer = new PhoneShapeSkinComposer(config, shell,
- currentState, imageRegistry, communicator);
+ skinComposer = new PhoneShapeSkinComposer(config, this,
+ shell, currentState, imageRegistry, communicator);
((PhoneShapeSkinComposer) skinComposer).addPhoneShapeListener(shell);
} else { /* general purpose skin */
import org.tizen.emulator.skin.util.SkinRotation;
import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.SwtUtil;
+import org.tizen.emulator.skin.window.CustomProgressBar;
import org.tizen.emulator.skin.window.ImageButton;
public class GeneralPurposeSkinComposer implements ISkinComposer {
});
skin.pairTagCanvas.setVisible(false);
+ /* create a progress bar for booting status */
+ skin.bootingProgress = new CustomProgressBar(shell, SWT.NONE);
+ skin.bootingProgress.setBackground(
+ new Color(shell.getDisplay(), new RGB(38, 38, 38)));
+
arrangeSkin(scale, rotationId);
/* open the key window */
currentState.setCurrentRotationId(rotationId);
currentState.setCurrentAngle(SkinRotation.getAngle(rotationId));
- /* arrange the lcd */
+ /* arrange the display */
Rectangle lcdBounds = adjustLcdGeometry(lcdCanvas,
currentState.getCurrentResolutionWidth(),
currentState.getCurrentResolutionHeight(), scale, rotationId);
lcdBounds.y + (lcdBounds.height / 2) - (toggleButton.getImageSize().y / 2),
toggleButton.getImageSize().x, toggleButton.getImageSize().y);
+ /* arrange the progress bar */
+ if (skin.bootingProgress != null) {
+ skin.bootingProgress.setBounds(lcdBounds.x,
+ lcdBounds.y + lcdBounds.height + 1, lcdBounds.width, 2);
+
+ skin.bootingProgress.dispose(); //TODO
+ skin.bootingProgress = null;
+ }
+
/* custom window shape */
trimPatchedShell(shell, currentState.getCurrentImage());
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
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.widgets.Canvas;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.skin.EmulatorSkin;
import org.tizen.emulator.skin.EmulatorSkinState;
import org.tizen.emulator.skin.comm.ICommunicator.KeyEventType;
import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
import org.tizen.emulator.skin.util.SkinRotation;
import org.tizen.emulator.skin.util.SkinUtil;
import org.tizen.emulator.skin.util.SwtUtil;
+import org.tizen.emulator.skin.window.CustomProgressBar;
public class PhoneShapeSkinComposer implements ISkinComposer {
private Logger logger = SkinLogger.getSkinLogger(
PhoneShapeSkinComposer.class).getLogger();
private EmulatorConfig config;
+ private EmulatorSkin skin;
private Shell shell;
private Canvas lcdCanvas;
private EmulatorSkinState currentState;
private boolean isGrabbedShell;
private Point grabPosition;
- public PhoneShapeSkinComposer(EmulatorConfig config, Shell shell,
- EmulatorSkinState currentState, ImageRegistry imageRegistry,
- SocketCommunicator communicator) {
+ public PhoneShapeSkinComposer(EmulatorConfig config, EmulatorSkin skin,
+ Shell shell, EmulatorSkinState currentState,
+ ImageRegistry imageRegistry, SocketCommunicator communicator) {
this.config = config;
+ this.skin = skin;
this.shell = shell;
this.currentState = currentState;
this.imageRegistry = imageRegistry;
shell.setImage(imageRegistry.getIcon(IconName.EMULATOR_TITLE));
}
+ /* create a progress bar for booting status */
+ skin.bootingProgress = new CustomProgressBar(shell, SWT.NONE);
+ skin.bootingProgress.setBackground(
+ new Color(shell.getDisplay(), new RGB(38, 38, 38)));
+
arrangeSkin(scale, rotationId);
if (currentState.getCurrentImage() == null) {
currentState.setCurrentRotationId(rotationId);
currentState.setCurrentAngle(SkinRotation.getAngle(rotationId));
- /* arrange the lcd */
+ /* arrange the display */
Rectangle lcdBounds = adjustLcdGeometry(lcdCanvas,
currentState.getCurrentResolutionWidth(),
currentState.getCurrentResolutionHeight(), scale, rotationId);
tempKeyPressedImage.dispose();
}
+ /* arrange the progress bar */
+ if (skin.bootingProgress != null) {
+ skin.bootingProgress.setBounds(lcdBounds.x,
+ lcdBounds.y + lcdBounds.height + 1, lcdBounds.width, 2);
+
+ skin.bootingProgress.dispose(); //TODO:
+ skin.bootingProgress = null;
+ }
+
/* custom window shape */
SkinUtil.trimShell(shell, currentState.getCurrentImage());
--- /dev/null
+/**
+ *
+ *
+ * Copyright ( C ) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.skin.window;
+
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+
+public class CustomProgressBar extends Canvas {
+ private int selection = 0;
+
+ public CustomProgressBar(final Composite parent, int style) {
+ super(parent, style);
+
+ this.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ e.gc.setBackground(
+ new Color(parent.getDisplay(), new RGB(0, 173, 239)));
+
+ Rectangle bounds = getBounds();
+ int width = (bounds.width * selection) / 100;
+ e.gc.fillRectangle(0, 0, width, bounds.height);
+ }
+ });
+ }
+
+ public void setSelection(int value) {
+ if (value < 0) {
+ value = 0;
+ } else if (value > 100) {
+ value = 100;
+ }
+
+ selection = value;
+ redraw();
+ }
+
+ public int getSelection() {
+ return selection;
+ }
+}