diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:34:42 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 19:34:42 +0000 |
commit | 80be05f181f8801b0b53531ddcfc0e7814f4d05e (patch) | |
tree | e544ec0febfde2e3e155ba2c6a436e7f7d4f0717 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls | |
parent | 8aca86f7eb5ff72c201f1029393292088ff5ec55 (diff) | |
download | pdf-over-80be05f181f8801b0b53531ddcfc0e7814f4d05e.tar.gz pdf-over-80be05f181f8801b0b53531ddcfc0e7814f4d05e.tar.bz2 pdf-over-80be05f181f8801b0b53531ddcfc0e7814f4d05e.zip |
Grey out config button when disabled
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@391 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java index 102d2c07..ce423977 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java @@ -17,6 +17,7 @@ package at.asit.pdfover.gui.controls; // Imports import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Region; import org.eclipse.swt.widgets.Composite; @@ -27,6 +28,17 @@ import org.slf4j.LoggerFactory; * */ public class MainBarRectangleButton extends MainBarButton { + + /** + * SLF4J Logger instance + **/ + @SuppressWarnings("unused") + private static final Logger log = LoggerFactory + .getLogger(MainBarRectangleButton.class); + + private Image enabledImg = null; + private Image disabledImg = null; + /** * @param parent * @param style @@ -38,11 +50,24 @@ public class MainBarRectangleButton extends MainBarButton { } /** - * SLF4J Logger instance - **/ - @SuppressWarnings("unused") - private static final Logger log = LoggerFactory - .getLogger(MainBarRectangleButton.class); + * Set the image to display while this control is enabled + * @param enabledImg enabled image + */ + public void setEnabledImage(Image enabledImg) { + this.enabledImg = enabledImg; + if (getEnabled()) + setImage(enabledImg); + } + + /** + * Set the image to display while this control is disabled + * @param disabledImg disabled image + */ + public void setDisabledImage(Image disabledImg) { + this.disabledImg = disabledImg; + if (!getEnabled()) + setImage(disabledImg); + } /* * (non-Javadoc) @@ -142,4 +167,9 @@ public class MainBarRectangleButton extends MainBarButton { return reg; } + @Override + public void setEnabled(boolean enabled) { + setImage(enabled ? this.enabledImg : this.disabledImg); + super.setEnabled(enabled); + } } |