import QtQuick 1.0

Image {
    id: button

    property string name

    source: name ? "gfx/" + name + ".png" : ""

    signal clicked();

    //to refresh image when screen.state has changed
    onNameChanged: { source = name ? "gfx/" + name + ".png" : "";}

    MouseArea {
        anchors.fill: parent
        onPressed: {
            button.source = name ? "gfx/" + name + "_select.png" : ""
        }
        onReleased: {
            button.source = name ? "gfx/" + name + ".png" : ""
        }
        onClicked: button.clicked();
    }
}
