| 1 26 27 package org.nightlabs.editor2d.viewer.swt; 28 29 import org.eclipse.swt.widgets.Control; 30 31 import org.nightlabs.editor2d.viewer.ICanvas; 32 33 public class SWTCanvasAutoScrollSupport 34 extends AbstractSWTAutoScrollSupport 35 { 36 public SWTCanvasAutoScrollSupport(Control control) { 37 super(control); 38 } 39 40 protected ICanvas getCanvas() { 41 return (ICanvas) getControl(); 42 } 43 44 protected void scrollDown(int scrollStep) { 45 getCanvas().translateY(scrollStep); 46 getCanvas().repaint(); 47 } 48 49 protected void scrollUp(int scrollStep) { 50 getCanvas().translateY(-scrollStep); 51 getCanvas().repaint(); 52 } 53 54 protected void scrollLeft(int scrollStep) { 55 getCanvas().translateX(scrollStep); 56 getCanvas().repaint(); 57 } 58 59 protected void scrollRight(int scrollStep) { 60 getCanvas().translateX(-scrollStep); 61 getCanvas().repaint(); 62 } 63 64 } 65 | Popular Tags |