summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authory29cheng2011-09-19 17:28:57 (EDT)
committer Felipe Heidrich2011-10-07 12:27:26 (EDT)
commitcebc16d81346a5671fdfc70a34e4dcf0a308418a (patch)
tree3cc84958a6670eb86d34f1280068999907709cf9
parent086cfc8a91bf07d934d502f0b34d4da4abd9aa31 (diff)
downloadeclipse.platform.swt-cebc16d81346a5671fdfc70a34e4dcf0a308418a.zip
eclipse.platform.swt-cebc16d81346a5671fdfc70a34e4dcf0a308418a.tar.gz
eclipse.platform.swt-cebc16d81346a5671fdfc70a34e4dcf0a308418a.tar.bz2
Bug 44072
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
index 0b279c4..1c63f47 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -69,7 +69,6 @@ public class Combo extends Composite {
* that the text field in an instance of this class can hold
*/
public final static int LIMIT;
-
/*
* These values can be different on different platforms.
* Therefore they are not initialized in the declaration
@@ -842,6 +841,28 @@ GdkColor getBackgroundColor () {
return getBaseColor ();
}
+public Point getCaretLocation() {
+ checkWidget();
+ int index = OS.gtk_editable_get_position (entryHandle);
+ if (OS.GTK_VERSION >= OS.VERSION (2, 6, 0)) {
+ index = OS.gtk_entry_text_index_to_layout_index (entryHandle, index);
+ }
+ int [] offset_x = new int [1], offset_y = new int [1];
+ OS.gtk_entry_get_layout_offsets (entryHandle, offset_x, offset_y);
+ int /*long*/ layout = OS.gtk_entry_get_layout (entryHandle);
+ PangoRectangle pos = new PangoRectangle ();
+ OS.pango_layout_index_to_pos (layout, index, pos);
+ int x = offset_x [0] + OS.PANGO_PIXELS (pos.x) - getBorderWidth ();
+ int y = offset_y [0] + OS.PANGO_PIXELS (pos.y);
+ return new Point (x, y);
+}
+
+public int getCaretPosition() {
+ checkWidget();
+ int /*long*/ ptr = OS.gtk_entry_get_text (entryHandle);
+ return (int)/*64*/OS.g_utf8_offset_to_utf16_offset (ptr, OS.gtk_editable_get_position (entryHandle));
+}
+
GdkColor getForegroundColor () {
return getTextColor ();
}