Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti2001-09-07 20:46:23 +0000
committerSilenio Quarti2001-09-07 20:46:23 +0000
commite617e7739c57830b586bb99c74e9abfc4e7efa11 (patch)
tree4566eb5518ef86a7c3e74d5813f434a4ce0aedd2 /bundles/org.eclipse.swt
parentb413b7462add3967403bcaa645b623d7c38279ef (diff)
downloadeclipse.platform.swt-e617e7739c57830b586bb99c74e9abfc4e7efa11.tar.gz
eclipse.platform.swt-e617e7739c57830b586bb99c74e9abfc4e7efa11.tar.xz
eclipse.platform.swt-e617e7739c57830b586bb99c74e9abfc4e7efa11.zip
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.swt')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java31
1 files changed, 29 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java
index a8271df354..478d68fc86 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java
@@ -11,6 +11,7 @@ import org.eclipse.swt.graphics.*;
public /*final*/ class Caret extends Widget {
Canvas parent;
+ Image image;
int x, y, width, height;
boolean moved, resized;
boolean isVisible, isShowing;
@@ -53,9 +54,14 @@ boolean drawCaret () {
OS.PgSetRegion (OS.PtWidgetRid (handle));
OS.PgSetDrawMode (OS.Pg_DRAWMODE_XOR);
OS.PgSetFillColor (color);
- int nWidth = width;
+ int nWidth = width, nHeight = height;
+ if (image != null) {
+ Rectangle rect = image.getBounds ();
+ nWidth = rect.width;
+ nHeight = rect.height;
+ }
if (nWidth <= 0) nWidth = 2;
- OS.PgDrawIRect (x, y, x + nWidth - 1, y + height - 1, OS.Pg_DRAW_FILL);
+ OS.PgDrawIRect (x, y, x + nWidth - 1, y + nHeight - 1, OS.Pg_DRAW_FILL);
OS.PgSetGC (prevContext);
OS.PgDestroyGC (phGC);
return true;
@@ -63,6 +69,10 @@ boolean drawCaret () {
public Rectangle getBounds () {
checkWidget();
+ if (image != null) {
+ Rectangle rect = image.getBounds ();
+ return new Rectangle (x, y, rect.width, rect.height);
+ }
return new Rectangle (x, y, width, height);
}
@@ -77,6 +87,11 @@ public Font getFont () {
return parent.getFont ();
}
+public Image getImage () {
+ checkWidget();
+ return image;
+}
+
public Point getLocation () {
checkWidget();
return new Point (x, y);
@@ -89,6 +104,10 @@ public Canvas getParent () {
public Point getSize () {
checkWidget();
+ if (image != null) {
+ Rectangle rect = image.getBounds ();
+ return new Point (rect.width, rect.height);
+ }
return new Point (width, height);
}
@@ -130,6 +149,7 @@ void releaseWidget () {
// display.setCurrentCaret (null);
// }
parent = null;
+ image = null;
}
public void setBounds (int x, int y, int width, int height) {
@@ -167,6 +187,13 @@ public void setFont (Font font) {
checkWidget();
}
+public void setImage (Image image) {
+ checkWidget();
+ if (isShowing) hideCaret ();
+ this.image = image;
+ if (isShowing) showCaret ();
+}
+
public void setLocation (int x, int y) {
checkWidget();
setBounds (x, y, width, height);

Back to the top