diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-01 08:30:40 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-01 08:30:40 +0000 |
commit | 6d81b2dfa1a2ddb9192b864cc8f4585469bddadd (patch) | |
tree | 7f46021998069899e510766fa81dcc1b41c0c262 /trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java | |
parent | de9cabd09b90c701a2c41ce761ac199c5a4a20a6 (diff) | |
download | pdf-over-6d81b2dfa1a2ddb9192b864cc8f4585469bddadd.tar.gz pdf-over-6d81b2dfa1a2ddb9192b864cc8f4585469bddadd.tar.bz2 pdf-over-6d81b2dfa1a2ddb9192b864cc8f4585469bddadd.zip |
Configuration and Main Bar Buttons
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12534 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java')
-rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java new file mode 100644 index 00000000..edac29e5 --- /dev/null +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java @@ -0,0 +1,87 @@ +/* + * 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.events.PaintEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Region; +import org.eclipse.swt.widgets.Composite; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + */ +public class MainBarRectangleButton extends MainBarButton { + /** + * @param parent + * @param style + */ + public MainBarRectangleButton(Composite parent, int style) { + super(parent, style); + this.setActiveBackground(null); + this.setInactiveBackground(null); + } + + /** + * SLF4J Logger instance + **/ + private static final Logger log = LoggerFactory + .getLogger(MainBarRectangleButton.class); + + /* (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 - 2; + + int width = size.x; + + int textlen = 0; + if(getText() != null) { + textlen = getText().length(); + } + + 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); + int texty = (height - e.gc.getFontMetrics().getHeight()) / 2; + int textx = (width - e.gc.getFontMetrics().getAverageCharWidth() * textlen) / 2; + e.gc.drawText(getText(), textx, texty); + }*/ + + /* (non-Javadoc) + * @see at.asit.pdfover.gui.controls.MainBarButton#getCustomRegion() + */ + @Override + protected Region getCustomRegion() { + Point size = this.getSize(); + + int height = size.y - 2; + + int width = size.x; + + Region reg = new Region(); + reg.add(new int[] { 0, 0, width, 0, width, height, 0, height, 0, 0 }); + return reg; + } + +} |