import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Decorations;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
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.ControlPanel;
import org.tizen.emulator.skin.window.SkinWindow;
/**
int x, int y, int resolutionW, int resolutionH,
int scale, short rotationId, boolean isOnKbd) {
- shell.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
+ //shell.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
shell.setLocation(x, y);
String emulatorName = SkinUtil.makeEmulatorName(config);
this.currentRotationId = rotationId;
this.currentAngle = SkinRotation.getAngle( rotationId );
- if (skinMode != SkinMode.GENERAL) {
+ if (skinMode == SkinMode.GENERAL) {
+ /* folding button */
+ 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) {
+ /* do nothing */
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ //TODO:
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ /* do nothing */
+ }
+ });
+
+ /* HW keys region */
+ Decorations decoration = new Decorations(shell, SWT.BORDER);
+ decoration.setLayout(new GridLayout(1, true));
+
+ RotationType rotation = SkinRotation.getRotation(currentRotationId);
+ List<KeyMapType> keyMapList = rotation.getKeyMapList().getKeyMap();
+
+ // TODO: function
+ if (keyMapList != null && keyMapList.isEmpty() == false) {
+ for (KeyMapType keyEntry : keyMapList) {
+ Button hardKeyButton = new Button(decoration, SWT.FLAT);
+ hardKeyButton.setText(keyEntry.getEventInfo().getKeyName());
+ hardKeyButton.setToolTipText(keyEntry.getTooltip());
+
+ hardKeyButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ final int keycode = keyEntry.getEventInfo().getKeyCode();
+ hardKeyButton.addMouseListener(new MouseListener() {
+ @Override
+ public void mouseDown(MouseEvent e) {
+ KeyEventData keyEventData = new KeyEventData(
+ KeyEventType.PRESSED.value(), keycode, 0, 0);
+ communicator.sendToQEMU(SendCommand.SEND_HARD_KEY_EVENT, keyEventData);
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ KeyEventData keyEventData = new KeyEventData(
+ KeyEventType.RELEASED.value(), keycode, 0, 0);
+ communicator.sendToQEMU(SendCommand.SEND_HARD_KEY_EVENT,
+ keyEventData);
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ /* do nothing */
+ }
+ });
+ }
+ }
+
+ FormData dataDecoration = new FormData();
+ dataDecoration.left = new FormAttachment(foldingButton, 0);
+ dataDecoration.top = new FormAttachment(0, 0);
+ decoration.setLayoutData(dataDecoration);
+ } else {
Image tempImage = null;
Image tempKeyPressedImage = null;
final Menu menu = new Menu(shell, SWT.DROP_DOWN);
/* Control Panel menu */
- final MenuItem panelItem = new MenuItem(menu, SWT.PUSH);
+ /*final MenuItem panelItem = new MenuItem(menu, SWT.PUSH);
panelItem.setText("&Control Panel");
//panelItem.setImage(imageRegistry.getIcon(IconName.XXX));
panelItem.addSelectionListener(new SelectionAdapter() {
controlPanel = null;
}
}
- } );
+ } );*/
/* Screen shot menu */
final MenuItem screenshotItem = new MenuItem(menu, SWT.PUSH);