Пример #1
0
  /**
   * @param _framing
   * @param _nameView
   * @param _name
   * @param _canClose
   * @param _canMinimize
   */
  public VFrame(
      IView _framing, IView _nameView, Object _name, boolean _canClose, boolean _canMinimize) {
    if (_name == null) {
      _name = "";
    }
    title = new VString(_name, UV.fonts[UV.cText], ViewColor.cWindowThemeFont);
    title.setWRange(0, 200);

    VChain buttons = new VChain(UV.cEW);
    if (_canClose) {
      VItem close =
          new VItem(new VString(" X ", UV.fonts[UV.cText], ViewColor.cWindowThemeFont)) {

            @Override
            public void picked(IEvent _e) {
              close();
            }
          };
      close.setBorder(new ButtonBorder(ViewColor.cWindowTheme, 2));
      buttons.add(close);
    }
    if (_canMinimize) {
      VItem maximize =
          new VItem(new VString(" + ", UV.fonts[UV.cText], ViewColor.cWindowThemeFont)) {

            @Override
            public void picked(IEvent _e) {
              maximize();
            }
          };
      maximize.setBorder(new ButtonBorder(ViewColor.cWindowTheme, 2));
      VItem minimize =
          new VItem(new VString(" - ", UV.fonts[UV.cText], ViewColor.cWindowThemeFont)) {

            @Override
            public void picked(IEvent _e) {
              minimize();
            }
          };
      minimize.setBorder(new ButtonBorder(ViewColor.cWindowTheme, 2));
      buttons.add(maximize);
      buttons.add(minimize);
    }
    if (_nameView != null) {
      buttons.add(_nameView);
    }
    buttons.setBorder(null);

    VChain chain = new VChain(UV.cEW);
    chain.add(4, 4);
    chain.add(buttons);
    chain.add(4, 4);
    chain.add(title, UV.cFII);
    Viewer v = new Viewer(chain);
    v.setBorder(new BuldgeBorder(ViewColor.cWindowTheme, 4));

    VChain main = new VChain(UV.cSWNW);
    main.add(v);
    popupViewer = new VPopupViewer(_framing);
    main.add(popupViewer);
    main.setBorder(new ViewBorder());
    setContent(main);
  }
Пример #2
0
  @Override
  public void mouseReleased(MouseReleased e) {
    if (e.getClickCount() == 1 && e.isRightClick()) {

      VChain presets = new VChain(UV.cSWNW);
      presets.add(
          new VItem(" On White ") {

            @Override
            public void picked(IEvent _e) {
              ViewColor.onWhite();
              getRootView().dispose();
            }
          });
      presets.add(
          new VItem(" On Gray ") {

            @Override
            public void picked(IEvent _e) {
              ViewColor.onGray();
              getRootView().dispose();
            }
          });
      presets.add(
          new VItem(" On Black ") {

            @Override
            public void picked(IEvent _e) {
              ViewColor.onBlack();
              getRootView().dispose();
            }
          });

      VChain fonts = new VChain(UV.cSWNW);
      for (int i = 0; i < UV.cFontUsageNames.length; i++) {
        final int index = i;
        final Value v =
            new Value(UV.fonts[index]) {

              @Override
              public void setValue(Object _value) {
                super.setValue(_value);
                UV.fonts[index] = (AFont) _value;
              }
            };
        fonts.add(
            new VItem(new VString(UV.cFontUsageNames[i])) {

              @Override
              public void picked(IEvent _e) {
                UV.popup(this, _e, new VFontBrowser(v), true, true);
              }
            });
      }

      VChain m = new VChain(UV.cNENW);
      m.add(UV.zone("Presets", new VPan(presets, -1, 300)));
      m.add(UV.zone("Fonts", new VPan(fonts, -1, 300)));
      m.add(UV.zone("Colors", new VPan(ViewColor.edit(), -1, 300)));
      m.add(UV.zone("Missing  Icons", new VPan(new VList(VIcon.missing, 1), -1, 300)));

      VPopupViewer pv = new VPopupViewer(m);
      Viewer wrap = new Viewer(pv);
      popupViewer.popup(wrap, wrap, new XY_I(0, 0), true, true);
    }
  }