// Path: src/main/java/de/johni0702/minecraft/gui/element/ComposedGuiElement.java
// public interface ComposedGuiElement<T extends ComposedGuiElement<T>> extends GuiElement<T> {
//     Collection<GuiElement> getChildren();
// 
//     default  <C, R> R forEach(Class<C> ofType, Function<C, R> function) {
//         return forEach((elem, elemLayer) -> elem.forEach(elemLayer, ofType, function));
//     }
// 
//     default <C, R> R forEach(BiFunction<ComposedGuiElement<?>, Integer, R> recurse) {
//         int maxLayer = getMaxLayer();
//         for (int i = maxLayer; i >= 0; i--) {
//             R result = recurse.apply(this, i);
//             if (result != null) {
//                 return result;
//             }
//         }
//         return null;
//     }
// 
//     default <C, R> R forEach(int layer, Class<C> ofType, Function<C, R> function) {
//         return forEach(layer, ofType, (elem, elemLayer) -> elem.forEach(elemLayer, ofType, function), function);
//     }
// 
//     <C, R> R forEach(int layer, Class<C> ofType, BiFunction<ComposedGuiElement<?>, Integer, R> recurse, Function<C, R> function);
// 
//     default  <C> void invokeAll(Class<C> ofType, Consumer<C> consumer) {
//         forEach((elem, elemLayer) -> {
//             elem.invokeAll(elemLayer, ofType, consumer);
//             return null;
//         });
//     }
// 
//     default  <C> void invokeAll(int layer, Class<C> ofType, Consumer<C> consumer) {
//         forEach(layer, ofType, (elem, elemLayer) -> {
//             elem.invokeAll(elemLayer, ofType, consumer);
//             return null;
//         }, obj -> {
//             consumer.accept(obj);
//             return null;
//         });
//     }
// 
//     default <C> boolean invokeHandlers(Class<C> ofType, Function<C, Boolean> handle) {
//         return forEach((elem, elemLayer) -> elem.invokeHandlers(elemLayer, ofType, handle) ? true : null) == Boolean.TRUE;
//     }
// 
//     default <C> boolean invokeHandlers(int layer, Class<C> ofType, Function<C, Boolean> handle) {
//         return forEach(
//                 layer,
//                 ofType,
//                 (elem, elemLayer) -> elem.invokeHandlers(elemLayer, ofType, handle) ? true : null,
//                 obj -> handle.apply(obj) ? true : null
//         ) == Boolean.TRUE;
//     }
// 
//     /**
//      * Returns the highest layer this element or any of its children take part in.
//      * Events will be called for this composed jgui element for all layers between
//      * layer 0 (inclusive) and the returned maximum layer (inclusive).
//      * @return Highest layer relevant to this element
//      */
//     int getMaxLayer();
// }
// 
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
// 
//     MinecraftClient getMinecraft();
// 
//     GuiContainer getContainer();
//     T setContainer(GuiContainer container);
// 
//     void layout(ReadableDimension size, RenderInfo renderInfo);
//     void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
// 
//     ReadableDimension getMinSize();
//     ReadableDimension getMaxSize();
// 
//     T setMaxSize(ReadableDimension maxSize);
// 
//     boolean isEnabled();
//     T setEnabled(boolean enabled);
//     T setEnabled();
//     T setDisabled();
// 
//     GuiElement getTooltip(RenderInfo renderInfo);
//     T setTooltip(GuiElement tooltip);
// 
//     /**
//      * Returns the layer this element takes part in.
//      * The standard layer is layer 0. Event handlers will be called for this layer.
//      * @return The layer of this element
//      */
//     int getLayer();
// 
// }
// 
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
// 
//     Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
// 
//     ReadableDimension calcMinSize(GuiContainer<?> container);
// 
// }
// 
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
//     LayoutData NONE = VoidLayoutData.INSTANCE;
// }


import java.util.Comparator;
import java.util.Map;
import de.johni0702.minecraft.gui.element.ComposedGuiElement;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
/*
 * This file is part of jGui API, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2016 johni0702 <https://github.com/johni0702>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package de.johni0702.minecraft.gui.container;



public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {

    T setLayout(Layout layout);
    Layout getLayout();

// Path: src/main/java/de/johni0702/minecraft/gui/element/ComposedGuiElement.java
// public interface ComposedGuiElement<T extends ComposedGuiElement<T>> extends GuiElement<T> {
//     Collection<GuiElement> getChildren();
// 
//     default  <C, R> R forEach(Class<C> ofType, Function<C, R> function) {
//         return forEach((elem, elemLayer) -> elem.forEach(elemLayer, ofType, function));
//     }
// 
//     default <C, R> R forEach(BiFunction<ComposedGuiElement<?>, Integer, R> recurse) {
//         int maxLayer = getMaxLayer();
//         for (int i = maxLayer; i >= 0; i--) {
//             R result = recurse.apply(this, i);
//             if (result != null) {
//                 return result;
//             }
//         }
//         return null;
//     }
// 
//     default <C, R> R forEach(int layer, Class<C> ofType, Function<C, R> function) {
//         return forEach(layer, ofType, (elem, elemLayer) -> elem.forEach(elemLayer, ofType, function), function);
//     }
// 
//     <C, R> R forEach(int layer, Class<C> ofType, BiFunction<ComposedGuiElement<?>, Integer, R> recurse, Function<C, R> function);
// 
//     default  <C> void invokeAll(Class<C> ofType, Consumer<C> consumer) {
//         forEach((elem, elemLayer) -> {
//             elem.invokeAll(elemLayer, ofType, consumer);
//             return null;
//         });
//     }
// 
//     default  <C> void invokeAll(int layer, Class<C> ofType, Consumer<C> consumer) {
//         forEach(layer, ofType, (elem, elemLayer) -> {
//             elem.invokeAll(elemLayer, ofType, consumer);
//             return null;
//         }, obj -> {
//             consumer.accept(obj);
//             return null;
//         });
//     }
// 
//     default <C> boolean invokeHandlers(Class<C> ofType, Function<C, Boolean> handle) {
//         return forEach((elem, elemLayer) -> elem.invokeHandlers(elemLayer, ofType, handle) ? true : null) == Boolean.TRUE;
//     }
// 
//     default <C> boolean invokeHandlers(int layer, Class<C> ofType, Function<C, Boolean> handle) {
//         return forEach(
//                 layer,
//                 ofType,
//                 (elem, elemLayer) -> elem.invokeHandlers(elemLayer, ofType, handle) ? true : null,
//                 obj -> handle.apply(obj) ? true : null
//         ) == Boolean.TRUE;
//     }
// 
//     /**
//      * Returns the highest layer this element or any of its children take part in.
//      * Events will be called for this composed jgui element for all layers between
//      * layer 0 (inclusive) and the returned maximum layer (inclusive).
//      * @return Highest layer relevant to this element
//      */
//     int getMaxLayer();
// }
// 
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
// 
//     MinecraftClient getMinecraft();
// 
//     GuiContainer getContainer();
//     T setContainer(GuiContainer container);
// 
//     void layout(ReadableDimension size, RenderInfo renderInfo);
//     void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
// 
//     ReadableDimension getMinSize();
//     ReadableDimension getMaxSize();
// 
//     T setMaxSize(ReadableDimension maxSize);
// 
//     boolean isEnabled();
//     T setEnabled(boolean enabled);
//     T setEnabled();
//     T setDisabled();
// 
//     GuiElement getTooltip(RenderInfo renderInfo);
//     T setTooltip(GuiElement tooltip);
// 
//     /**
//      * Returns the layer this element takes part in.
//      * The standard layer is layer 0. Event handlers will be called for this layer.
//      * @return The layer of this element
//      */
//     int getLayer();
// 
// }
// 
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
// 
//     Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
// 
//     ReadableDimension calcMinSize(GuiContainer<?> container);
// 
// }
// 
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
//     LayoutData NONE = VoidLayoutData.INSTANCE;
// }


// Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
import java.util.Comparator;
import java.util.Map;
import de.johni0702.minecraft.gui.element.ComposedGuiElement;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;

/*
 * This file is part of jGui API, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2016 johni0702 <https://github.com/johni0702>
 * Copyright (c) contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package de.johni0702.minecraft.gui.container;



public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {

    T setLayout(Layout layout);
    Layout getLayout();

    void convertFor(GuiElement element, Point point);