summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2002-09-24 22:09:01 +0000
committerSilenio Quarti <silenio>2002-09-24 22:09:01 +0000
commitd7f2aad9f917d129c28f735efea9010d37950d34 (patch)
treebbc9dd98311a352630baf3861c6e400d5884deaa /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
parent58dd42fc90819e368e6371a7c8959a37a5955a05 (diff)
downloadeclipse.platform.swt-d7f2aad9f917d129c28f735efea9010d37950d34.tar.gz
eclipse.platform.swt-d7f2aad9f917d129c28f735efea9010d37950d34.tar.xz
eclipse.platform.swt-d7f2aad9f917d129c28f735efea9010d37950d34.zip
22615
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java29
1 files changed, 25 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
index 9ac244f262..331bec5579 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java
@@ -30,7 +30,8 @@ import org.eclipse.swt.graphics.*;
* </p>
*/
public class ProgressBar extends Control {
- int min = 0, max = 100, value = 0;
+ int timerId, min = 0, max = 100, value = 0;
+ static final int DELAY = 100;
/**
* Constructs a new instance of this class given its parent
@@ -93,9 +94,16 @@ void createHandle (int index) {
OS.gtk_container_add (parentHandle, handle);
OS.gtk_widget_show (handle);
int orientation = (style & SWT.VERTICAL) != 0 ? OS.GTK_PROGRESS_TOP_TO_BOTTOM : OS.GTK_PROGRESS_LEFT_TO_RIGHT;
- OS.gtk_progress_bar_set_orientation (handle, orientation);
- int style = (this.style & SWT.SMOOTH) == 0 ? OS.GTK_PROGRESS_DISCRETE : OS.GTK_PROGRESS_CONTINUOUS;
- OS.gtk_progress_bar_set_bar_style (handle, style);
+ OS.gtk_progress_bar_set_orientation (handle, orientation);
+ if ((style & SWT.INDETERMINATE) != 0) {
+ Display display = getDisplay ();
+ timerId = OS.gtk_timeout_add (DELAY, display.windowTimerProc, handle);
+ } else {
+ /*
+ * Note: this API is deprecated, but there is no replacement. */
+ int barStyle = (this.style & SWT.SMOOTH) == 0 ? OS.GTK_PROGRESS_DISCRETE : OS.GTK_PROGRESS_CONTINUOUS;
+ OS.gtk_progress_bar_set_bar_style (handle, barStyle);
+ }
}
/**
@@ -143,6 +151,19 @@ public int getSelection () {
return value;
}
+int processTimer (int id) {
+ OS.gtk_progress_bar_pulse (handle);
+ Display display = getDisplay ();
+ timerId = OS.gtk_timeout_add (DELAY, display.windowTimerProc, handle);
+ return 0;
+}
+
+void releaseWidget () {
+ super.releaseWidget ();
+ if (timerId != 0) OS.gtk_timeout_remove (timerId);
+ timerId = 0;
+}
+
/**
* Sets the maximum value which the receiver will allow
* to be the argument which must be greater than or