1# -*-python-*-
2# GemRB - Infinity Engine Emulator
3# Copyright (C) 2007 The GemRB Project
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License
7# as published by the Free Software Foundation; either version 2
8# of the License, or (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18#
19
20# DemoEnd.py - display DemoEnd pictures
21
22###################################################
23
24import GemRB
25
26Picture = None
27Table = None
28Window = None
29
30def OnLoad ():
31	global Table, Picture, Window
32
33	Window = GemRB.LoadWindow(0, "demoend")
34	Picture = 0
35	Table = GemRB.LoadTable ("splashsc")
36	resref = Table.GetValue (Picture,0)
37	Button = Window.GetControl (0)
38	Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE|IE_GUI_BUTTON_PICTURE, OP_SET)
39	Button.MakeDefault()
40	Button.SetState (IE_GUI_BUTTON_LOCKED)
41	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, NextPress)
42	Button.SetPicture (resref)
43	Window.Focus()
44	return
45
46def NextPress ():
47	global Picture
48
49	Picture = Picture + 1
50	if Table.GetRowCount()<=Picture:
51		DemoEnd()
52	else:
53		resref = Table.GetValue (Picture,0)
54		Button = Window.GetControl (0)
55		Button.SetPicture (resref)
56	return
57
58def DemoEnd ():
59	GemRB.SetNextScript ("Start")
60	return
61