4
|
1 module user.doob_test1.PaintHandler;
|
|
2
|
|
3 private import dwt.DWT;
|
|
4 private import dwt.events.PaintListener;
|
|
5 private import dwt.widgets.Canvas;
|
|
6 private import dwt.widgets.Display;
|
|
7
|
|
8 private import dwt.graphics.GC;
|
|
9 private import dwt.graphics.Rectangle;
|
|
10
|
|
11 private import tango.io.Stdout;
|
|
12
|
|
13 class PaintHandler : PaintListener {
|
|
14 public int x, y, xDiff, yDiff;
|
|
15 Canvas canvas;
|
|
16 Display display;
|
|
17
|
|
18 this(Canvas c, Display d) {
|
|
19 canvas = c;
|
|
20 display = d;
|
|
21 }
|
|
22
|
|
23 public void paintControl(PaintEvent e) {
|
|
24 Rectangle clientArea = canvas.getClientArea();
|
|
25 e.gc.setBackground(display.getSystemColor(DWT.COLOR_CYAN));
|
|
26 e.gc.fillRoundRectangle(x,y,xDiff,yDiff,50,50);
|
|
27 }
|
|
28
|
|
29 public void reDraw() {
|
|
30 canvas.redraw();
|
|
31 }
|
|
32 } |