2 #GemRB - Infinity Engine Emulator
3 #Copyright (C) 2009 The GemRB Project
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.
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.
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.
22 from MetaClasses
import metaIDWrapper
, metaControl
23 #from exceptions import RuntimeError
26 __metaclass__
= metaIDWrapper
28 'GetValue': _GemRB
.Table_GetValue
,
29 'FindValue': _GemRB
.Table_FindValue
,
30 'GetRowIndex': _GemRB
.Table_GetRowIndex
,
31 'GetRowName': _GemRB
.Table_GetRowName
,
32 'GetColumnIndex': _GemRB
.Table_GetColumnIndex
,
33 'GetColumnName': _GemRB
.Table_GetColumnName
,
34 'GetRowCount': _GemRB
.Table_GetRowCount
,
35 'GetColumnCount': _GemRB
.Table_GetColumnCount
38 # don't unload tables if the _GemRB module is already unloaded at exit
39 if self
.ID
!= -1 and _GemRB
:
40 pass #_GemRB.Table_Unload(self.ID)
41 def __nonzero__(self
):
45 __metaclass__
= metaIDWrapper
47 'GetValue': _GemRB
.Symbol_GetValue
,
48 'Unload': _GemRB
.Symbol_Unload
52 __metaclass__
= metaIDWrapper
54 'SetSize': _GemRB
.Window_SetSize
,
55 'SetFrame': _GemRB
.Window_SetFrame
,
56 'SetPicture': _GemRB
.Window_SetPicture
,
57 'SetPos': _GemRB
.Window_SetPos
,
58 'HasControl': _GemRB
.Window_HasControl
,
59 'DeleteControl': _GemRB
.Window_DeleteControl
,
60 'Unload': _GemRB
.Window_Unload
,
61 'SetupEquipmentIcons': _GemRB
.Window_SetupEquipmentIcons
,
62 'SetupSpellIcons': _GemRB
.Window_SetupSpellIcons
,
63 'SetupControls': _GemRB
.Window_SetupControls
,
64 'SetVisible': _GemRB
.Window_SetVisible
,
65 'ShowModal': _GemRB
.Window_ShowModal
,
66 'Invalidate': _GemRB
.Window_Invalidate
68 def GetControl(self
, control
):
69 return _GemRB
.Window_GetControl(self
.ID
, control
)
70 def CreateWorldMapControl(self
, control
, *args
):
71 _GemRB
.Window_CreateWorldMapControl(self
.ID
, control
, *args
)
72 return _GemRB
.Window_GetControl(self
.ID
, control
)
73 def CreateMapControl(self
, control
, *args
):
74 _GemRB
.Window_CreateMapControl(self
.ID
, control
, *args
)
75 return _GemRB
.Window_GetControl(self
.ID
, control
)
76 def CreateLabel(self
, control
, *args
):
77 _GemRB
.Window_CreateLabel(self
.ID
, control
, *args
)
78 return _GemRB
.Window_GetControl(self
.ID
, control
)
79 def CreateButton(self
, control
, *args
):
80 _GemRB
.Window_CreateButton(self
.ID
, control
, *args
)
81 return _GemRB
.Window_GetControl(self
.ID
, control
)
82 def CreateScrollBar(self
, control
, *args
):
83 _GemRB
.Window_CreateScrollBar(self
.ID
, control
, *args
)
84 return _GemRB
.Window_GetControl(self
.ID
, control
)
85 def CreateTextEdit(self
, control
, *args
):
86 _GemRB
.Window_CreateTextEdit(self
.ID
, control
, *args
)
87 return _GemRB
.Window_GetControl(self
.ID
, control
)
91 __metaclass__
= metaControl
93 'SetVarAssoc': _GemRB
.Control_SetVarAssoc
,
94 'SetPos': _GemRB
.Control_SetPos
,
95 'SetSize': _GemRB
.Control_SetSize
,
96 'SetAnimationPalette': _GemRB
.Control_SetAnimationPalette
,
97 'SetAnimation': _GemRB
.Control_SetAnimation
,
98 'QueryText': _GemRB
.Control_QueryText
,
99 'SetText': _GemRB
.Control_SetText
,
100 'SetTooltip': _GemRB
.Control_SetTooltip
,
101 'SetEvent': _GemRB
.Control_SetEvent
,
102 'SetEventByName': _GemRB
.Control_SetEventByName
,
103 'SetStatus': _GemRB
.Control_SetStatus
,
105 def AttachScrollBar(self
, scrollbar
):
106 if self
.WinID
!= scrollbar
.WinID
:
107 raise RuntimeError, "Scrollbar must be in same Window as Control"
108 return _GemRB
.Control_AttachScrollBar(self
.WinID
, self
.ID
, scrollbar
.ID
)
110 class GLabel(GControl
):
111 __metaclass__
= metaControl
113 'SetTextColor': _GemRB
.Label_SetTextColor
,
114 'SetUseRGB': _GemRB
.Label_SetUseRGB
117 class GTextArea(GControl
):
118 __metaclass__
= metaControl
120 'Rewind': _GemRB
.TextArea_Rewind
,
121 'SetHistory': _GemRB
.TextArea_SetHistory
,
122 'Append': _GemRB
.TextArea_Append
,
123 'Clear': _GemRB
.TextArea_Clear
,
124 'Scroll': _GemRB
.TextArea_Scroll
,
125 'SetFlags': _GemRB
.Control_TextArea_SetFlags
,
126 'GetCharSounds': _GemRB
.TextArea_GetCharSounds
,
127 'GetCharacters': _GemRB
.TextArea_GetCharacters
,
128 'GetPortraits': _GemRB
.TextArea_GetPortraits
130 def MoveText(self
, other
):
131 _GemRB
.TextArea_MoveText(self
.WinID
, self
.ID
, other
.WinID
, other
.ID
)
133 class GTextEdit(GControl
):
134 __metaclass__
= metaControl
136 'SetBufferLength': _GemRB
.TextEdit_SetBufferLength
138 def ConvertEdit(self
, ScrollBarID
):
139 newID
= _GemRB
.TextEdit_ConvertEdit(self
.WinID
, self
.ID
, ScrollBarID
)
140 return _GemRB
.Window_GetControl(self
.WinID
, newID
)
142 class GScrollBar(GControl
):
143 __metaclass__
= metaControl
145 'SetDefaultScrollBar': _GemRB
.ScrollBar_SetDefaultScrollBar
,
146 'SetSprites': _GemRB
.ScrollBar_SetSprites
149 class GButton(GControl
):
150 __metaclass__
= metaControl
152 'SetSprites': _GemRB
.Button_SetSprites
,
153 'SetOverlay': _GemRB
.Button_SetOverlay
,
154 'SetBorder': _GemRB
.Button_SetBorder
,
155 'EnableBorder': _GemRB
.Button_EnableBorder
,
156 'SetFont': _GemRB
.Button_SetFont
,
157 'SetTextColor': _GemRB
.Button_SetTextColor
,
158 'SetFlags': _GemRB
.Button_SetFlags
,
159 'SetState': _GemRB
.Button_SetState
,
160 'SetPictureClipping': _GemRB
.Button_SetPictureClipping
,
161 'SetPicture': _GemRB
.Button_SetPicture
,
162 'SetSprite2D': _GemRB
.Button_SetSprite2D
,
163 'SetMOS': _GemRB
.Button_SetMOS
,
164 'SetPLT': _GemRB
.Button_SetPLT
,
165 'SetBAM': _GemRB
.Button_SetBAM
,
166 'SetSpellIcon': _GemRB
.Button_SetSpellIcon
,
167 'SetItemIcon': _GemRB
.Button_SetItemIcon
,
168 'SetActionIcon': _GemRB
.Button_SetActionIcon
170 def CreateLabelOnButton(self
, control
, *args
):
171 _GemRB
.Button_CreateLabelOnButton(self
.WinID
, self
.ID
, control
, *args
)
172 return _GemRB
.Window_GetControl(self
.WinID
, control
)
174 class GWorldMap(GControl
):
175 __metaclass__
= metaControl
177 'AdjustScrolling': _GemRB
.WorldMap_AdjustScrolling
,
178 'GetDestinationArea': _GemRB
.WorldMap_GetDestinationArea
,
179 'SetTextColor': _GemRB
.WorldMap_SetTextColor
183 __metaclass__
= metaIDWrapper
185 'GetDate': _GemRB
.SaveGame_GetDate
,
186 'GetGameDate': _GemRB
.SaveGame_GetGameDate
,
187 'GetName': _GemRB
.SaveGame_GetName
,
188 'GetPortrait': _GemRB
.SaveGame_GetPortrait
,
189 'GetPreview': _GemRB
.SaveGame_GetPreview
,
190 'GetSaveID': _GemRB
.SaveGame_GetSaveID
,
194 __metaclass__
= metaIDWrapper