skin: hide a emulator shell
authorgiwoong.kim <giwoong.kim@samsung.com>
Mon, 17 Dec 2012 12:01:58 +0000 (21:01 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Mon, 17 Dec 2012 12:01:58 +0000 (21:01 +0900)
hide a shell while emulator rotation/scaling

Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java

index f642830a7aa6afb79de4558587c0dcc30a184888..876dc1e01367971cf8ce13f99c196c9705162ec2 100644 (file)
@@ -1159,25 +1159,25 @@ public class EmulatorSkin {
 
                SelectionAdapter selectionAdapter = new SelectionAdapter() {
                        @Override
-                       public void widgetSelected( SelectionEvent e ) {
+                       public void widgetSelected(SelectionEvent e) {
 
                                MenuItem item = (MenuItem) e.getSource();
 
                                boolean selection = item.getSelection();
 
-                               if ( !selection ) {
+                               if (!selection) {
                                        return;
                                }
 
-                               if ( !communicator.isSensorDaemonStarted() ) {
+                               if (!communicator.isSensorDaemonStarted()) {
 
                                        /* roll back a selection */
-                                       item.setSelection( false );
+                                       item.setSelection(false);
 
-                                       for ( MenuItem m : rotationList ) {
+                                       for (MenuItem m : rotationList) {
                                                short rotationId = (Short) m.getData();
                                                if (currentState.getCurrentRotationId() == rotationId) {
-                                                       m.setSelection( true );
+                                                       m.setSelection(true);
                                                        break;
                                                }
                                        }
@@ -1190,8 +1190,20 @@ public class EmulatorSkin {
 
                                short rotationId = ((Short) item.getData());
 
+                               Point location = new Point(100, 100);
+                               if (skinInfo.isPhoneShape()) { /* TODO: */
+                                       location = shell.getLocation();
+                                       shell.setVisible(false);
+                               }
+
                                skinComposer.arrangeSkin(currentState.getCurrentScale(), rotationId);
 
+                               if (skinInfo.isPhoneShape()) { /* TODO: */
+                                       shell.setVisible(true);
+                                       shell.setLocation(location);
+                                       SkinUtil.setTopMost(shell, isOnTop);
+                               }
+
                                LcdStateData lcdStateData =
                                                new LcdStateData(currentState.getCurrentScale(), rotationId);
                                communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE, lcdStateData);
@@ -1205,7 +1217,7 @@ public class EmulatorSkin {
                return menu;
        }
 
-       private Menu createScaleMenu(Shell shell) {
+       private Menu createScaleMenu(final Shell shell) {
 
                Menu menu = new Menu(shell, SWT.DROP_DOWN);
 
@@ -1234,20 +1246,32 @@ public class EmulatorSkin {
                SelectionAdapter selectionAdapter = new SelectionAdapter() {
 
                        @Override
-                       public void widgetSelected( SelectionEvent e ) {
+                       public void widgetSelected(SelectionEvent e) {
 
                                MenuItem item = (MenuItem) e.getSource();
 
                                boolean selection = item.getSelection();
 
-                               if ( !selection ) {
+                               if (!selection) {
                                        return;
                                }
 
                                int scale = ((Scale) item.getData()).value();
 
+                               Point location = new Point(100, 100);
+                               if (skinInfo.isPhoneShape()) { /* TODO: */
+                                       location = shell.getLocation();
+                                       shell.setVisible(false);
+                               }
+
                                skinComposer.arrangeSkin(scale, currentState.getCurrentRotationId());
 
+                               if (skinInfo.isPhoneShape()) { /* TODO: */
+                                       shell.setVisible(true);
+                                       shell.setLocation(location);
+                                       SkinUtil.setTopMost(shell, isOnTop);
+                               }
+
                                LcdStateData lcdStateData =
                                                new LcdStateData(scale, currentState.getCurrentRotationId());
                                communicator.sendToQEMU(SendCommand.CHANGE_LCD_STATE, lcdStateData);
@@ -1255,19 +1279,17 @@ public class EmulatorSkin {
                        }
                };
                
-               for ( MenuItem menuItem : scaleList ) {
+               for (MenuItem menuItem : scaleList) {
 
-                       int scale = ( (Scale) menuItem.getData() ).value();
+                       int scale = ((Scale) menuItem.getData()).value();
                        if (currentState.getCurrentScale() == scale) {
-                               menuItem.setSelection( true );
+                               menuItem.setSelection(true);
                        }
 
-                       menuItem.addSelectionListener( selectionAdapter );
-
+                       menuItem.addSelectionListener(selectionAdapter);
                }
 
                return menu;
-
        }
 
        private Menu createDiagnosisMenu(Shell shell) {