summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java29
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java40
-rw-r--r--pdf-over-gui/src/main/resources/img/config_disabled.pngbin0 -> 818 bytes
4 files changed, 48 insertions, 24 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
index efb2819b..4b557e1e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/Constants.java
@@ -98,6 +98,9 @@ public class Constants {
"/img/config.png" : //$NON-NLS-1$
"/img/config_p.png"; //$NON-NLS-1$
+ /** Config inactive image resource */
+ public static final String RES_IMG_CONFIG_DISABLED = "/img/config_disabled.png"; //$NON-NLS-1$
+
/** Error image resource */
public static final String RES_IMG_ERROR = "/img/error.png"; //$NON-NLS-1$
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
index 502c8525..18cabc86 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
@@ -84,29 +84,19 @@ public class MainWindow {
* Main bar Buttons
*/
public enum Buttons {
- /**
- * the configuration button
- */
+ /** the configuration button */
CONFIG,
- /**
- * the open button
- */
+ /** the open button */
OPEN,
- /**
- * the position button
- */
+ /** the position button */
POSITION,
- /**
- * the signature button
- */
+ /** the signature button */
SIGN,
- /**
- * the final button
- */
+ /** the final button */
FINAL
}
@@ -283,7 +273,6 @@ public class MainWindow {
this.btn_config
.setToolTipText(Messages.getString("main.configuration")); //$NON-NLS-1$
this.btn_config.addMouseListener(new MouseAdapter() {
-
@Override
public void mouseUp(MouseEvent e) {
MainWindow.this.stateMachine
@@ -294,9 +283,11 @@ public class MainWindow {
this.buttonMap.put(Buttons.CONFIG, this.btn_config);
InputStream is = this.getClass().getResourceAsStream(Constants.RES_IMG_CONFIG);
-
- this.btn_config.setImage(new Image(Display.getDefault(), new ImageData(
- is)));
+ ((MainBarRectangleButton) this.btn_config).setEnabledImage(
+ new Image(Display.getDefault(), new ImageData(is)));
+ is = this.getClass().getResourceAsStream(Constants.RES_IMG_CONFIG_DISABLED);
+ ((MainBarRectangleButton) this.btn_config).setDisabledImage(
+ new Image(Display.getDefault(), new ImageData(is)));
Composite mainbarContainer = new Composite(this.mainbar, SWT.NONE);
mainbarContainer.setLayout(new FormLayout());
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);
+ }
}
diff --git a/pdf-over-gui/src/main/resources/img/config_disabled.png b/pdf-over-gui/src/main/resources/img/config_disabled.png
new file mode 100644
index 00000000..03d6fe71
--- /dev/null
+++ b/pdf-over-gui/src/main/resources/img/config_disabled.png
Binary files differ