Пример #1
0
 /**
  * Creates a new instance of the WindowExt control
  *
  * @param screen The screen control the Element is to be added to
  * @param position A Vector2f containing the x/y position of the Element
  */
 public WindowExt(ElementManager screen, Vector2f position) {
   this(
       screen,
       UIDUtil.getUID(),
       position,
       screen.getStyle("Window").getVector2f("defaultSize"),
       screen.getStyle("Window").getVector4f("resizeBorders"),
       screen.getStyle("Window").getString("defaultImg"));
 }
Пример #2
0
 /**
  * Creates a new instance of the WindowExt control
  *
  * @param screen The screen control the Element is to be added to
  * @param UID A unique String identifier for the Element
  * @param position A Vector2f containing the x/y position of the Element
  * @param dimensions A Vector2f containing the width/height dimensions of the Element
  */
 public WindowExt(ElementManager screen, String UID, Vector2f position, Vector2f dimensions) {
   this(
       screen,
       UID,
       position,
       dimensions,
       screen.getStyle("Window").getVector4f("resizeBorders"),
       screen.getStyle("Window").getString("defaultImg"));
 }
Пример #3
0
  /**
   * Creates a new instance of the WindowExt control
   *
   * @param screen The screen control the Element is to be added to
   * @param UID A unique String identifier for the Element
   * @param position A Vector2f containing the x/y position of the Element
   * @param dimensions A Vector2f containing the width/height dimensions of the Element
   * @param resizeBorders A Vector4f containg the border information used when resizing the default
   *     image (x = N, y = W, z = E, w = S)
   * @param defaultImg The default image to use for the Slider's track
   */
  public WindowExt(
      ElementManager screen,
      String UID,
      Vector2f position,
      Vector2f dimensions,
      Vector4f resizeBorders,
      String defaultImg) {
    super(screen, UID, position, dimensions, resizeBorders, defaultImg);

    this.setIsResizable(true);
    this.setScaleNS(false);
    this.setScaleEW(false);
    this.setClipPadding(screen.getStyle("Window").getFloat("clipPadding"));
    this.setMinDimensions(screen.getStyle("Window").getVector2f("minSize"));
    dbIndents.set(screen.getStyle("Window#Dragbar").getVector4f("indents"));
    float dragBarHeight = screen.getStyle("Window#Dragbar").getFloat("defaultControlSize");

    setLayout(
        new MigLayout(
            screen,
            "[]",
            "[" + dragBarHeight + "][]",
            "margins " + dbIndents.y + " " + dbIndents.z + " " + dbIndents.x + " " + dbIndents.w));

    // Drag Bar
    dragBar =
        new Element(
            screen,
            UID + ":DragBar",
            new Vector2f(dbIndents.y, dbIndents.x),
            new Vector2f(
                getWidth() - dbIndents.y - dbIndents.z,
                screen.getStyle("Window#Dragbar").getFloat("defaultControlSize")),
            screen.getStyle("Window#Dragbar").getVector4f("resizeBorders"),
            screen.getStyle("Window#Dragbar").getString("defaultImg"));
    dragBar
        .getLayoutHints()
        .define(
            "cell 0 0", "span 1 1",
            //	"pad " + dbIndents.y + " " + dbIndents.z + " " + dbIndents.x + " " + dbIndents.w,
            "dock left top", "grow true false");
    dragBar.setIsMovable(true);
    dragBar.setEffectParent(true);
    addChild(dragBar);

    dragBarTitle = ControlUtil.getLabel(screen, " ");
    dragBarTitle.setFontSize(screen.getStyle("Window#Dragbar").getFloat("fontSize"));
    dragBarTitle.setFontColor(screen.getStyle("Window#Dragbar").getColorRGBA("fontColor"));
    dragBarTitle.setTextAlign(
        BitmapFont.Align.valueOf(screen.getStyle("Window#Dragbar").getString("textAlign")));
    dragBarTitle.setTextVAlign(
        BitmapFont.VAlign.valueOf(screen.getStyle("Window#Dragbar").getString("textVAlign")));
    dragBarTitle.setTextPaddingByKey("Window#Dragbar", "textPadding");
    dragBarTitle.setTextWrap(
        LineWrapMode.valueOf(screen.getStyle("Window#Dragbar").getString("textWrap")));
    dragBar.addChild(dragBarTitle);

    // Content Area
    contentArea =
        new Element(screen, UIDUtil.getUID(), Vector2f.ZERO, Vector2f.ZERO, Vector4f.ZERO, null) {
          @Override
          public void setControlClippingLayer(Element clippingLayer) {
            super.setControlClippingLayer(clippingLayer);
            //	setClippingLayer(clippingLayer);
            addClippingLayer(clippingLayer);
          }
          // ControlUtil.getContainer(screen);
        };
    contentArea.setAsContainerOnly();
    contentArea
        .getLayoutHints()
        .define("cell 1 0", "span 1 1", "pad 0 0 10 0", "dock left top", "grow true true");

    addChild(contentArea);

    getLayout().layoutChildren();
  }