// LtgMessageWindow.qml
import QtQuick 6.5
import QtQuick.Controls.Fusion 6.5
import QtQuick.Window 6.5

// To use, you must define instructionText:
// property string instructionText: "My text o display"
// in your root item

Window  {
	id: thisWindow
	visible: false
	title: "Instructions"
	
	// Make sure the windows in always on top
	flags: Qt.Window |
           Qt.WindowTitleHint |
           Qt.WindowSystemMenuHint |
		   Qt.WindowCloseButtonHint |
           Qt.WindowMinimizeButtonHint |
           Qt.WindowMaximizeButtonHint |
           Qt.WindowStaysOnTopHint
		   
	width: textItem.width + 40  // Width of the text + padding
	height: textItem.height + okButton.height + 20  // Height of the text + padding
	
	color: "#505050"
		
	Rectangle {
		anchors.fill: parent
		color: "#505050"


		Text {
			id: textItem
			text: instructionText
			font.pixelSize: 16
			color: "#DDDDDD"
			//wrapMode: Text.WordWrap
			anchors.horizontalCenter: parent.horizontalCenter
			anchors.top: parent.top
			padding: 20
			textFormat: Text.RichText

		}

		Button {
			id: okButton
			Text {
				anchors.centerIn: parent
				text: "OK"	
				color: "white"				
			}
			height: 30
			width: 60
			anchors.bottom: parent.bottom
			anchors.right: parent.right
			anchors.bottomMargin: 10  // Margin for the bottom side
			anchors.rightMargin: 30  // Margin for the right side
			
			background : Rectangle {
				color: parent.pressed ? "#444444" : "#666666"  // 
				radius: width*.1
			}
			
			onClicked: thisWindow.close()
		}
	}
}