package org.tizen.dynamicanalyzer.widgets.da.base;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.widgets.Composite;
public boolean textTooltip = false;
public String textTooltipMessage = null;
+
+ private Image iconImage = null;
+ private int iconImage_x = 0;
+ private int iconImage_y = 0;
public Listener textMouseListener = new Listener() {
@Override
public DAText(Composite parent, int style) {
text = new Text(parent, style);
-
currentColor = ColorResources.TEXT_NORMAL_COLOR;
-
text.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
Rectangle rect = text.getClientArea();
e.gc.drawRectangle(rect.x, rect.y, rect.width - 1,
rect.height - 1);
+ if(iconImage != null) {
+ // draw a image in text box
+ e.gc.drawImage(iconImage, rect.x+iconImage_x, rect.y+iconImage_y);
+ }
}
});
public void setFont(Font font) {
this.text.setFont(font);
}
+
+ public void setIconImage(Image image){
+ this.iconImage = image;
+ }
+
+ public void setIconImage(Image image, int x, int y){
+ this.iconImage = image;
+ this.iconImage_x = x;
+ this.iconImage_y = y;
+ }
+
+ public void deleteIconImage() {
+ this.iconImage = null;
+ }
+
}