summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2003-06-24 15:42:35 +0000
committerSteve Northover <steve>2003-06-24 15:42:35 +0000
commit1833f10bbc5deb132672bdc9d56f8b22e56fbcd4 (patch)
treeff94b5959d6673c10d90778a5007847378a2a40e
parent3e6f54b5b4632230d5d807b59d7368ff394c467c (diff)
downloadeclipse.platform.swt-1833f10bbc5deb132672bdc9d56f8b22e56fbcd4.tar.gz
eclipse.platform.swt-1833f10bbc5deb132672bdc9d56f8b22e56fbcd4.tar.xz
eclipse.platform.swt-1833f10bbc5deb132672bdc9d56f8b22e56fbcd4.zip
14815
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java7
2 files changed, 8 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index 99ac883778..12a263d635 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -90,6 +90,7 @@ static int checkStyle (int style) {
style = checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
if ((style & SWT.SINGLE) != 0) style &= ~(SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP);
if ((style & SWT.WRAP) != 0) style |= SWT.MULTI;
+ if ((style & SWT.MULTI) != 0) style &= ~SWT.PASSWORD;
if ((style & (SWT.SINGLE | SWT.MULTI)) != 0) return style;
if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
return style | SWT.MULTI;
@@ -106,6 +107,7 @@ void createHandle (int index) {
OS.gtk_container_add (parentHandle, handle);
OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0);
OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0);
+ OS.gtk_entry_set_visibility (handle, (style & SWT.PASSWORD) == 0);
} else {
fixedHandle = OS.gtk_fixed_new ();
if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
index a9a28edb90..feef5853d3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
@@ -42,6 +42,7 @@ public class Text extends Scrollable {
public static final int LIMIT;
public static final String DELIMITER;
+ static final String PASSWORD = '*';
/*
* These values can be different on different platforms.
* Therefore they are not initialized in the declaration
@@ -91,6 +92,7 @@ static int checkStyle (int style) {
style = checkBits (style, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, 0);
if ((style & SWT.SINGLE) != 0) style &= ~(SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP);
if ((style & SWT.WRAP) != 0) style |= SWT.MULTI;
+ if ((style & SWT.MULTI) != 0) style &= SWT.PASSWORD;
if ((style & (SWT.SINGLE | SWT.MULTI)) != 0) return style;
if ((style & (SWT.H_SCROLL | SWT.V_SCROLL)) != 0) {
return style | SWT.MULTI;
@@ -197,6 +199,8 @@ void createWidget (int index) {
super.createWidget (index);
// doubleClick = true;
setTabStops (tabs = 8);
+ hiddenText = "";
+ if ((style & SWT.PASSWORD) != 0) setEchoChar (PASSWORD);
}
/**
@@ -1114,11 +1118,12 @@ public void selectAll () {
*/
public void setEchoChar (char echo) {
checkWidget();
+ if ((style & SWT.MULTI) != 0) return;
if (echoCharacter == echo) return;
String newText;
if (echo == 0) {
newText = hiddenText;
- hiddenText = null;
+ hiddenText = "";
} else {
newText = hiddenText = getText();
}