public void mousemove(Coord c) { for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) { if (!wdg.visible) continue; Coord cc = xlate(wdg.c, true); wdg.mousemove(c.add(cc.inv())); } }
public Coord contentsz() { Coord max = new Coord(0, 0); for (Widget wdg = child; wdg != null; wdg = wdg.next) { if (!wdg.visible) continue; Coord br = wdg.c.add(wdg.sz); if (br.x > max.x) max.x = br.x; if (br.y > max.y) max.y = br.y; } return (max); }
public boolean mousewheel(Coord c, int amount) { for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) { if (!wdg.visible) continue; Coord cc = xlate(wdg.c, true); if (c.isect(cc, wdg.sz)) { if (wdg.mousewheel(c.add(cc.inv()), amount)) { return (true); } } } return (false); }
public Resource getcurs(Coord c) { Resource ret; for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) { if (!wdg.visible) continue; Coord cc = xlate(wdg.c, true); if (c.isect(cc, wdg.sz)) { if ((ret = wdg.getcurs(c.add(cc.inv()))) != null) return (ret); } } try { return ((cursor == null) ? null : cursor.get()); } catch (Loading l) { return (null); } }
public MainFrame(Coord isz) { super("Haven and Hearth"); version = "1.6 (12.22.2015)"; Coord sz; if (isz == null) { sz = Utils.getprefc("wndsz", new Coord(800, 600)); if (sz.x < 640) sz.x = 640; if (sz.y < 480) sz.y = 480; } else { sz = isz; } this.g = new ThreadGroup(HackThread.tg(), "Haven client"); this.mt = new HackThread(this.g, this, "Haven main thread"); p = new HavenPanel(sz.x, sz.y); if (fsmode == null) { Coord pfm = Utils.getprefc("fsmode", null); if (pfm != null) fsmode = findmode(pfm.x, pfm.y); } if (fsmode == null) { DisplayMode cm = getGraphicsConfiguration().getDevice().getDisplayMode(); fsmode = findmode(cm.getWidth(), cm.getHeight()); } if (fsmode == null) fsmode = findmode(800, 600); add(p); pack(); setResizable(!Utils.getprefb("wndlock", false)); p.requestFocusInWindow(); seticon(); setVisible(true); p.init(); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { g.interrupt(); } public void windowActivated(WindowEvent e) { p.bgmode = false; } public void windowDeactivated(WindowEvent e) { p.bgmode = true; } }); if ((isz == null) && Utils.getprefb("wndmax", false)) setExtendedState(getExtendedState() | MAXIMIZED_BOTH); }
public Object tooltip(Coord c, Widget prev) { if (prev != this) prevtt = null; if (tooltip != null) { prevtt = null; return (tooltip); } for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) { if (!wdg.visible) continue; Coord cc = xlate(wdg.c, true); if (c.isect(cc, wdg.sz)) { Object ret = wdg.tooltip(c.add(cc.inv()), prevtt); if (ret != null) { prevtt = wdg; return (ret); } } } prevtt = null; return (tooltip(c, prev == this)); }
public Coord rootxlate(Coord c) { return (c.sub(rootpos())); }