Exemple #1
0
 public ChatUI(Coord c, int w, Widget parent) {
   super(c.add(0, -50), new Coord(w, 50), parent);
   chansel = new Selector(Coord.z, new Coord(selw, sz.y));
   chansel.hide();
   base = c;
   setfocusctl(true);
   setcanfocus(false);
 }
Exemple #2
0
 public Message messageat(Coord c, Coord hc) {
   int y = -sb.val;
   synchronized (msgs) {
     for (Message msg : msgs) {
       Coord sz = msg.sz();
       if ((c.y >= y) && (c.y < y + sz.y)) {
         if (hc != null) {
           hc.x = c.x;
           hc.y = c.y - y;
         }
         return (msg);
       }
       y += sz.y;
     }
   }
   return (null);
 }
Exemple #3
0
  public void drawsmall(GOut g, Coord br, int h) {
    Coord c;
    if (qline != null) {
      if ((rqline == null) || !rqline.text.equals(qline.line)) {
        String pre = String.format("%s> ", qline.chan.name());
        rqline = qfnd.render(pre + qline.line);
        rqpre = pre.length();
      }
      c = br.sub(0, 20);
      g.chcolor(24, 24, 16, 200);
      g.frect(c, rqline.tex().sz());
      g.chcolor();
      g.image(rqline.tex(), c);
      int lx = rqline.advance(qline.point + rqpre);
      g.line(new Coord(br.x + lx + 1, br.y - 18), new Coord(br.x + lx + 1, br.y - 6), 1);
    } else {
      c = br.sub(0, 5);
    }
    long now = System.currentTimeMillis();
    synchronized (notifs) {
      for (Iterator<Notification> i = notifs.iterator(); i.hasNext(); ) {
        Notification n = i.next();
        if (now - n.time > 5000) {
          i.remove();
          continue;
        }
        if ((c.y -= n.msg.sz().y) < br.y - h) break;

        g.chcolor(24, 24, 16, 200);
        g.frect(c, n.chnm.tex().sz().add(n.msg.tex().sz().x + selw, 0));
        g.chcolor();
        g.image(n.chnm.tex(), c, br.sub(0, h), br.add(selw - 10, 0));
        g.image(n.msg.tex(), c.add(selw, 0));
      }
    }
  }
Exemple #4
0
 public void resize(Coord sz) {
   super.resize(sz);
   this.c = base.add(0, -this.sz.y);
   chansel.resize(new Coord(selw, this.sz.y));
   if (sel != null) sel.resize(new Coord(this.sz.x - selw, this.sz.y));
 }