From 0e20fb4676381f69a8bbad79dc4aa003ea0e38b6 Mon Sep 17 00:00:00 2001 From: heeyoung Date: Thu, 29 May 2014 10:54:19 +0900 Subject: [PATCH] dialog, widget : apply new design dialog - progress / about / license widget - button / toggleButton / context menu / combo Change-Id: Iea3d9b507c5604a91e7f032d1808a810b1ed5ae6 Signed-off-by: heeyoung --- .../dynamicanalyzer/resources/ColorResources.java | 2 +- .../dynamicanalyzer/resources/FontResources.java | 5 + .../dynamicanalyzer/resources/ImageResources.java | 3 + .../tizen/dynamicanalyzer/theme/DAThemeWhite.java | 26 +-- .../widgets/da/view/TabButtonRenderer.java | 8 +- .../theme/white/context_menu_child_arrow.png | Bin 0 -> 2866 bytes .../Images/context_menu_child_arrow.png | Bin 0 -> 2866 bytes .../widgets/button/DACustomButton.java | 34 +++- .../widgets/button/DACustomButtonAttribute.java | 27 ++- .../widgets/button/DACustomButtonRenderer.java | 36 ++-- .../button/toggle/DACustomToggleButton.java | 21 ++- .../toggle/DACustomToggleButtonRenderer.java | 44 +++++ .../widgets/combo/DACustomCombo.java | 193 +++++++++++++++++---- .../combo/DACustomComboDefaultRenderer.java | 14 +- .../combo/DACustomComboPopupDefaultRenderer.java | 2 - .../widgets/combo/DACustomComboRenderer.java | 11 +- .../widgets/helper/ColorResources.java | 14 +- .../widgets/helper/FontResources.java | 5 +- .../widgets/helper/ImageResources.java | 3 + .../widgets/popupMenu/DAPopupMenu.java | 8 +- .../popupMenu/DAPopupMenuItemButtonRenderer.java | 12 +- .../dynamicanalyzer/ui/toolbar/AboutDialog.java | 5 +- .../dynamicanalyzer/ui/toolbar/LicenseDialog.java | 11 +- .../ui/widgets/TitleComboPopupRenderer.java | 6 +- .../ui/widgets/TitleComboRenderer.java | 103 ++++++++++- 25 files changed, 481 insertions(+), 112 deletions(-) create mode 100644 org.tizen.dynamicanalyzer.appearance/theme/white/context_menu_child_arrow.png create mode 100644 org.tizen.dynamicanalyzer.widgets/Images/context_menu_child_arrow.png diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java index 01d5465..da4cefd 100755 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java @@ -93,7 +93,7 @@ public class ColorResources { /** device and application combo specific colors start **/ public static Color DEVICE_APPLICATION_ENABLE = getColor("device_application_enable_font"); //$NON-NLS-1$ - public static Color DEVICE_APPLICATION_DISABLE = getColor("device_application_disable"); //$NON-NLS-1$ + public static Color DEVICE_APPLICATION_DISABLE = getColor("device_application_disable_font"); //$NON-NLS-1$ public static Color DEVICE_APPLICATION_POPUP_OUTER_1 = getColor("device_application_popup_outer_1"); //$NON-NLS-1$ public static Color DEVICE_APPLICATION_POPUP_OUTER_2 = getColor("device_application_popup_outer_2"); //$NON-NLS-1$ public static Color DEVICE_APPLICATION_DROPDOWN_TEXT = getColor("device_application_enable_font"); //$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/FontResources.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/FontResources.java index fd21425..0282b2b 100644 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/FontResources.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/FontResources.java @@ -112,6 +112,11 @@ public class FontResources { // * About Dlg. public static final Font ABOUT_TEXT = getFont( "about_text", resizeDefaultFont(9, 2));//$NON-NLS-1$ + + // * License Dlg. + public static final Font LICENSE_TEXT = getFont( + "license_text", resizeDefaultFont(8, 3));//$NON-NLS-1$ + // mac 11 public static final Font DIALOG_BUTTON_FONT = getFont( "dialog_button_font", resizeDefaultFont(9, 2));//$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ImageResources.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ImageResources.java index f55b9b1..f4129f5 100644 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ImageResources.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ImageResources.java @@ -322,6 +322,9 @@ public class ImageResources { public static final Image TREE_FOLD = getPngImage("tree_fold"); //$NON-NLS-1$ public static final Image NO_IMAGE = getPngImage("empty_snapshot"); //$NON-NLS-1$ public static final Image NO_IMAGE_SMALL = getPngImage("empty_snapshot_small"); //$NON-NLS-1$ + + /*** context child arrow ***/ + public static final Image CONTEXT_OPEN = getPngImage("context_menu_child_arrow"); //$NON-NLS-1$ /* score */ public static final Image SCORE_0 = getPngImage("score_0"); //$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java index db46618..90ed29e 100644 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java @@ -70,7 +70,7 @@ public class DAThemeWhite extends DATheme { // 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)); @@ -97,17 +97,15 @@ public class DAThemeWhite extends DATheme { /** 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 ***/ @@ -121,7 +119,13 @@ public class DAThemeWhite extends DATheme { 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)); diff --git a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/view/TabButtonRenderer.java b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/view/TabButtonRenderer.java index a351eab..5d30071 100644 --- a/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/view/TabButtonRenderer.java +++ b/org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/view/TabButtonRenderer.java @@ -81,7 +81,7 @@ public class TabButtonRenderer implements IDACustomButtonRenderer { } 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(); @@ -98,9 +98,9 @@ public class TabButtonRenderer implements IDACustomButtonRenderer { } 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; diff --git a/org.tizen.dynamicanalyzer.appearance/theme/white/context_menu_child_arrow.png b/org.tizen.dynamicanalyzer.appearance/theme/white/context_menu_child_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..ebb09d499aa00f54ef1ff75b23d5c68c8e3d1bbd GIT binary patch literal 2866 zcmV-23(fS2P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q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Images/context_menu_child_arrow.png b/org.tizen.dynamicanalyzer.widgets/Images/context_menu_child_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..ebb09d499aa00f54ef1ff75b23d5c68c8e3d1bbd GIT binary patch literal 2866 zcmV-23(fS2P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$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awq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z00018Nkl7s z4Iw5BJQx@lE)8fb?C|#X)+5(|9mp|3ssRKwGcYhPFplO01^@s60RR630PF-1{03Mi QS^xk507*qoM6N<$g6eNgYXATM literal 0 HcmV?d00001 diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButton.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButton.java index 2904e4a..5c5dab9 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButton.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButton.java @@ -4,6 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Heeyoung Hwang * Jooyoul Lee * Juyoung Kim * @@ -282,13 +283,17 @@ public class DACustomButton extends Canvas { * image button means background is image.
* 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.
* this class has default renderer : DACustomButtonRenderer @@ -428,6 +433,25 @@ public class DACustomButton extends Canvas { } /** + * 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 diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButtonAttribute.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButtonAttribute.java index e9fee67..6c88081 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButtonAttribute.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButtonAttribute.java @@ -37,13 +37,14 @@ import org.eclipse.swt.graphics.Image; 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 buttonImages = new ArrayList(); + private Point buttonImagePoint; + private int align = SWT.CENTER; private Image iconImage = null; @@ -55,6 +56,7 @@ public class DACustomButtonAttribute { public DACustomButtonAttribute() { for (int i = 0; i < MAX_SIZE; i++) { + buttonImages.add(null); images.add(null); colors.add(null); fontColors.add(null); @@ -71,14 +73,25 @@ public class DACustomButtonAttribute { 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; } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButtonRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButtonRenderer.java index 4274d65..025b4cc 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButtonRenderer.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/DACustomButtonRenderer.java @@ -4,6 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Heeyoung Hwang * Jooyoul Lee * Juyoung Kim * @@ -50,7 +51,7 @@ public class DACustomButtonRenderer implements IDACustomButtonRenderer { || attr.getDrawType() == DACustomButton.TYPE_GRADATION) { drawButton(gc, rect, state, attr); } - drawButtonImage(gc, rect, attr); + drawButtonImage(gc, rect, attr, state); drawIcon(gc, rect, attr); } @@ -97,9 +98,9 @@ public class DACustomButtonRenderer implements IDACustomButtonRenderer { } 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)); @@ -120,20 +121,29 @@ public class DACustomButtonRenderer implements IDACustomButtonRenderer { } 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); } } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButton.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButton.java index 658fb5e..3be9a69 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButton.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButton.java @@ -4,6 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Heeyoung Hwang * Jooyoul Lee * Juyoung Kim * @@ -122,7 +123,7 @@ public class DACustomToggleButton extends DACustomButton { Color normalEnd, Color pushStart, Color pushEnd, Color hoverStart, Color hoverEnd, Color disableStart, Color disableEnd, Color toggleStart, Color toggleEnd, Color toggleHoverStart, - Color toggleHoverEnd) { + Color toggleHoverEnd, Color togglePushStart, Color togglePushEnd) { this(parent, SWT.NONE); attr.setColor(0, normalStart); attr.setColor(1, normalEnd); @@ -136,8 +137,26 @@ public class DACustomToggleButton extends DACustomButton { attr.setColor(9, toggleEnd); attr.setColor(10, toggleHoverStart); attr.setColor(11, toggleHoverEnd); + attr.setColor(12, togglePushStart); + attr.setColor(13, togglePushEnd); attr.setDrawType(TYPE_GRADATION); } + + public void setOutlineColors(Color normal, Color push, Color hover, + Color disable, Color toggle, Color toggleHover, Color togglePush) { + setOutlineColors(normal, togglePush, toggleHover, disable); + attr.setOutlineColor(STATE_TOGGLE, toggle); + attr.setOutlineColor(STATE_TOGGLE_HOVER, toggleHover); + attr.setOutlineColor(STATE_TOGGLE_PUSH, togglePush); + } + + public void setOutlineInColors(Color normal, Color push, Color hover, + Color disable, Color toggle, Color toggleHover, Color togglePush) { + setOutlineInColors(normal, togglePush, toggleHover, disable); + attr.setOutlineInColor(STATE_TOGGLE, toggle); + attr.setOutlineInColor(STATE_TOGGLE_HOVER, toggleHover); + attr.setOutlineInColor(STATE_TOGGLE_PUSH, togglePush); + } protected void addToggleListeners() { if (null != toggleButtonMouseListener) { diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButtonRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButtonRenderer.java index a9e0074..13f22ae 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButtonRenderer.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomToggleButtonRenderer.java @@ -4,6 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Heeyoung Hwang * Jooyoul Lee * Juyoung Kim * @@ -28,13 +29,16 @@ package org.tizen.dynamicanalyzer.widgets.button.toggle; 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, @@ -51,7 +55,47 @@ public class DACustomToggleButtonRenderer extends DACustomButtonRenderer { } 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); + } + + } } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomCombo.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomCombo.java index 0737653..87d0121 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomCombo.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomCombo.java @@ -4,6 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Heeyoung Hwang * Jooyoul Lee * Juyoung Kim * @@ -72,6 +73,10 @@ public class DACustomCombo extends Canvas { 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; @@ -87,6 +92,13 @@ public class DACustomCombo extends Canvas { private List items; private List rects = null; + private int arrowButtonHeight = 15; + private Point comboImagePoint; + private List comboImages = null; + private List colors = null; + private List outlineColors = null; + private int drawType = DACustomCombo.TYPE_COLOR; // color, gradation, image + private List images = null; private Image buttonUp = null; private Image buttonDown = null; @@ -95,17 +107,18 @@ public class DACustomCombo extends Canvas { 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 arrowColors = null; + private List arrowOutlineColors = null; private List 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; @@ -126,6 +139,14 @@ public class DACustomCombo extends Canvas { 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; @@ -250,6 +271,14 @@ public class DACustomCombo extends Canvas { return max; } + public int getArrowButtonHeight() { + return arrowButtonHeight; + } + + public void setArrowButtonHeight(int arrowButtonHeight) { + this.arrowButtonHeight = arrowButtonHeight; + } + public int getItemHeight() { return itemHeight; } @@ -314,20 +343,21 @@ public class DACustomCombo extends Canvas { 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 { @@ -345,13 +375,14 @@ public class DACustomCombo extends Canvas { 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 @@ -359,7 +390,7 @@ public class DACustomCombo extends Canvas { 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 { @@ -532,14 +563,10 @@ public class DACustomCombo extends Canvas { 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 @@ -553,16 +580,34 @@ public class DACustomCombo extends Canvas { } } + 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); + } } }; @@ -596,9 +641,41 @@ public class DACustomCombo extends Canvas { } return DAWidgetConstants.EMPTY_STRING; } - + + private List getColors() { + if (null == colors) { + colors = new ArrayList(); + } + return colors; + } + + public void setComboColors(Color normal, Color push, Color hover, Color disable) { + List 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 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 imgs = getImages(); @@ -607,7 +684,7 @@ public class DACustomCombo extends Canvas { imgs.add(hover); imgs.add(push); imgs.add(disable); - setImageCombo(true); + drawType = TYPE_IMAGE; } private List getImages() { @@ -617,14 +694,45 @@ public class DACustomCombo extends Canvas { return images; } - private void setImageCombo(boolean b) { - this.imgCombo = b; + private List getOutlineColors() { + if (null == outlineColors) { + outlineColors = new ArrayList(); + } + return outlineColors; } - - public boolean isImageCombo() { - return imgCombo; + + public void setOutlineColors(Color normal, Color push, Color hover, + Color disable) { + List comboOutlineColors = getOutlineColors(); + comboOutlineColors.add(normal); + comboOutlineColors.add(hover); + comboOutlineColors.add(push); + comboOutlineColors.add(disable); + } + + private List getComboImages() { + if (null == comboImages) { + comboImages = new ArrayList(); + } + return comboImages; } + public void setComboImages(Image normal, Image push, Image hover, Image disable) { + List 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 @@ -756,8 +864,8 @@ public class DACustomCombo extends Canvas { Color disable) { arrowColors = new ArrayList(); arrowColors.add(normal); - arrowColors.add(push); arrowColors.add(hover); + arrowColors.add(push); arrowColors.add(disable); } @@ -776,17 +884,34 @@ public class DACustomCombo extends Canvas { arrowColors = new ArrayList(); 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 getArrowOutlineColors() { + if (null == arrowOutlineColors) { + arrowOutlineColors = new ArrayList(); + } + return arrowOutlineColors; + } + + public void setArrowOutlineColors(Color normal, Color push, Color hover, + Color disable) { + List 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), @@ -804,12 +929,20 @@ public class DACustomCombo extends Canvas { 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); } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboDefaultRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboDefaultRenderer.java index d777255..54f2f3e 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboDefaultRenderer.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboDefaultRenderer.java @@ -26,7 +26,10 @@ 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; @@ -71,13 +74,16 @@ public class DACustomComboDefaultRenderer extends DACustomComboRenderer { } @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 colors, + List outlineColors, Point comboImagePoint, + List comboImages, String text, int textAlign, Font font, + Point fontPoint, int state) { } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboPopupDefaultRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboPopupDefaultRenderer.java index 1bb42a2..a22e616 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboPopupDefaultRenderer.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboPopupDefaultRenderer.java @@ -62,14 +62,12 @@ public class DACustomComboPopupDefaultRenderer extends DACustomComboPopupRendere @Override public void drawPattern(GC gc, Canvas canvas, Image patternImage, int state, List rects, int selection, List items) { - // TODO Auto-generated method stub } @Override public void drawImage(GC gc, Canvas canvas, Image image, int state, List rects, int selection, List items) { - // TODO Auto-generated method stub } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboRenderer.java index 45f1fbd..6af2964 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboRenderer.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomComboRenderer.java @@ -26,18 +26,23 @@ 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 colors, + List outlineColors, Point comboImagePoint, List comboImages, + String text, int textAlign, Font font, Point fontPoint, int state); } diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java index 1cea4fa..945e26b 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java @@ -174,15 +174,15 @@ public class ColorResources { "checkbox_disabled_font_color", new RGB(135, 135, 135)); //$NON-NLS-1$ /*** stop progress dialog ***/ - public static final Color STOP_PROGRESS_LINE1_COLOR = getColor("stop_progress_line1_color", new RGB(2, 171, 208)); //$NON-NLS-1$ - public static final Color STOP_PROGRESS_LINE2_COLOR = getColor("stop_progress_line2_color", new RGB(86, 86, 86)); //$NON-NLS-1$ - public static final Color STOP_PROGRESS_BACKGROUND_COLOR = getColor("stop_progress_background_color", new RGB(230, 230, 230)); //$NON-NLS-1$ + public static final Color STOP_PROGRESS_LINE1_COLOR = getColor("stop_progress_line1_color", new RGB(45, 180, 200)); //$NON-NLS-1$ + public static final Color STOP_PROGRESS_LINE2_COLOR = getColor("stop_progress_line2_color", new RGB(0, 0, 0)); //$NON-NLS-1$ + public static final Color STOP_PROGRESS_BACKGROUND_COLOR = getColor("stop_progress_background_color", new RGB(232, 234, 235)); //$NON-NLS-1$ public static final Color STOP_PROGRESS_INFO_FONT_COLOR = getColor("stop_progress_info_font_color", new RGB(70, 70, 70)); //$NON-NLS-1$ - public static final Color STOP_PROGRESS_BAR_START_COLOR = getColor("stop_progress_bar_start_color", new RGB(0, 181, 222)); //$NON-NLS-1$ - public static final Color STOP_PROGRESS_BAR_END_COLOR = getColor("stop_progress_bar_end_color", new RGB(4, 108, 143)); //$NON-NLS-1$ + public static final Color STOP_PROGRESS_BAR_START_COLOR = getColor("stop_progress_bar_start_color", new RGB(45, 180, 222)); //$NON-NLS-1$ + public static final Color STOP_PROGRESS_BAR_END_COLOR = getColor("stop_progress_bar_end_color", new RGB(19, 161, 183)); //$NON-NLS-1$ 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$ 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$ - public static final Color STOP_PROGRESS_BAR_OUTLINE_COLOR = getColor("stop_progress_bar_outline_color", new RGB(150, 150, 150)); //$NON-NLS-1$ + public static final Color STOP_PROGRESS_BAR_OUTLINE_COLOR = getColor("stop_progress_bar_outline_color", new RGB(95, 95, 95)); //$NON-NLS-1$ @@ -208,7 +208,7 @@ public class ColorResources { public static Color POPUP_MENU_TEXT_DISABLED = getColor("popup_menu_text_disabled", new RGB(189, 189, 189)); //$NON-NLS-1$ public static Color POPUP_MENU_ITEM_NORMAL = getColor("popup_menu_item_normal", new RGB(230, 230, 230)); //$NON-NLS-1$); - public static Color POPUP_MENU_ITEM_SELECTED = getColor("popup_menu_item_selected", new RGB(50, 185, 231)); //$NON-NLS-1$ + public static Color POPUP_MENU_ITEM_SELECTED = getColor("popup_menu_item_selected", new RGB(45, 180, 200)); //$NON-NLS-1$ public static Color POPUP_MENU_SEPARATOR1 = getColor("popup_menu_separator1", new RGB(189, 189, 189)); //$NON-NLS-1$ public static Color POPUP_MENU_SEPARATOR2 = getColor("popup_menu_separator2", new RGB(255, 255, 255)); //$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/FontResources.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/FontResources.java index 53b27c8..052b361 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/FontResources.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/FontResources.java @@ -75,6 +75,9 @@ public class FontResources { public static final Font TEST_TEXT = getFont( "about_text", resizeSystemFont(28));//$NON-NLS-1$ + public static final Font LICENSE_TEXT = getFont( + "license_text", resizeSystemFont(8));//$NON-NLS-1$ + /** detail info font **/ public static final Font DETAIL_INFO_FONT = getFont( "detail_info_font", resizeSystemFont(9));//$NON-NLS-1$ @@ -142,7 +145,7 @@ public class FontResources { public static final Font STOP_PROGRESS_FONT = getFont( "stop_progress_font", resizeSystemFont(8));//$NON-NLS-1$ public static final Font PROGRESS_FONT = getFont( - "progress_font", resizeSystemFont(9));//$NON-NLS-1$ + "progress_font", resizeSystemFont(8));//$NON-NLS-1$ public static final Font CONTEXT_MENU_ITEM_FONT = getFont( "context_menu_item_font", resizeSystemFont(9));//$NON-NLS-1$ diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ImageResources.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ImageResources.java index 5a12dde..2560f0c 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ImageResources.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ImageResources.java @@ -108,6 +108,9 @@ public class ImageResources { /*** 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$ diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/popupMenu/DAPopupMenu.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/popupMenu/DAPopupMenu.java index b51df96..82911cf 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/popupMenu/DAPopupMenu.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/popupMenu/DAPopupMenu.java @@ -135,7 +135,6 @@ public class DAPopupMenu { @Override public void mouseDown(MouseEvent event) { - // TODO Auto-generated method stub switch (event.button) { case MOUSE_LEFT: { closeParent(); @@ -304,7 +303,10 @@ public class DAPopupMenu { 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(); @@ -325,6 +327,7 @@ public class DAPopupMenu { } 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; @@ -340,7 +343,6 @@ public class DAPopupMenu { @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); diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/popupMenu/DAPopupMenuItemButtonRenderer.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/popupMenu/DAPopupMenuItemButtonRenderer.java index 1cd9634..bd7a374 100644 --- a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/popupMenu/DAPopupMenuItemButtonRenderer.java +++ b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/popupMenu/DAPopupMenuItemButtonRenderer.java @@ -4,6 +4,7 @@ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Heeyoung Hwang * yeongtaik byeon * Juyoung Kim * @@ -46,6 +47,7 @@ public class DAPopupMenuItemButtonRenderer extends DACustomButtonRenderer { 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, @@ -53,7 +55,7 @@ public class DAPopupMenuItemButtonRenderer extends DACustomButtonRenderer { 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, @@ -73,7 +75,7 @@ public class DAPopupMenuItemButtonRenderer extends DACustomButtonRenderer { 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())) { @@ -134,9 +136,9 @@ public class DAPopupMenuItemButtonRenderer extends DACustomButtonRenderer { } 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); } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/AboutDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/AboutDialog.java index dbfee1b..44eb074 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/AboutDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/AboutDialog.java @@ -4,6 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Heeyoung Hwang * jooyoul lee * Juyoung Kim * @@ -103,7 +104,7 @@ public class AboutDialog extends DAMessageBox { 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() { @@ -209,7 +210,7 @@ public class AboutDialog extends DAMessageBox { 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); diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/LicenseDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/LicenseDialog.java index cd208b8..e2cc33f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/LicenseDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/LicenseDialog.java @@ -4,6 +4,7 @@ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: + * Heeyoung Hwang * yeongtaik byeon * Juyoung Kim * @@ -106,7 +107,7 @@ public class LicenseDialog { 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); @@ -138,14 +139,14 @@ public class LicenseDialog { 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); @@ -169,7 +170,7 @@ public class LicenseDialog { 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); @@ -178,7 +179,7 @@ public class LicenseDialog { 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; diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/TitleComboPopupRenderer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/TitleComboPopupRenderer.java index 85fdb98..87ae4af 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/TitleComboPopupRenderer.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/TitleComboPopupRenderer.java @@ -76,11 +76,13 @@ public class TitleComboPopupRenderer extends DACustomComboPopupRenderer { 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); } } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/TitleComboRenderer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/TitleComboRenderer.java index 010eac0..ec857cd 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/TitleComboRenderer.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/TitleComboRenderer.java @@ -26,7 +26,10 @@ 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; @@ -36,6 +39,7 @@ import org.eclipse.swt.widgets.Canvas; 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; @@ -78,12 +82,6 @@ public class TitleComboRenderer extends 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(); @@ -126,4 +124,97 @@ public class TitleComboRenderer extends DACustomComboRenderer { } } + @Override + public void draw(GC gc, Canvas canvas, int drawType, List colors, + List outlineColors, Point comboImagePoint, + List 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 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); + } + + } + } -- 2.7.4