/*
 * HomeButton.fx
 *
 * Created on Mar 23, 2010, 10:54:58 PM
 */
package vismobile;

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.paint.RadialGradient;
import javafx.scene.paint.Stop;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;

/**
 * @author Student
 */
public class HomeButton extends CustomNode {

    public var desc: String = "";

    public override function create(): Node {
        Group {
            //var rect:Rectangle;
            var txt: Text = Text {
                        font: Font {
                            size: 16
                        }
                        fill: Color.WHITE
                        content: "HOME"
                    }
            var rect1: Rectangle = Rectangle {
                        width: (Main.stage.width) - 2 //there is a slight "border" around the visible screen area
                        height: (Main.stage.height / 8)
                        arcWidth: Main.stage.width / 10
                        arcHeight: (Main.stage.height / 8) / 5
                        fill: null
                        stroke: Color.MEDIUMBLUE
                        strokeWidth: 4
                    },
            var rect2: Rectangle = Rectangle {
                        width: Main.stage.width - 2
                        height: (Main.stage.height / 8)
                        arcWidth: Main.stage.width / 10
                        arcHeight: (Main.stage.height / 8) / 5
                        fill: RadialGradient {
                            centerX: 0.5
                            centerY: 0.5
                            stops: [
                                Stop { offset: 0.0 color: Color.DARKBLUE },
                                Stop { offset: 0.8 color: Color.BLACK }
                            ]
                        }
                    },
            blocksMouse: true
            onMousePressed: function (e: MouseEvent): Void {

                Main.scene = Main.scenelist[0]

            };
            content: [
                Group {
                    content: [
                        rect1,
                        rect2
                    ]
                }
                Group {
                    translateX: rect1.width / 2 - txt.boundsInLocal.width / 2;
                    translateY: rect1.height / 2 + txt.boundsInLocal.height / 2;
                    content: [
                        txt
                    ]
                }
            ]
        }
    }

}
