All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.badlogic.gdx.scenes.scene2d.Layout Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package com.badlogic.gdx.scenes.scene2d;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.ui.tablelayout.Table;

/** Provides methods for an actor to participate in layout and to provide a minimum, preferred, and maximum size.
 * @author Nathan Sweet */
public interface Layout {
	/** Computes and caches any information needed for drawing and, if this actor has children, positions and sizes each child and
	 * calls {@link #invalidate()} and then {@link #validate()} on each one. Usually this should not be called directly, instead
	 * {@link #validate()} should be used. */
	public void layout ();

	/** Invalidates this actor's layout, causing {@link #layout()} to be called the next time {@link #validate()} is called. This
	 * should be done when state changes in the actor that requires a layout but does not change the minimum, preferred, maximum,
	 * or actual size of the actor (meaning it does not affect the parent actor's layout). */
	public void invalidate ();

	/** Invalidates this actor and all its parents, calling {@link #invalidate()} on all involved actors. This method should be
	 * called when state changes in the actor that affects the minimum, preferred, maximum, or actual size of the actor (meaning it
	 * potentially affects the parent actor's layout). */
	public void invalidateHierarchy ();

	/** Ensures the actor has been laid out. Calls {@link #layout()} if {@link #invalidate()} has called since the last time
	 * {@link #validate()} was called, or if the actor otherwise needs to be laid out. This method is usually called in
	 * {@link Actor#draw(SpriteBatch, float)} before drawing is performed. */
	public void validate ();

	/** Sizes this actor to its preferred width and height and, if its size was changed, causes the actor to be laid out by calling
	 * {@link #invalidate()} and then {@link #validate()}.
	 * 

* Generally this method should not be called in a constructor because it calls {@link #layout()}, which means a subclass would * have layout() called before the subclass' constructor. Instead, in a constructor simply set the actors width and height to * {@link #getPrefWidth()} and {@link #getPrefHeight()}. This allows the actor to have a size at construction time for more * convenient use outside of a {@link Table}. */ public void pack (); /** If true, this actor will be sized to the parent in {@link #validate()}. If the parent is the stage, the actor will be sized * to the stage. */ public void setFillParent (boolean fillParent); public float getMinWidth (); public float getMinHeight (); public float getPrefWidth (); public float getPrefHeight (); public float getMaxWidth (); public float getMaxHeight (); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy