diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 18:57:24 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 18:57:24 +0000 |
commit | f294a5abda6947a2edd7eb502ca340ac6c02f68f (patch) | |
tree | 34947c0b547d3536a0847c6320c493ad73cb21c9 /pdf-over-gui | |
parent | 5424c6f4ea9e0d0d52c451dbf0c11ac9d70069e4 (diff) | |
download | mocca-f294a5abda6947a2edd7eb502ca340ac6c02f68f.tar.gz mocca-f294a5abda6947a2edd7eb502ca340ac6c02f68f.tar.bz2 mocca-f294a5abda6947a2edd7eb502ca340ac6c02f68f.zip |
Minor GUI changes to MainBar Buttons
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@56 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui')
7 files changed, 51 insertions, 28 deletions
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 e86cf907..dd735bbf 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 @@ -189,13 +189,13 @@ public class MainWindow { this.mainBarFormData.left = new FormAttachment(0, 5); this.mainBarFormData.right = new FormAttachment(100, -5); this.mainBarFormData.top = new FormAttachment(0, 5); - this.mainBarFormData.bottom = new FormAttachment(0, 60); + this.mainBarFormData.bottom = new FormAttachment(0, 50); composite.setLayoutData(this.mainBarFormData); this.btn_config = new MainBarRectangleButton(composite, SWT.NONE); FormData fd_btn_config = new FormData(); fd_btn_config.bottom = new FormAttachment(0, 45); - fd_btn_config.right = new FormAttachment(10,0); + fd_btn_config.right = new FormAttachment(0,45); fd_btn_config.top = new FormAttachment(0); fd_btn_config.left = new FormAttachment(0, 2); this.btn_config.setLayoutData(fd_btn_config); @@ -229,7 +229,7 @@ public class MainWindow { fd_btn_open.bottom = new FormAttachment(0, 45); fd_btn_open.right = new FormAttachment(35, 5); fd_btn_open.top = new FormAttachment(0); - fd_btn_open.left = new FormAttachment(10, 0); + fd_btn_open.left = new FormAttachment(0, 45); this.btn_open.setLayoutData(fd_btn_open); this.btn_open.setText("Open"); this.btn_open.addMouseListener(new MouseListener() { @@ -304,7 +304,7 @@ public class MainWindow { FormData fd_composite_1 = new FormData(); fd_composite_1.bottom = new FormAttachment(100, -25); fd_composite_1.right = new FormAttachment(100, -5); - fd_composite_1.top = new FormAttachment(0, 60); + fd_composite_1.top = new FormAttachment(0, 50); fd_composite_1.left = new FormAttachment(0, 5); this.container.setLayoutData(fd_composite_1); this.stack = new StackLayout(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java index 70e5b514..afa7be3e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java @@ -241,22 +241,6 @@ public class DataSourceSelectComposite extends StateComposite { this.fd_btn_open.bottom = new FormAttachment(100, -5); btn_open.setLayoutData(this.fd_btn_open); - lbl_drag.addListener(SWT.Resize, new Listener() { - - @Override - public void handleEvent(Event event) { - /*Point size = btn_open.computeSize(SWT.DEFAULT, SWT.DEFAULT); - DataSourceSelectComposite.this.fd_btn_open.top = new FormAttachment( - 50, (lbl_drag.getSize().x / 2) + 10); - DataSourceSelectComposite.this.fd_btn_open.left = new FormAttachment( - 50, -1 * (size.x / 2)); - DataSourceSelectComposite.this.fd_btn_open.right = new FormAttachment( - 50, (size.x / 2)); - DataSourceSelectComposite.this.fd_btn_open.bottom = new FormAttachment( - 50, (size.y / 2) + (lbl_drag.getSize().x) + 10);*/ - } - }); - // btn_open.setBackground(back); btn_open.addSelectionListener(new FileBrowseDialogListener()); this.drop_area.pack(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java index 509780fb..37e4f85b 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java @@ -27,6 +27,7 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Region; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; @@ -49,12 +50,12 @@ public abstract class MainBarButton extends Canvas { @Override public void paintControl(PaintEvent e) { - MainBarButton.this.paintButton(e); + MainBarButton.this.paintControl(e); } }); final Cursor hand = new Cursor(this.getDisplay(), SWT.CURSOR_HAND); - + this.addListener(SWT.Resize, new Listener() { @Override @@ -120,6 +121,7 @@ public abstract class MainBarButton extends Canvas { * the active state */ public void setActive(boolean active) { + this.active = active; if (this.active) { this.setBackground(this.activeBackground); @@ -158,15 +160,52 @@ public abstract class MainBarButton extends Canvas { private static final Logger log = LoggerFactory .getLogger(MainBarButton.class); + protected void paintBackground(PaintEvent e) { + + Point size = this.getSize(); + int height = size.y - 2; + + int width = size.x; + + int factor = 4; + + // TOP + e.gc.fillGradientRectangle(0, 0, width, factor, true); + + // BOTTOM + e.gc.fillGradientRectangle(0, height, width, -1 * (factor), + true); + + // LEFT + //e.gc.fillGradientRectangle(0, 0, factor, height, false); + + // RIGTH + //e.gc.fillGradientRectangle(width, 0, -1 * (width / factor), height, + // false); + + } + + private void paintControl(PaintEvent e) { + this.paintBackground(e); + this.paintButton(e); + this.paintBorderAndText(e); + } + + protected void paintButton(PaintEvent e) { + // could be overwritten by subclasses + } + /** * @param e */ - protected void paintButton(PaintEvent e) { + protected void paintBorderAndText(PaintEvent e) { Point size = this.getSize(); int height = size.y - 2; int width = size.x; + // e.gc.fillGradientRectangle(0, 1, width, height / 4, true); + if (this.image == null) { int textlen = 0; @@ -184,6 +223,7 @@ public abstract class MainBarButton extends Canvas { .scaledTo(height, height)); e.gc.drawImage(tmp, imgx, 0); } + } /** diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java index 2542d805..acbff332 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java @@ -62,7 +62,6 @@ public class MainBarEndButton extends MainBarButton { e.gc.drawLine(0, height, 0+split, (height) / 2); e.gc.drawLine(0+split, (height) / 2, 0, 0); - super.paintButton(e); } /* diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java index 5512a74e..f46e7e42 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java @@ -46,6 +46,7 @@ public class MainBarMiddleButton extends MainBarButton { */ @Override protected void paintButton(PaintEvent e) { + Point size = this.getSize(); int height = size.y - 2; @@ -60,7 +61,6 @@ public class MainBarMiddleButton extends MainBarButton { e.gc.drawLine(0, height, 0+split, (height) / 2); e.gc.drawLine(0+split, (height) / 2, 0, 0); - super.paintButton(e); } /* (non-Javadoc) 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 17971982..39392307 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 @@ -48,6 +48,7 @@ public class MainBarRectangleButton extends MainBarButton { */ @Override protected void paintButton(PaintEvent e) { + Point size = this.getSize(); int height = size.y - 2; @@ -59,7 +60,6 @@ public class MainBarRectangleButton extends MainBarButton { e.gc.drawLine(width, height, 0, height); e.gc.drawLine(0, height, 0, 0); - super.paintButton(e); } /* (non-Javadoc) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java index d43c86de..9101e274 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java @@ -46,6 +46,7 @@ public class MainBarStartButton extends MainBarButton { */ @Override protected void paintButton(PaintEvent e) { + Point size = this.getSize(); int height = size.y - 2; @@ -58,8 +59,7 @@ public class MainBarStartButton extends MainBarButton { e.gc.drawLine(width + split, (height) / 2, width, height); e.gc.drawLine(width, height, 0, height); e.gc.drawLine(0, height, 0, 0); - - super.paintButton(e); + } /* (non-Javadoc) |