########################################################################
#	Hello Worlds - Libre 3D RPG game.
#	Copyright (C) 2020  CYBERDEViL
#
#	This file is part of Hello Worlds.
#
#	Hello Worlds is free software: you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation, either version 3 of the License, or
#	(at your option) any later version.
#
#	Hello Worlds is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
########################################################################


from LUIFrame import LUIFrame
from LUIButton import LUIButton

class UI_StartMenu:
	def __init__(self, parent):
		self._container = LUIFrame(parent=parent, width=100, height=180, style=LUIFrame.FS_sunken, margin=30, center_vertical=True, center_horizontal=True)

		self.startButton = LUIButton(parent=self._container, text="Start", template="ButtonGreen", top=3, center_horizontal=True)
		self.loadButton = LUIButton(parent=self._container, text="Load", template="ButtonGreen", top=40, center_horizontal=True)
		self.saveButton = LUIButton(parent=self._container, text="Save", template="ButtonGreen", top=77, center_horizontal=True)
		self.exitButton = LUIButton(parent=self._container, text="Exit", template="ButtonGreen", bottom=3, center_horizontal=True)

		self.startButton.bind("click", self._startClicked)
		self.exitButton.bind("click", self._exitClicked)

	def _startClicked(self, event):
		messenger.send('UI_STARTMENU_START_PRESSED')

	def _exitClicked(self, event):
		messenger.send('UI_STARTMENU_EXIT_PRESSED')

	def hasMouse(self, args=[]):
		return self._container.hasMouse()

	def close(self):
		self._container.parent = None
		self._container = None

	def hide(self):
		self._container.hide()

	def show(self):
		self._container.show()

	def isVisible(self): return self._container.visible
