Exemplo n.º 1
0
  public void uimsg(String msg, Object... args) {
    if (msg == "tabfocus") {
      setfocustab(((Integer) args[0] != 0));
    } else if (msg == "act") {
      canactivate = (Integer) args[0] != 0;
    } else if (msg == "cancel") {
      cancancel = (Integer) args[0] != 0;
    } else if (msg == "autofocus") {
      autofocus = (Integer) args[0] != 0;
    } else if (msg == "focus") {
      Widget w = ui.widgets.get((Integer) args[0]);
      if (w != null) {
        if (w.canfocus) setfocus(w);
      }
    } else if (msg == "curs") {
      if (args.length == 0) cursor = null;
      else cursor = Resource.remote().load((String) args[0], (Integer) args[1]);
    } else if (msg == "tip") {
      int a = 0;
      Object tt = args[a++];
      if (tt instanceof String) {
        tooltip = Text.render((String) tt);
      } else if (tt instanceof Integer) {
        final Indir<Resource> tres = ui.sess.getres((Integer) tt);
        tooltip =
            new Indir<Tex>() {
              Text t = null;

              public Tex get() {
                if (t == null) {
                  Resource.Pagina pag;
                  try {
                    pag = tres.get().layer(Resource.pagina);
                  } catch (Loading e) {
                    return (null);
                  }
                  t = RichText.render(pag.text, 300);
                }
                return (t.tex());
              }
            };
      }
    } else {
      System.err.println("Unhandled widget message: " + msg);
    }
  }
Exemplo n.º 2
0
 public void settip(String text) {
   tooltip = Text.render(text);
 }