// (c) Matti Katila package gzz.modules.pp; import gzz.vob.VobScene; import gzz.vob.TextStyle; import gzz.vob.vobs.TextVob; public class Button { final private VobScene vs; final private EventHandling ev_handler; final private float scale; final private TextStyle style; public Button(VobScene v, EventHandling e, TextStyle s) { vs = v; ev_handler = e; style = s; scale = style.getScaleByHeight(40); } public void add(String event_name, String caption, float x, float y) { // put the "New paper" -text TextVob button = new TextVob(style, caption); float width = button.getWidth(scale); int frame = vs.orthoBoxCS(0, event_name+"_frame", 10, x,y, 1,1, width, button.getHeight(scale) + button.getDepth(scale)); int button_cs = vs.scaleCS(frame, event_name+"_cs", button.getHeight(scale) + button.getDepth(scale), button.getHeight(scale) + button.getDepth(scale)); vs.activate(frame); vs.map.put(button, button_cs); ev_handler.onClick(frame, event_name); } }