From d90922ab28157a9ea704e210484953abb06bea6f Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 18:59:39 +0000 Subject: Main Bar improvements Configuration fixed git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@70 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../gui/controls/MainBarRectangleButton.java | 73 ++++++++++++++++++++-- 1 file changed, 68 insertions(+), 5 deletions(-) (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java') 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 6f8b8340..102d2c07 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 @@ -44,26 +44,89 @@ public class MainBarRectangleButton extends MainBarButton { private static final Logger log = LoggerFactory .getLogger(MainBarRectangleButton.class); - /* (non-Javadoc) - * @see at.asit.pdfover.gui.controls.MainBarButton#paintButton(org.eclipse.swt.events.PaintEvent) + /* + * (non-Javadoc) + * + * @see + * at.asit.pdfover.gui.controls.MainBarButton#paintButton(org.eclipse.swt + * .events.PaintEvent) */ @Override protected void paintButton(PaintEvent e) { - + Point size = this.getSize(); int height = size.y - 3; int width = size.x; - + e.gc.drawLine(0, 0, width, 0); e.gc.drawLine(width, 0, width, height); e.gc.drawLine(width, height, 0, height); e.gc.drawLine(0, height, 0, 0); + + } + + @Override + protected void paintBackground(PaintEvent e) { + Point size = this.getSize(); + int height = size.y - 2; + + int width = size.x; + + int factor = GradientFactor; + + Region left_reg = new Region(); + left_reg.add(new int[] { 0, 0, factor, factor, factor, height-factor, 0, height, 0, 0 }); + + Region right_reg = new Region(); + right_reg.add(new int[] { width, 0, + width - factor, factor, + width - factor, height-factor, width, height, width, 0 }); + + Region top_reg = new Region(); + top_reg.add(new int[] { + 0, 0, + factor, factor, + width - factor, factor, + width, 0, + 0, 0 }); + + Region bottom_reg = new Region(); + bottom_reg.add(new int[] { + 0, height, + factor, height-factor, + width - factor, height-factor, + width, height, 0, height }); + + e.gc.setClipping(top_reg); + + //TOP + e.gc.fillGradientRectangle(0, 0, width, factor, true); + + e.gc.setClipping(bottom_reg); + + //BOTTOM + e.gc.fillGradientRectangle(0, height, width, -1 * (factor), + true); + + e.gc.setClipping(left_reg); + + // LEFT + e.gc.fillGradientRectangle(0, 0, factor, height, false); + + + e.gc.setClipping(right_reg); + // RIGTH + e.gc.fillGradientRectangle(width, 0, -1 * factor, height, + false); + e.gc.setClipping((Region)null); } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see at.asit.pdfover.gui.controls.MainBarButton#getCustomRegion() */ @Override -- cgit v1.2.3