[Title] added hardkey tooltip feature
authorgiwoong.kim <giwoong.kim@samsung.com>
Fri, 6 Apr 2012 12:27:14 +0000 (21:27 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Fri, 6 Apr 2012 16:33:14 +0000 (01:33 +0900)
[Type]
[Module] Emulator / skin
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index db65c5a..141bcba 100644 (file)
@@ -500,6 +500,8 @@ public class EmulatorSkin {
                                                shell.redraw( currentHoverRegion.x, currentHoverRegion.y, currentHoverRegion.width + 1,
                                                                currentHoverRegion.height + 1, false );
                                        }
+                                       shell.setToolTipText(null);
+
                                        isHoverState = false;
                                        currentHoverRegion.width = currentHoverRegion.height = 0;
                                }
@@ -539,10 +541,16 @@ public class EmulatorSkin {
                                                                shell.redraw( currentHoverRegion.x, currentHoverRegion.y, currentHoverRegion.width + 1,
                                                                                currentHoverRegion.height + 1, false );
                                                        }
+                                                       shell.setToolTipText(null);
+
                                                        isHoverState = false;
                                                        currentHoverRegion.width = currentHoverRegion.height = 0;
                                                }
                                        } else {
+                                               if (isHoverState == false) {
+                                                       shell.setToolTipText(SkinUtil.getHardKeyToolTip(e.x, e.y, currentRotationId, currentScale));
+                                               }
+
                                                isHoverState = true;
                                                GC gc = new GC( shell );
                                                gc.setLineWidth( 1 );
index 3019d1c..047226d 100644 (file)
@@ -197,6 +197,32 @@ public class SkinUtil {
 
        }
 
+       //TODO: HardKey object
+       public static String getHardKeyToolTip( int currentX, int currentY, short rotationId, int scale ) {
+
+               float convertedScale = convertScale( scale );
+
+               RotationType rotation = SkinRotation.getRotation( rotationId );
+
+               List<KeyMapType> keyMapList = rotation.getKeyMapList().getKeyMap();
+
+               for ( KeyMapType keyMap : keyMapList ) {
+                       RegionType region = keyMap.getRegion();
+
+                       int scaledX = (int) ( region.getLeft() * convertedScale );
+                       int scaledY = (int) ( region.getTop() * convertedScale );
+                       int scaledWidth = (int) ( region.getWidth() * convertedScale );
+                       int scaledHeight = (int) ( region.getHeight() * convertedScale );
+
+                       if ( isInGeometry( currentX, currentY, scaledX, scaledY, scaledWidth, scaledHeight ) ) {
+                               return keyMap.getTooltip();
+                       }
+               }
+
+               return null;
+
+       }
+
        public static boolean isInGeometry( int currentX, int currentY, int targetX, int targetY, int targetWidth,
                        int targetHeight ) {