\r
/** device and application combo specific colors start **/\r
public static Color DEVICE_APPLICATION_ENABLE = getColor("device_application_enable_font"); //$NON-NLS-1$\r
- public static Color DEVICE_APPLICATION_DISABLE = getColor("device_application_disable"); //$NON-NLS-1$\r
+ public static Color DEVICE_APPLICATION_DISABLE = getColor("device_application_disable_font"); //$NON-NLS-1$\r
public static Color DEVICE_APPLICATION_POPUP_OUTER_1 = getColor("device_application_popup_outer_1"); //$NON-NLS-1$\r
public static Color DEVICE_APPLICATION_POPUP_OUTER_2 = getColor("device_application_popup_outer_2"); //$NON-NLS-1$\r
public static Color DEVICE_APPLICATION_DROPDOWN_TEXT = getColor("device_application_enable_font"); //$NON-NLS-1$\r
// * About Dlg.\r
public static final Font ABOUT_TEXT = getFont(\r
"about_text", resizeDefaultFont(9, 2));//$NON-NLS-1$\r
+ \r
+ // * License Dlg.\r
+ public static final Font LICENSE_TEXT = getFont(\r
+ "license_text", resizeDefaultFont(8, 3));//$NON-NLS-1$\r
+ \r
// mac 11\r
public static final Font DIALOG_BUTTON_FONT = getFont(\r
"dialog_button_font", resizeDefaultFont(9, 2));//$NON-NLS-1$\r
public static final Image TREE_FOLD = getPngImage("tree_fold"); //$NON-NLS-1$\r
public static final Image NO_IMAGE = getPngImage("empty_snapshot"); //$NON-NLS-1$\r
public static final Image NO_IMAGE_SMALL = getPngImage("empty_snapshot_small"); //$NON-NLS-1$\r
+ \r
+ /*** context child arrow ***/\r
+ public static final Image CONTEXT_OPEN = getPngImage("context_menu_child_arrow"); //$NON-NLS-1$\r
\r
/* score */\r
public static final Image SCORE_0 = getPngImage("score_0"); //$NON-NLS-1$\r
// shell window background color
setColor("window_bg_color", new RGB(160, 160, 160)); //$NON-NLS-1$
- setColor("dialg_bg_upper", new RGB(206, 206, 206));
+ setColor("dialg_bg_upper", new RGB(232, 234, 235));
setColor("dialg_bg_lower", new RGB(240, 240, 240));
setColor("dialg_sunken_1", new RGB(160, 160, 160));
setColor("dialg_sunken_2", new RGB(255, 255, 255));
/** device and application combo specific colors start **/
setColor("device_application_enable_font", new RGB(0, 0, 0)); //$NON-NLS-1$
- setColor("device_application_disable_font", new RGB(160, 160, 160)); //$NON-NLS-1$
- setColor("device_application_popup_outer_1", new RGB(120, 120, 120)); //$NON-NLS-1$
- setColor("device_application_popup_outer_2", new RGB(50, 185, 231)); //$NON-NLS-1$
+ setColor("device_application_disable_font", new RGB(119, 223, 238)); //$NON-NLS-1$
+ setColor("device_application_popup_outer_1", new RGB(45, 180, 200)); //$NON-NLS-1$
+ setColor("device_application_popup_outer_2", new RGB(47, 85, 92)); //$NON-NLS-1$
setColor("device_application_item_normal_top", new RGB(255, 255, 255)); //$NON-NLS-1$
- setColor("device_application_item_normal_inner", new RGB(230, 230, 230)); //$NON-NLS-1$
- setColor(
- "device_application_item_normal_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
+ setColor("device_application_item_normal_inner", new RGB(232, 234, 235)); //$NON-NLS-1$
+ setColor("device_application_item_normal_bottom", new RGB(180, 180, 180)); //$NON-NLS-1$
setColor("device_application_item_select_top", new RGB(255, 255, 255)); //$NON-NLS-1$
- setColor("device_application_item_select_inner", new RGB(50, 185, 231)); //$NON-NLS-1$
- setColor(
- "device_application_item_select_bottom", new RGB(189, 189, 189)); //$NON-NLS-1$
+ setColor("device_application_item_select_inner", new RGB(45, 180, 200)); //$NON-NLS-1$
+ setColor("device_application_item_select_bottom", new RGB(180, 180, 180)); //$NON-NLS-1$
/** device and application combo specific colors end **/
/*** combo button gradation ***/
setColor(
"device_application_button_disable_start", new RGB(157, 157, 157)); //$NON-NLS-1$
setColor("device_application_button_disable_end", new RGB(78, 79, 81)); //$NON-NLS-1$
- setColor("device_application_button_outline", new RGB(31, 31, 31));
+
+ /*** combo arrow button color ***/
+ setColor("device_application_button_normal", new RGB(206, 206, 206)); //$NON-NLS-1$
+ setColor("device_application_button_push", new RGB(24, 147, 189)); //$NON-NLS-1$
+ setColor("device_application_button_hover", new RGB(45, 180, 200)); //$NON-NLS-1$
+ setColor("device_application_button_disable", new RGB(206, 206, 206)); //$NON-NLS-1$
+ setColor("device_application_button_outline", new RGB(47, 85, 92));
/*** common button colors ***/
setColor("button_normal_color_start", new RGB(240, 240, 240));
}
Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
- if (attr.getButtonImage() == null) {
+ if (attr.getButtonImage(state) == null) {
drawButtonText(gc, r, state, attr);
}
Color c = gc.getForeground();
}
protected void drawButtonImage(GC gc, Rectangle rect,
- DACustomButtonAttribute attr) {
- if (attr != null && attr.getButtonImage() != null) {
- Image img = attr.getButtonImage();
+ DACustomButtonAttribute attr, int state) {
+ Image img = attr.getButtonImage(state);
+ if (attr != null && img != null) {
Rectangle imgRect = img.getBounds();
int width = rect.width - imgRect.width;
int height = rect.height - imgRect.height;
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* image button means background is image. <br>
* icon button means image draws on text field or front of text
*
- * @param img
- * the icon of icon button
+ *
+ * @param state
+ * The state of the button you want to set.
+ * @param image
+ * The image of the button you want to set.
*/
- public void setButtonImage(Image img) {
- attr.setButtonImage(img);
+
+ public void setButtonImage(int state, Image image) {
+ attr.setButtonImage(state, image);
}
-
+
/**
* Sets the user render of button. <br>
* this class has default renderer : DACustomButtonRenderer
}
/**
+ * Sets the icon images of button
+ *
+ * @param normal
+ * The image of normal state
+ * @param push
+ * The image of push state
+ * @param hover
+ * The image of hover state
+ * @param disable
+ * The image of disable state
+ */
+ public void setButtonImages(Image normal, Image push, Image hover, Image disable) {
+ attr.setButtonImage(STATE_NORMAL, normal);
+ attr.setButtonImage(STATE_PUSH, push);
+ attr.setButtonImage(STATE_HOVER, hover);
+ attr.setButtonImage(STATE_DISABLE, disable);
+ }
+
+ /**
* Sets the outside outline color of button.
*
* @param normal
import org.eclipse.swt.graphics.Point;
public class DACustomButtonAttribute {
- public static final int MAX_SIZE = 12;
+ public static final int MAX_SIZE = 14;
private String text;
- private Image buttonImage = null;
private Font font;
private Point fontPoint;
private int drawType = DACustomButton.TYPE_COLOR;
-
+ private List<Image> buttonImages = new ArrayList<Image>();
+ private Point buttonImagePoint;
+
private int align = SWT.CENTER;
private Image iconImage = null;
public DACustomButtonAttribute() {
for (int i = 0; i < MAX_SIZE; i++) {
+ buttonImages.add(null);
images.add(null);
colors.add(null);
fontColors.add(null);
this.text = text;
}
- public Image getButtonImage() {
- return buttonImage;
+ public Image getButtonImage(int state) {
+ if (!buttonImages.isEmpty()) {
+ return buttonImages.get(state);
+ }
+ return null;
}
- public void setButtonImage(Image img) {
- buttonImage = img;
+ public void setButtonImage(int state, Image buttonImage) {
+ buttonImages.set(state, buttonImage);
}
+ public Point getButtonImagePoint() {
+ return buttonImagePoint;
+ }
+
+ public void setButtonImagePoint(Point buttonImagePoint) {
+ this.buttonImagePoint = buttonImagePoint;
+ }
+
public Font getFont() {
return font;
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
|| attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
drawButton(gc, rect, state, attr);
}
- drawButtonImage(gc, rect, attr);
+ drawButtonImage(gc, rect, attr, state);
drawIcon(gc, rect, attr);
}
}
Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
- if (attr.getButtonImage() == null) {
+// if (attr.getButtonImage() == null) {
drawButtonText(gc, r, attr, state);
- }
+// }
Color c = gc.getForeground();
if (null != attr.getOutlineColor(state)) {
gc.setForeground(attr.getOutlineColor(state));
}
protected void drawButtonImage(GC gc, Rectangle rect,
- DACustomButtonAttribute attr) {
- if (attr != null && attr.getButtonImage() != null) {
- Image img = attr.getButtonImage();
+ DACustomButtonAttribute attr, int state) {
+
+ Image img = attr.getButtonImage(state);
+ if (attr != null && img != null) {
+ Point p = null;
Rectangle imgRect = img.getBounds();
- int width = rect.width - imgRect.width;
- int height = rect.height - imgRect.height;
+
int x = 0, y = 0;
- if (width > 0) {
- x = width / 2;
- }
+ if (null == (p = attr.getButtonImagePoint())) {
+ int width = rect.width - imgRect.width;
+ int height = rect.height - imgRect.height;
+ if (width > 0) {
+ x = width / 2;
+ }
- if (height > 0) {
- y = height / 2;
+ if (height > 0) {
+ y = height / 2;
+ }
+ } else {
+ x = p.x;
+ y = p.y;
}
+
gc.drawImage(img, x, y);
}
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
*\r
* Contact: \r
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>\r
* Jooyoul Lee <jy.exe.lee@samsung.com>\r
* Juyoung Kim <j0.kim@samsung.com>\r
*\r
Color normalEnd, Color pushStart, Color pushEnd, Color hoverStart,\r
Color hoverEnd, Color disableStart, Color disableEnd,\r
Color toggleStart, Color toggleEnd, Color toggleHoverStart,\r
- Color toggleHoverEnd) {\r
+ Color toggleHoverEnd, Color togglePushStart, Color togglePushEnd) {\r
this(parent, SWT.NONE);\r
attr.setColor(0, normalStart);\r
attr.setColor(1, normalEnd);\r
attr.setColor(9, toggleEnd);\r
attr.setColor(10, toggleHoverStart);\r
attr.setColor(11, toggleHoverEnd);\r
+ attr.setColor(12, togglePushStart);\r
+ attr.setColor(13, togglePushEnd);\r
attr.setDrawType(TYPE_GRADATION);\r
}\r
+ \r
+ public void setOutlineColors(Color normal, Color push, Color hover,\r
+ Color disable, Color toggle, Color toggleHover, Color togglePush) {\r
+ setOutlineColors(normal, togglePush, toggleHover, disable);\r
+ attr.setOutlineColor(STATE_TOGGLE, toggle);\r
+ attr.setOutlineColor(STATE_TOGGLE_HOVER, toggleHover);\r
+ attr.setOutlineColor(STATE_TOGGLE_PUSH, togglePush);\r
+ }\r
+\r
+ public void setOutlineInColors(Color normal, Color push, Color hover,\r
+ Color disable, Color toggle, Color toggleHover, Color togglePush) { \r
+ setOutlineInColors(normal, togglePush, toggleHover, disable);\r
+ attr.setOutlineInColor(STATE_TOGGLE, toggle);\r
+ attr.setOutlineInColor(STATE_TOGGLE_HOVER, toggleHover);\r
+ attr.setOutlineInColor(STATE_TOGGLE_PUSH, togglePush);\r
+ }\r
\r
protected void addToggleListeners() {\r
if (null != toggleButtonMouseListener) {\r
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
+import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonAttribute;
public class DACustomToggleButtonRenderer extends DACustomButtonRenderer {
+ private static final DALogger DA_LOG = DALogger.getInstance();
@Override
public void draw(GC gc, Canvas canvas, int state,
} else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
|| attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
drawButton(gc, rect, state, attr);
+ drawButtonToggleImage(gc, rect, state, attr);
}
}
+ private void drawButtonToggleImage(GC gc, Rectangle rect,
+ int state, DACustomButtonAttribute attr) {
+ Point p = null;
+ Image img = null;
+ Rectangle imgRect = null;
+
+ if (state < DACustomToggleButton.STATE_TOGGLE) {
+ // draw normal image
+ img = attr.getButtonImage(DACustomToggleButton.STATE_NORMAL);
+ } else { // state >= DACustomToggleButton.STATE_TOGGLE
+ // draw toggle image
+ img = attr.getButtonImage(DACustomToggleButton.STATE_TOGGLE);
+ }
+
+ if (null != img) {
+ imgRect = img.getBounds();
+ int x = 0, y = 0;
+ if (null == (p = attr.getButtonImagePoint())) {
+ int width = rect.width - imgRect.width;
+ int height = rect.height - imgRect.height;
+ if (width > 0) {
+ x = width / 2;
+ } else {
+ DA_LOG.debug("width size : " + width); //$NON-NLS-1$
+ }
+
+ if (height > 0) {
+ y = height / 2;
+ } else {
+ DA_LOG.debug("height size : " + height); //$NON-NLS-1$
+ }
+ } else {
+ x = p.x;
+ y = p.y;
+ }
+ gc.drawImage(img, x, y);
+ }
+
+ }
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
private static final int pageSize = 5;
+ public static final int TYPE_IMAGE = 0;
+ public static final int TYPE_COLOR = 1;
+ public static final int TYPE_GRADATION = 2;
+
Composite parent;
private Canvas combo = null;
private Canvas popup = null;
private List<String> items;
private List<Rectangle> rects = null;
+ private int arrowButtonHeight = 15;
+ private Point comboImagePoint;
+ private List<Image> comboImages = null;
+ private List<Color> colors = null;
+ private List<Color> outlineColors = null;
+ private int drawType = DACustomCombo.TYPE_COLOR; // color, gradation, image
+
private List<Image> images = null;
private Image buttonUp = null;
private Image buttonDown = null;
private int selection = 0;
private int tmpSelection = 0;
private String text = DAWidgetConstants.EMPTY_STRING;
- private boolean imgCombo = false;
private int state = STATE_NORMAL; // 0 normal 1 hover 2 push 3 disable
private DACustomComboRenderer comboRenderer = new DACustomComboDefaultRenderer();;
private DACustomComboPopupRenderer popupRenderer = new DACustomComboPopupDefaultRenderer();
private IDACustomButtonRenderer buttonRenderer = null;
private List<Color> arrowColors = null;
+ private List<Color> arrowOutlineColors = null;
private List<Image> arrowImages = null;
private int titleAlign = TEXT_ALIGN_LEFT;
private Font font;
-
+ private Point fontPoint;
+
public DACustomCombo(Composite parent, int style) {
super(parent, style);
combo = this;
addListener(SWT.MouseUp, comboMouseListener);
}
+ public Point getFontPoint() {
+ return fontPoint;
+ }
+
+ public void setFontPoint(Point fontPoint) {
+ this.fontPoint = fontPoint;
+ }
+
public String getText() {
if (selection < 0) {
return text;
return max;
}
+ public int getArrowButtonHeight() {
+ return arrowButtonHeight;
+ }
+
+ public void setArrowButtonHeight(int arrowButtonHeight) {
+ this.arrowButtonHeight = arrowButtonHeight;
+ }
+
public int getItemHeight() {
return itemHeight;
}
if (buttonUp == null) {
upArrowButton.setText(Messages.DACustomCombo_1);
} else {
- upArrowButton.setButtonImage(buttonUp);
+ upArrowButton.setButtonImages(buttonUp,
+ buttonUp, buttonUp, buttonUp);
}
FormData data = new FormData();
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
- data.height = height;
+ data.height = arrowButtonHeight;
upArrowButton.setLayoutData(data);
upArrowButton.addListener(SWT.MouseExit, upButtonMouseListener);
upArrowButton.addListener(SWT.MouseEnter, upButtonMouseListener);
upArrowButton.addListener(SWT.MouseUp, upButtonMouseListener);
upArrowButton.addListener(SWT.FocusIn, upButtonMouseListener);
upArrowButton.addListener(SWT.FocusOut, upButtonMouseListener);
- shellHeight += height;
+ shellHeight += arrowButtonHeight;
if (tmpItemIndex > 0) {
upArrowButton.setButtonEnabled(true);
} else {
if (null == buttonDown) {
downArrowButton.setText(Messages.DACustomCombo_2);
} else {
- downArrowButton.setButtonImage(buttonDown);
+ downArrowButton.setButtonImages(buttonDown,
+ buttonDown, buttonDown, buttonDown);
}
data = new FormData();
data.top = new FormAttachment(popup, 0);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
- data.height = height;
+ data.height = arrowButtonHeight;
downArrowButton.setLayoutData(data);
downArrowButton.addListener(SWT.MouseExit, downButtonMouseListener);
downArrowButton
downArrowButton.addListener(SWT.MouseUp, downButtonMouseListener);
downArrowButton.addListener(SWT.FocusIn, downButtonMouseListener);
downArrowButton.addListener(SWT.FocusOut, downButtonMouseListener);
- shellHeight += height;
+ shellHeight += arrowButtonHeight;
if (tmpItemIndex + MAX_SIZE < size - 1) {
downArrowButton.setButtonEnabled(true);
} else {
this.enabled = enabled;
if (enabled) {
changeComboState(STATE_NORMAL);
- if (isImageCombo()) {
- setBackgroundImage(images.get(STATE_NORMAL));
- }
+ setBackgroundImageAndColor(STATE_NORMAL);
} else {
changeComboState(STATE_DISABLE);
- if (isImageCombo()) {
- setBackgroundImage(images.get(STATE_DISABLE));
- }
+ setBackgroundImageAndColor(STATE_DISABLE);
Display.getDefault().syncExec(new Runnable() {
@Override
}
}
+ private void setBackgroundImageAndColor(int state) {
+ if (drawType == TYPE_IMAGE) {
+ setBackgroundImage(images.get(state));
+ } else if (drawType == TYPE_COLOR) {
+ setBackground(colors.get(state));
+ } else if (drawType == TYPE_GRADATION) {
+ int index = state * 2;
+ setForeground(colors.get(index));
+ setBackground(colors.get(index + 1));
+ } else {
+ DA_LOG.debug("DACustomCombo drawType : " + state);
+ }
+ }
+
private PaintListener comboPaintListener = new PaintListener() {
@Override
- public void paintControl(PaintEvent e) {
- if (!isImageCombo()) {
- comboRenderer.draw(e.gc, combo, text, titleAlign, font, state);
- } else {
+ public void paintControl(PaintEvent e) {
+ if (drawType == TYPE_IMAGE) {
comboRenderer.drawImage(e.gc, combo, images.get(state), text,
- titleAlign, font, state);
- }
+ titleAlign, font, state);
+ } else if (drawType == TYPE_COLOR || drawType == TYPE_GRADATION) {
+ comboRenderer.draw(e.gc, combo, drawType, colors,
+ outlineColors, comboImagePoint, comboImages,
+ text, titleAlign, font, fontPoint, state);
+ } else {
+ DA_LOG.debug("DACustomCombo drawType : " + state);
+ }
}
};
}
return DAWidgetConstants.EMPTY_STRING;
}
-
+
+ private List<Color> getColors() {
+ if (null == colors) {
+ colors = new ArrayList<Color>();
+ }
+ return colors;
+ }
+
+ public void setComboColors(Color normal, Color push, Color hover, Color disable) {
+ List<Color> comboColors = getColors();
+ comboColors.add(normal);
+ comboColors.add(hover);
+ comboColors.add(push);
+ comboColors.add(disable);
+ drawType = TYPE_COLOR;
+ }
+
+ public void setComboGradation(Color normalStart, Color normalEnd,
+ Color pushStart, Color pushEnd, Color hoverStart, Color hoverEnd,
+ Color disableStart, Color disableEnd) {
+ List<Color> comboColors = getColors();
+ comboColors.add(normalStart);
+ comboColors.add(normalEnd);
+ comboColors.add(hoverStart);
+ comboColors.add(hoverEnd);
+ comboColors.add(pushStart);
+ comboColors.add(pushEnd);
+ comboColors.add(disableStart);
+ comboColors.add(disableEnd);
+ drawType = TYPE_GRADATION;
+ }
+
public void setImages(Image normal, Image hover, Image push, Image disable) {
if (null == normal || null == hover || null == push || null == disable) {
+ DA_LOG.debug("DACustomCombo setImages parameter is null");
return;
}
List<Image> imgs = getImages();
imgs.add(hover);
imgs.add(push);
imgs.add(disable);
- setImageCombo(true);
+ drawType = TYPE_IMAGE;
}
private List<Image> getImages() {
return images;
}
- private void setImageCombo(boolean b) {
- this.imgCombo = b;
+ private List<Color> getOutlineColors() {
+ if (null == outlineColors) {
+ outlineColors = new ArrayList<Color>();
+ }
+ return outlineColors;
}
-
- public boolean isImageCombo() {
- return imgCombo;
+
+ public void setOutlineColors(Color normal, Color push, Color hover,
+ Color disable) {
+ List<Color> comboOutlineColors = getOutlineColors();
+ comboOutlineColors.add(normal);
+ comboOutlineColors.add(hover);
+ comboOutlineColors.add(push);
+ comboOutlineColors.add(disable);
+ }
+
+ private List<Image> getComboImages() {
+ if (null == comboImages) {
+ comboImages = new ArrayList<Image>();
+ }
+ return comboImages;
}
+ public void setComboImages(Image normal, Image push, Image hover, Image disable) {
+ List<Image> imgs = getComboImages();
+ imgs.add(normal);
+ imgs.add(hover);
+ imgs.add(push);
+ imgs.add(disable);
+ }
+
+ public Point getComboImagePoint() {
+ return comboImagePoint;
+ }
+
+ public void setComboImagePoint(Point comboImagePoint) {
+ this.comboImagePoint = comboImagePoint;
+ }
+
private Listener upButtonMouseListener = new Listener() {
@Override
Color disable) {
arrowColors = new ArrayList<Color>();
arrowColors.add(normal);
- arrowColors.add(push);
arrowColors.add(hover);
+ arrowColors.add(push);
arrowColors.add(disable);
}
arrowColors = new ArrayList<Color>();
arrowColors.add(normalStart);
arrowColors.add(normalEnd);
- arrowColors.add(pushStart);
- arrowColors.add(pushEnd);
arrowColors.add(hoverStart);
arrowColors.add(hoverEnd);
+ arrowColors.add(pushStart);
+ arrowColors.add(pushEnd);
arrowColors.add(disableStart);
arrowColors.add(disableEnd);
}
+ private List<Color> getArrowOutlineColors() {
+ if (null == arrowOutlineColors) {
+ arrowOutlineColors = new ArrayList<Color>();
+ }
+ return arrowOutlineColors;
+ }
+
+ public void setArrowOutlineColors(Color normal, Color push, Color hover,
+ Color disable) {
+ List<Color> comboArrowOutlineColors = getArrowOutlineColors();
+ comboArrowOutlineColors.add(normal);
+ comboArrowOutlineColors.add(hover);
+ comboArrowOutlineColors.add(push);
+ comboArrowOutlineColors.add(disable);
+ }
+
private DACustomButton makeButton() {
DACustomButton button = null;
if (arrowImages != null) {
+ // image
button = new DACustomButton(childShell,
arrowImages.get(STATE_NORMAL), arrowImages.get(STATE_PUSH),
arrowImages.get(STATE_HOVER),
arrowColors.get(STATE_DISABLE * 2),
arrowColors.get(STATE_DISABLE * 2 + 1));
} else {
+ // color
button = new DACustomButton(childShell, SWT.NONE);
button.setColors(arrowColors.get(STATE_NORMAL),
arrowColors.get(STATE_PUSH),
arrowColors.get(STATE_HOVER),
arrowColors.get(STATE_DISABLE));
}
+
+ if (arrowOutlineColors != null) {
+ button.setOutlineColors(arrowOutlineColors.get(STATE_NORMAL),
+ arrowOutlineColors.get(STATE_PUSH),
+ arrowOutlineColors.get(STATE_HOVER),
+ arrowOutlineColors.get(STATE_DISABLE));
+ }
} else {
button = new DACustomButton(childShell, SWT.NONE);
}
package org.tizen.dynamicanalyzer.widgets.combo;
+import java.util.List;
+
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
}
@Override
- public void drawPattern(GC gc, Canvas canvas, Image patternImage,
- String text, int state) {
+ public void drawImage(GC gc, Canvas canvas, Image image, String text,
+ int textAlign, Font font, int state) {
+
}
@Override
- public void drawImage(GC gc, Canvas canvas, Image image, String text,
- int textAlign, Font font, int state) {
+ public void draw(GC gc, Canvas canvas, int drawType, List<Color> colors,
+ List<Color> outlineColors, Point comboImagePoint,
+ List<Image> comboImages, String text, int textAlign, Font font,
+ Point fontPoint, int state) {
}
@Override
public void drawPattern(GC gc, Canvas canvas, Image patternImage,
int state, List<Rectangle> rects, int selection, List<String> items) {
- // TODO Auto-generated method stub
}
@Override
public void drawImage(GC gc, Canvas canvas, Image image, int state,
List<Rectangle> rects, int selection, List<String> items) {
- // TODO Auto-generated method stub
}
package org.tizen.dynamicanalyzer.widgets.combo;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Canvas;
public abstract class DACustomComboRenderer {
public abstract void draw(GC gc, Canvas canvas, String text, int textAlign,
Font font, int state);
- public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage,
- String text, int state);
-
public abstract void drawImage(GC gc, Canvas canvas, Image image,
String text, int textAlign, Font font, int state);
+
+ public abstract void draw(GC gc, Canvas canvas, int drawType, List<Color> colors,
+ List<Color> outlineColors, Point comboImagePoint, List<Image> comboImages,
+ String text, int textAlign, Font font, Point fontPoint, int state);
}
"checkbox_disabled_font_color", new RGB(135, 135, 135)); //$NON-NLS-1$\r
\r
/*** stop progress dialog ***/\r
- public static final Color STOP_PROGRESS_LINE1_COLOR = getColor("stop_progress_line1_color", new RGB(2, 171, 208)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_LINE2_COLOR = getColor("stop_progress_line2_color", new RGB(86, 86, 86)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_BACKGROUND_COLOR = getColor("stop_progress_background_color", new RGB(230, 230, 230)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_LINE1_COLOR = getColor("stop_progress_line1_color", new RGB(45, 180, 200)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_LINE2_COLOR = getColor("stop_progress_line2_color", new RGB(0, 0, 0)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_BACKGROUND_COLOR = getColor("stop_progress_background_color", new RGB(232, 234, 235)); //$NON-NLS-1$\r
public static final Color STOP_PROGRESS_INFO_FONT_COLOR = getColor("stop_progress_info_font_color", new RGB(70, 70, 70)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_BAR_START_COLOR = getColor("stop_progress_bar_start_color", new RGB(0, 181, 222)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_BAR_END_COLOR = getColor("stop_progress_bar_end_color", new RGB(4, 108, 143)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_BAR_START_COLOR = getColor("stop_progress_bar_start_color", new RGB(45, 180, 222)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_BAR_END_COLOR = getColor("stop_progress_bar_end_color", new RGB(19, 161, 183)); //$NON-NLS-1$\r
public static final Color STOP_PROGRESS_BAR_BG_START_COLOR = getColor("stop_progress_bar_bg_start_color", new RGB(204, 204, 204)); //$NON-NLS-1$\r
public static final Color STOP_PROGRESS_BAR_BG_END_COLOR = getColor("stop_progress_bar_bg_end_color", new RGB(212, 212, 212)); //$NON-NLS-1$\r
- public static final Color STOP_PROGRESS_BAR_OUTLINE_COLOR = getColor("stop_progress_bar_outline_color", new RGB(150, 150, 150)); //$NON-NLS-1$\r
+ public static final Color STOP_PROGRESS_BAR_OUTLINE_COLOR = getColor("stop_progress_bar_outline_color", new RGB(95, 95, 95)); //$NON-NLS-1$\r
\r
\r
\r
public static Color POPUP_MENU_TEXT_DISABLED = getColor("popup_menu_text_disabled", new RGB(189, 189, 189)); //$NON-NLS-1$\r
\r
public static Color POPUP_MENU_ITEM_NORMAL = getColor("popup_menu_item_normal", new RGB(230, 230, 230)); //$NON-NLS-1$);\r
- public static Color POPUP_MENU_ITEM_SELECTED = getColor("popup_menu_item_selected", new RGB(50, 185, 231)); //$NON-NLS-1$\r
+ public static Color POPUP_MENU_ITEM_SELECTED = getColor("popup_menu_item_selected", new RGB(45, 180, 200)); //$NON-NLS-1$\r
\r
public static Color POPUP_MENU_SEPARATOR1 = getColor("popup_menu_separator1", new RGB(189, 189, 189)); //$NON-NLS-1$\r
public static Color POPUP_MENU_SEPARATOR2 = getColor("popup_menu_separator2", new RGB(255, 255, 255)); //$NON-NLS-1$\r
public static final Font TEST_TEXT = getFont(\r
"about_text", resizeSystemFont(28));//$NON-NLS-1$\r
\r
+ public static final Font LICENSE_TEXT = getFont(\r
+ "license_text", resizeSystemFont(8));//$NON-NLS-1$\r
+ \r
/** detail info font **/\r
public static final Font DETAIL_INFO_FONT = getFont(\r
"detail_info_font", resizeSystemFont(9));//$NON-NLS-1$\r
public static final Font STOP_PROGRESS_FONT = getFont(\r
"stop_progress_font", resizeSystemFont(8));//$NON-NLS-1$\r
public static final Font PROGRESS_FONT = getFont(\r
- "progress_font", resizeSystemFont(9));//$NON-NLS-1$\r
+ "progress_font", resizeSystemFont(8));//$NON-NLS-1$\r
\r
public static final Font CONTEXT_MENU_ITEM_FONT = getFont(\r
"context_menu_item_font", resizeSystemFont(9));//$NON-NLS-1$\r
/*** tree fold ***/
public static final Image TREE_FOLD = getPngImage("tree_fold"); //$NON-NLS-1$
public static final Image TREE_OPEN = getPngImage("tree_open"); //$NON-NLS-1$
+
+ /*** context child arrow ***/
+ public static final Image CONTEXT_OPEN = getPngImage("context_menu_child_arrow"); //$NON-NLS-1$
// check box
public static final Image CHECKBOX_SELECTED = getPngImage("checkbox_selected"); //$NON-NLS-1$
@Override
public void mouseDown(MouseEvent event) {
- // TODO Auto-generated method stub
switch (event.button) {
case MOUSE_LEFT: {
closeParent();
newItem.setButtonEnabled(false);
}
} else {
- newItem.setButtonImage(ImageResources.TREE_FOLD);
+ newItem.setButtonImages(ImageResources.CONTEXT_OPEN,
+ ImageResources.CONTEXT_OPEN,
+ ImageResources.CONTEXT_OPEN,
+ ImageResources.CONTEXT_OPEN);
newItem.addListener(SWT.MouseHover, mouseListener);
}
Image icon = child.getIcon();
}
shell.layout();
int popupWidth = itemWidth + DAPopupMenuItemButtonRenderer.MARGIN * 2
+ + DAPopupMenuItemButtonRenderer.ICON_MARGIN
+ DAPopupMenuItemButtonRenderer.TEXT_MARGIN
+ DAPopupMenuItemButtonRenderer.DEFAULT_ICON_SIZE * 2;
int popupHeight = itemHeight + DAPopupMenuItemButtonRenderer.MARGIN * 2;
@Override
public void paintControl(PaintEvent e) {
- // TODO Auto-generated method stub
e.gc.setForeground(ColorResources.POPUP_MENU_OUTLINE_STORKE1);
e.gc.drawRectangle(0, 0, e.width - 1, e.height - 1);
e.gc.setForeground(ColorResources.POPUP_MENU_OUTLINE_STORKE2);
* Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
protected static final int DEFAULT_ITEM_HEIGHT = 24;
protected static final int DEFAULT_ICON_SIZE = 16;
protected static final int DEFAULT_FONT_SIZE = 9;
+ protected static final int ICON_MARGIN = 3;
@Override
public void draw(GC gc, Canvas canvas, int state,
Rectangle rect = canvas.getClientArea();
drawButton(gc, rect, state, attr);
drawIcon(gc, rect, state, attr);
- drawButtonImage(gc, rect, attr);
+ drawButtonImage(gc, rect, attr, state);
}
protected void drawButton(GC gc, Rectangle rect, int state,
Font font = null;
Point p = null;
- Rectangle textRect = new Rectangle(rect.x + DEFAULT_ICON_SIZE, rect.y,
+ Rectangle textRect = new Rectangle(rect.x + ICON_MARGIN + DEFAULT_ICON_SIZE, rect.y,
rect.width, rect.height);
if (null != (text = attr.getText())) {
}
protected void drawButtonImage(GC gc, Rectangle rect,
- DACustomButtonAttribute attr) {
- if (attr != null && attr.getButtonImage() != null) {
- Image img = attr.getButtonImage();
+ DACustomButtonAttribute attr, int state) {
+ Image img = attr.getButtonImage(state);
+ if (attr != null && img != null) {
gc.drawImage(img, rect.width - img.getBounds().width - MARGIN,
rect.height / 2 - img.getBounds().height / 2);
}
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* jooyoul lee<jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
if (opened) {
return false;
}
- shell.setSize(446, 254);
+ shell.setSize(436, 254);
shell.setLayout(new FormLayout());
shell.setText(AnalyzerLabels.ABOUT_TITLE);
shell.addDisposeListener(new DisposeListener() {
compData.top = new FormAttachment(base, 0);
compData.left = new FormAttachment(0, 0);
compData.right = new FormAttachment(100, 0);
- compData.bottom = new FormAttachment(100, 0);
+ compData.height = 51;
buttonComp.setLayoutData(compData);
okButton = new DAButton(buttonComp, SWT.NONE);
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
* yeongtaik byeon <yeongtaik.byeon@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
public int open() {
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
- shell.setSize(608, 476 + 22);
+ shell.setSize(608, 438 + 22);
FormLayout shellLayout = new FormLayout();
shell.setLayout(shellLayout);
shell.setText(AnalyzerLabels.LICENSE);
Text contents = new Text(base, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
contents.setForeground(ColorResources.DEFAULT_FONT_COLOR);
contents.setBackground(ColorResources.DIALOG_BG_UPPER);
- contents.setFont(FontResources.getDADefaultFont());
+ contents.setFont(FontResources.LICENSE_TEXT);
contents.setText(getLicenseString());
layoutData = new FormData();
layoutData.left = new FormAttachment(0, 18);
layoutData.right = new FormAttachment(100, -18);
layoutData.top = new FormAttachment(icon, 18);
- layoutData.height = 327;
+ layoutData.height = 287;
contents.setLayoutData(layoutData);
Composite buttonComp = new Composite(base, SWT.NONE);
compData.top = new FormAttachment(contents, 0);
compData.left = new FormAttachment(0, 0);
compData.right = new FormAttachment(100, 0);
- compData.bottom = new FormAttachment(100, 0);
+ compData.height = 51;
buttonComp.setLayoutData(compData);
okButton = new DAButton(buttonComp, SWT.NONE);
okButton.setFont(FontResources.DIALOG_BUTTON_FONT);
FormData okData = new FormData();
- okData.top = new FormAttachment(0, 8);
+ okData.top = new FormAttachment(0, 9);
okData.right = new FormAttachment(100, -9);
okData.width = DesignConstants.DA_BUTTON_WIDTH;
okData.height = DesignConstants.DA_BUTTON_HEIGHT;
gc.setFont(FontResources.DROPDOWN);
gc.drawString(items.get(i), 5, 6 + i * r.height, true);
+
Rectangle rect = canvas.getClientArea();
gc.setForeground(ColorResources.DEVICE_APPLICATION_POPUP_OUTER_1);
- gc.drawRectangle(rect);
+ gc.drawLine(rect.x, rect.y, rect.x, rect.height);
+ gc.drawLine(rect.width - 1, rect.y, rect.width - 1, rect.height);
gc.setForeground(ColorResources.DEVICE_APPLICATION_POPUP_OUTER_2);
- gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 2,
+ gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 3,
rect.height - 2);
}
}
package org.tizen.dynamicanalyzer.ui.widgets;
+import java.util.List;
+
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboRenderer;
}
@Override
- public void drawPattern(GC gc, Canvas canvas, Image patternImage,
- String text, int state) {
-
- }
-
- @Override
public void drawImage(GC gc, Canvas canvas, Image image, String text,
int textAlign, Font font, int state) {
Rectangle rect = canvas.getClientArea();
}
}
+ @Override
+ public void draw(GC gc, Canvas canvas, int drawType, List<Color> colors,
+ List<Color> outlineColors, Point comboImagePoint,
+ List<Image> comboImages, String text, int textAlign, Font font,
+ Point fontPoint, int state) {
+ Rectangle rect = canvas.getClientArea();
+ if (drawType == DACustomCombo.TYPE_COLOR) {
+ gc.setBackground(colors.get(state));
+ gc.fillRectangle(rect);
+ } else if (drawType == DACustomCombo.TYPE_GRADATION) {
+ int index = state * 2;
+ gc.setForeground(colors.get(index));
+ gc.setBackground(colors.get(index + 1));
+ gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, true);
+ }
+
+ // text and font(size, style)
+ if (null == text) {
+ text = CommonConstants.EMPTY;
+ }
+ if (null == font) {
+ gc.setFont(FontResources.COMBO);
+ } else {
+ gc.setFont(font);
+ }
+
+ // font color
+ if (state == DACustomButton.STATE_DISABLE) {
+ gc.setForeground(ColorResources.DEVICE_APPLICATION_DISABLE);
+ } else {
+ gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE);
+ }
+
+ // text position
+ if (fontPoint == null) {
+ Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
+ int textX = 0;
+ if (textAlign == DACustomCombo.TEXT_ALIGN_LEFT) {
+ textX = 5;
+ } else if (textAlign == DACustomCombo.TEXT_ALIGN_RIGHT) {
+ textX = rect.width - p.x;
+ } else { // DACustomCombo.TEXT_ALIGN_CENTER
+ textX = (rect.width / 2) - (p.x / 2);
+ }
+ gc.drawString(text, textX, (rect.height - p.y) / 2, true);
+ } else {
+ gc.drawString(text, fontPoint.x, fontPoint.y, true);
+ }
+
+ // stroke
+ Color c = gc.getForeground();
+ Rectangle r = new Rectangle(rect.x, rect.y, rect.width - 1, rect.height - 1);
+ if (null != outlineColors.get(state)) {
+ gc.setForeground(outlineColors.get(state));
+ } else {
+ gc.setForeground(c);
+ return;
+ }
+ gc.drawRectangle(r);
+ gc.setForeground(c);
+
+ // draw button image
+ drawComboImage(gc, rect, state, comboImagePoint, comboImages);
+
+ }
+
+ protected void drawComboImage(GC gc, Rectangle rect,
+ int state, Point comboImagePoint, List<Image> comboImages) {
+ Image img = comboImages.get(state);
+ Rectangle imgRect = null;
+
+ if (null != img) {
+ imgRect = img.getBounds();
+ int x = 0, y = 0;
+ if (null == comboImagePoint) {
+ int width = rect.width - imgRect.width;
+ int height = rect.height - imgRect.height;
+ if (width > 0) {
+ x = width / 2;
+ }
+
+ if (height > 0) {
+ y = height / 2;
+ }
+ } else {
+ x = comboImagePoint.x;
+ y = comboImagePoint.y;
+ }
+ gc.drawImage(img, x, y);
+ }
+
+ }
+
}