BUTTON_LAUNCH_DISABLE("button_launch_dis"),
BUTTON_LAUNCH_NOMAL("button_launch_nml"),
BUTTON_LAUNCH_HOVER("button_launch_hover"),
- BUTTON_LAUNCH_PUSH("button_launch_pushed");
+ BUTTON_LAUNCH_PUSH("button_launch_pushed"),
+
+ VM_IMAGE_CUSTOM_HOVER("emulator_list_custom_image_hover"),
+ VM_IMAGE_CUSTOM_NORMAL("emulator_list_custom_image_nml");
String name;
Map<String,Image> image;
this.frames = new HashMap<String, ImageData[]>();
}
+ public Image getImage(String platformName, String shape) {
+ String group = platformName;
+ if (shape != null && !shape.isEmpty()) {
+ group += "-" + shape;
+ }
+ return getImage(group);
+ }
+
// TODO
public Image getImage(String platformName) {
Image i = image.get(platformName);
import org.tizen.emulator.manager.platform.BaseImage;
import org.tizen.emulator.manager.ui.widgets.VMButton;
import org.tizen.emulator.manager.ui.widgets.VMCreateButton;
+import org.tizen.emulator.manager.vms.VMProperty;
public class VMButtonFactory {
private static ArrayList<VMButton> buttons = new ArrayList<VMButton> ();
private static int selectedIndex = 0;
- public static VMButton getButton(Composite parent, BaseImage base) {
- VMButton b = new VMButton(parent, SWT.NONE, base);
+ public static VMButton getButton(Composite parent, BaseImage base, VMProperty property) {
+ VMButton b = new VMButton(parent, SWT.NONE, base, property);
b.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
--- /dev/null
+/* Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@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.manager.ui.widgets;
+
+public interface IVMButtonPainter {
+
+ // Offset in VMButton.
+ public int getLaunchButtonBottomOffset();
+ public int getLaunchButtonLeftOffset();
+}
import org.eclipse.swt.widgets.Listener;
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.platform.BaseImage;
+import org.tizen.emulator.manager.platform.Skin;
import org.tizen.emulator.manager.plugin.ExtensionItem;
import org.tizen.emulator.manager.plugin.PluginImageResources;
import org.tizen.emulator.manager.plugin.PluginStringResources;
import org.tizen.emulator.manager.ui.MainDialog;
import org.tizen.emulator.manager.ui.VMsMainView;
import org.tizen.emulator.manager.ui.list.VMButtonFactory;
+import org.tizen.emulator.manager.vms.SKIN_SHAPE;
import org.tizen.emulator.manager.vms.VMProperty;
import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator;
import org.tizen.emulator.manager.vms.helper.HelperClass;
private int LAUNCH_BUTTON_WIDTH = 40;
private int LAUNCH_BUTTON_HEIGHT =14;
- public VMButton(Composite parent, int style, BaseImage base) {
+ private int launchButtonLeftOffset;
+ private int launchButtonBottomOffset;
+
+ public VMButton(Composite parent, int style, BaseImage base, VMProperty property) {
super(parent, style);
this.baseImage = base;
+ this.property = property;
button = this;
this.setLayout(new FormLayout());
item = base.getPlatform().getPlugin()
.getExtensionItem(PluginStringResources.VMButtonPainter);
}
+
if (item != null) {
this.setPainListener((PaintListener)item.createClass());
+ launchButtonLeftOffset = ((IVMButtonPainter)item.createClass()).getLaunchButtonLeftOffset();
+ launchButtonBottomOffset = ((IVMButtonPainter)item.createClass()).getLaunchButtonBottomOffset();
} else {
this.setPainListener(VMButtonPaintListener);
+ launchButtonLeftOffset = 13;
+ launchButtonBottomOffset = 13;
}
settingImage();
}
private void settingImage() {
+ String shape="";
+ if (button.getProperty() != null) {
+ Skin skin = button.getProperty().getPropertyValue().skin;
+ if (skin != null && skin.getSkinShape() == SKIN_SHAPE.CIRCLE) {
+ shape = skin.getSkinShape().toString();
+ }
+ }
+
for (WSTATE s : WSTATE.values()) {
- images.add(s.getId(), PluginImageResources.VM_IMAGE_NOMAL.getImage(baseImage.getPlatform().getPluginPlatformName()));
+ images.add(s.getId(), PluginImageResources.VM_IMAGE_NOMAL.getImage(baseImage.getPlatform().getPluginPlatformName(), shape));
}
BUTTON_WIDTH = images.get(0).getImageData().width;
BUTTON_HEIGHT = images.get(0).getImageData().height;
- images.set(WSTATE.HOVER.getId(), PluginImageResources.VM_IMAGE_HOVER.getImage(baseImage.getPlatform().getPluginPlatformName()));
- images.set(WSTATE.SELECTED_HOVER.getId(), PluginImageResources.VM_IMAGE_HOVER.getImage(baseImage.getPlatform().getPluginPlatformName()));
+ images.set(WSTATE.HOVER.getId(), PluginImageResources.VM_IMAGE_HOVER.getImage(baseImage.getPlatform().getPluginPlatformName(), shape));
+ images.set(WSTATE.SELECTED_HOVER.getId(), PluginImageResources.VM_IMAGE_HOVER.getImage(baseImage.getPlatform().getPluginPlatformName(), shape));
}
@Override
FormData data = new FormData();
//data.top = new FormAttachment(0, 119 + H_OFFSET);
- data.bottom = new FormAttachment(100, -10 - 3);
- data.left = new FormAttachment(0, 10 + 3);
+ data.bottom = new FormAttachment(100, - launchButtonBottomOffset);
+ data.left = new FormAttachment(0, + launchButtonLeftOffset);
data.width = LAUNCH_BUTTON_WIDTH;
data.height = LAUNCH_BUTTON_HEIGHT;
}
}
- public void setProperty(VMProperty property) {
- this.property = property;
+ public void setProperty() {
this.setToolTipText(property.getName());
settingTitleWidth();
}
+
public VMProperty getProperty() {
return property;
}