summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java119
1 files changed, 0 insertions, 119 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java
deleted file mode 100644
index 0f3f1642..00000000
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ClickableCanvas.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2012 by A-SIT, Secure Information Technology Center Austria
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://joinup.ec.europa.eu/software/page/eupl
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- */
-package at.asit.pdfover.gui.controls;
-
-// Imports
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-
-/**
- *
- */
-public class ClickableCanvas extends Canvas {
-
- private Image image = null;
-
- /**
- * @param parent
- * @param style
- */
- public ClickableCanvas(Composite parent, int style) {
- super(parent, style);
-
- this.addPaintListener(new PaintListener() {
-
- @Override
- public void paintControl(PaintEvent e) {
- ClickableCanvas.this.paintControl(e);
- }
- });
-
- final Cursor hand = new Cursor(this.getDisplay(), SWT.CURSOR_HAND);
-
- this.addListener(SWT.Resize, (Event event) -> {
- ClickableCanvas.this.redraw();
- });
-
- this.setCursor(hand);
-
- }
-
- /**
- * Gets the image
- *
- * @return the image
- */
- public Image getImage() {
- return this.image;
- }
-
- /**
- * Sets the Image
- *
- * @param image
- * the imgage to set
- */
- public void setImage(Image image) {
- this.image = image;
- }
-
- /**
- * Main painting method
- *
- * @param e
- */
- void paintControl(PaintEvent e) {
- this.paintText(e);
- }
-
- /**
- * Paint the text or image on the button
- *
- * @param e
- */
- protected void paintText(PaintEvent e) {
- Point size = this.getSize();
- int width = size.x;
-
- // e.gc.fillGradientRectangle(0, 1, width, height / 4, true);
-
- if (this.image != null) {
-
- //log.debug("Width: " + width + " Height: " + height);
-
- int w = 0;
- Image tmp = null;
- if(this.image.getImageData().width < width) {
- tmp = new Image(getDisplay(), this.image.getImageData());
- w = (width - this.image.getImageData().width) / 2;
- } else if(this.image.getImageData().width > width) {
- tmp = new Image(getDisplay(), this.image.getImageData().scaledTo(width, width));
- } else {
- tmp = new Image(getDisplay(), this.image.getImageData());
- }
-
- e.gc.drawImage(tmp, w, w);
- }
-
- }
-}