comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet48.d @ 112:9f4c18c268b2

Update to compile and execute with dmd 2.052.
author kntroh
date Wed, 16 Mar 2011 21:53:53 +0900
parents 4e5843b771cc
children
comparison
equal deleted inserted replaced
111:b6e9904989ed 112:9f4c18c268b2
55 gc.drawLine (0, 0, width, height); 55 gc.drawLine (0, 0, width, height);
56 gc.drawLine (0, height, width, 0); 56 gc.drawLine (0, height, width, 0);
57 gc.drawText ("Default Image", 10, 10); 57 gc.drawText ("Default Image", 10, 10);
58 gc.dispose (); 58 gc.dispose ();
59 } 59 }
60 final Image image = originalImage; 60 Image image = originalImage;
61 final Point origin = new Point (0, 0); 61 Point origin = new Point (0, 0);
62 final Canvas canvas = new Canvas (shell, SWT.NO_BACKGROUND | 62 Canvas canvas = new Canvas (shell, SWT.NO_BACKGROUND |
63 SWT.NO_REDRAW_RESIZE | SWT.V_SCROLL | SWT.H_SCROLL); 63 SWT.NO_REDRAW_RESIZE | SWT.V_SCROLL | SWT.H_SCROLL);
64 final ScrollBar hBar = canvas.getHorizontalBar (); 64 ScrollBar hBar = canvas.getHorizontalBar ();
65 void onHBarSelection (Event e) { 65 void onHBarSelection (Event e) {
66 int hSelection = hBar.getSelection (); 66 int hSelection = hBar.getSelection ();
67 int destX = -hSelection - origin.x; 67 int destX = -hSelection - origin.x;
68 Rectangle rect = image.getBounds (); 68 Rectangle rect = image.getBounds ();
69 canvas.scroll (destX, 0, 0, 0, rect.width, rect.height, false); 69 canvas.scroll (destX, 0, 0, 0, rect.width, rect.height, false);
70 origin.x = -hSelection; 70 origin.x = -hSelection;
71 } 71 }
72 final ScrollBar vBar = canvas.getVerticalBar (); 72 ScrollBar vBar = canvas.getVerticalBar ();
73 void onVBarSelection(Event e) { 73 void onVBarSelection(Event e) {
74 int vSelection = vBar.getSelection (); 74 int vSelection = vBar.getSelection ();
75 int destY = -vSelection - origin.y; 75 int destY = -vSelection - origin.y;
76 Rectangle rect = image.getBounds (); 76 Rectangle rect = image.getBounds ();
77 canvas.scroll (0, destY, 0, 0, rect.width, rect.height, false); 77 canvas.scroll (0, destY, 0, 0, rect.width, rect.height, false);