package view;

import model.Constants;
import feathers.skins.RectangleSkin;
import feathers.layout.VerticalLayoutData;
import feathers.layout.AnchorLayoutData;
import feathers.layout.AnchorLayout;
import feathers.events.FeathersEvent;
import feathers.layout.VerticalLayout;
import feathers.controls.ScrollContainer;
import t9.util.ColorTraces.*;

class RidersScreen extends ScrollContainer {

    private var tb:ToolBar;
    private var rl:RidersList;

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

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

        backgroundSkin = new RectangleSkin(SolidColor(Constants.MAIN_COLOR2, 1));

        var vl:VerticalLayout = new VerticalLayout();
        vl.horizontalAlign = JUSTIFY;
        layout = vl;

        tb = new ToolBar();
        var vld1 = new VerticalLayoutData();
        vld1.percentHeight = 10.0;
        tb.layoutData = vld1;
        addChild(tb);
    
        rl = new RidersList();
        var vld2 = new VerticalLayoutData();
        vld2.percentHeight = 90.0;
        rl.layoutData = vld2;
        addChild(rl);

	}

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