package view;

import feathers.controls.Button;
import feathers.controls.Drawer;
import feathers.controls.LayoutGroup;
import feathers.events.FeathersEvent;
import feathers.events.TriggerEvent;
import feathers.layout.VerticalLayout;
import feathers.skins.RectangleSkin;
import model.Constants;
import t9.util.ColorTraces.*;

class MainDrawer extends Drawer {

	public static final CLOSE:String = "close";
	public static final OPEN:String = "open";

    private var openDrawerButton:Button;
    private var closeDrawerButton:Button;
	private var coucou:Bool;

	public function new() {
		super();
		addEventListener(FeathersEvent.CREATION_COMPLETE, onCreationComplete);
	}

	override private function initialize():Void {
		super.initialize();

		overlaySkin = new RectangleSkin(SolidColor( Constants.HERO_COLOR, 1));
		pullableEdge = LEFT;
		clickOverlayToClose = false;

		var d1 = new LayoutGroup();
		var vl = new VerticalLayout();
		vl.setPadding(10);
		vl.horizontalAlign = CENTER;
		vl.verticalAlign = TOP;
		d1.layout = vl;
		closeDrawerButton = new Button();
		closeDrawerButton.text = "Close Drawer";
		closeDrawerButton.addEventListener(TriggerEvent.TRIGGER, (event) -> {
			opened = false;
		});
		d1.addChild(closeDrawerButton);

		drawer = d1;
	}

	private function onCreationComplete(event:FeathersEvent):Void {
		traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
	}
}
