summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-over-gui/src/main')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java16
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java46
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java1
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java4
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)