1# -*-python-*-
2# GemRB - Infinity Engine Emulator
3# Copyright (C) 2003 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
21# GUIDefines.py - common definitions of GUI-related constants for GUIScripts
22
23# view flags
24IE_GUI_VIEW_RESIZE_NONW			= 0
25IE_GUI_VIEW_RESIZE_TOP			= 1 << 0 # keep my top relative to my super
26IE_GUI_VIEW_RESIZE_BOTTOM		= 1 << 1 # keep my bottom relative to my super
27IE_GUI_VIEW_RESIZE_VERTICAL		= IE_GUI_VIEW_RESIZE_TOP|IE_GUI_VIEW_RESIZE_BOTTOM # top+bottom effectively resizes me vertically
28IE_GUI_VIEW_RESIZE_LEFT			= 1 << 3 # keep my left relative to my super
29IE_GUI_VIEW_RESIZE_RIGHT		= 1 << 4 # keep my right relative to my super
30IE_GUI_VIEW_RESIZE_HORIZONTAL	= IE_GUI_VIEW_RESIZE_LEFT|IE_GUI_VIEW_RESIZE_RIGHT # top+bottom effectively resizes me horizontaly
31IE_GUI_VIEW_RESIZE_ALL			= IE_GUI_VIEW_RESIZE_VERTICAL|IE_GUI_VIEW_RESIZE_HORIZONTAL # resize me relative to my super
32
33# TODO: move these to TextContainer
34IE_GUI_VIEW_RESIZE_WIDTH	= 1 << 27	# resize the view horizontally if horizontal content exceeds width
35IE_GUI_VIEW_RESIZE_HEIGHT	= 1 << 26	# resize the view vertically if vertical content exceeds width
36
37IE_GUI_VIEW_INVISIBLE		= 1 << 30
38IE_GUI_VIEW_DISABLED		= 1 << 29
39IE_GUI_VIEW_IGNORE_EVENTS	= 1 << 28
40
41#button flags
42IE_GUI_BUTTON_NORMAL     = 0x00000004   #default button, doesn't stick
43IE_GUI_BUTTON_NO_IMAGE   = 0x00000001
44IE_GUI_BUTTON_PICTURE    = 0x00000002
45IE_GUI_BUTTON_SOUND      = 0x00000004
46IE_GUI_BUTTON_CAPS       = 0x00000008   #capitalize all the text
47IE_GUI_BUTTON_CHECKBOX   = 0x00000010   #or radio button
48IE_GUI_BUTTON_RADIOBUTTON= 0x00000020   #sticks in a state
49IE_GUI_BUTTON_ANIMATED   = 0x00000080   # the button is animated
50
51#these bits are hardcoded in the .chu structure, don't move them
52IE_GUI_BUTTON_ALIGN_LEFT = 0x00000100
53IE_GUI_BUTTON_ALIGN_RIGHT= 0x00000200
54IE_GUI_BUTTON_ALIGN_TOP  = 0x00000400
55IE_GUI_BUTTON_ALIGN_BOTTOM = 0x00000800
56IE_GUI_BUTTON_ALIGN_ANCHOR = 0x00001000
57IE_GUI_BUTTON_LOWERCASE    = 0x00002000
58#IE_GUI_BUTTON_MULTILINE    = 0x00004000 # don't set the SINGLE_LINE font rendering flag
59#end of hardcoded section
60
61IE_GUI_BUTTON_NO_TEXT    = 0x00010000   # don't draw button label
62IE_GUI_BUTTON_PLAYRANDOM = 0x00020000   # the button animation is random
63IE_GUI_BUTTON_PLAYONCE   = 0x00040000   # the button animation won't restart
64IE_GUI_BUTTON_PLAYALWAYS = 0x00080000   # animation will play when game is paused
65
66IE_GUI_BUTTON_CENTER_PICTURES = 0x00100000 # center the button's PictureList
67IE_GUI_BUTTON_BG1_PAPERDOLL   = 0x00200000 # BG1-style paperdoll
68IE_GUI_BUTTON_HORIZONTAL      = 0x00400000 # horizontal clipping of overlay
69IE_GUI_BUTTON_NO_TOOLTIP      = 0x00800000 # disable the tooltip
70
71IE_GUI_BUTTON_PORTRAIT    = IE_GUI_BUTTON_PLAYONCE|IE_GUI_BUTTON_PLAYALWAYS|IE_GUI_BUTTON_PICTURE
72
73#label flags
74IE_GUI_LABEL_USE_COLOR = 1
75
76#scrollbar flags
77IE_GUI_SCROLLBAR_DEFAULT = 0x00000040   # mousewheel triggers it (same value as default button)
78
79#textarea flags
80IE_GUI_TEXTAREA_AUTOSCROLL = 1
81IE_GUI_TEXTAREA_HISTORY = 2
82IE_GUI_TEXTAREA_EDITABLE = 4
83
84# TextArea font colors, see TextArea.h
85TA_COLOR_NORMAL = 0
86TA_COLOR_INITIALS = 1
87TA_COLOR_BACKGROUND = 2
88TA_COLOR_OPTIONS = 3
89TA_COLOR_HOVER = 4
90TA_COLOR_SELECTED = 5
91
92ColorWhite = {'r' : 255, 'g' : 255, 'b' : 255, 'a' : 255}
93ColorWhitish = {'r' : 215, 'g' : 215, 'b' : 215, 'a' : 255}
94ColorRed = {'r' : 255, 'g' : 0, 'b' : 0, 'a' : 255}
95
96#TextEdit
97IE_GUI_TEXTEDIT_ALPHACHARS = 1
98IE_GUI_TEXTEDIT_NUMERIC = 2
99
100#gui control types
101IE_GUI_BUTTON = 0
102IE_GUI_PROGRESS = 1
103IE_GUI_SLIDER = 2
104IE_GUI_EDIT = 3
105IE_GUI_TEXTAREA = 5
106IE_GUI_LABEL = 6
107IE_GUI_SCROLLBAR = 7
108IE_GUI_WORLDMAP = 8
109IE_GUI_MAP = 9
110IE_GUI_CONSOLE = 10
111IE_GUI_VIEW = 254
112
113GEM_MB_ACTION               = 1
114GEM_MB_MENU                 = 4
115
116IE_ACT_MOUSE_PRESS   = 0
117IE_ACT_MOUSE_DRAG    = 1
118IE_ACT_MOUSE_OVER    = 2
119IE_ACT_MOUSE_ENTER   = 3
120IE_ACT_MOUSE_LEAVE   = 4
121IE_ACT_VALUE_CHANGE  = 5
122IE_ACT_DRAG_DROP_CRT = 6
123IE_ACT_DRAG_DROP_SRC = 7
124IE_ACT_DRAG_DROP_DST = 8
125IE_ACT_CUSTOM        = 9
126
127#events
128IE_GUI_BUTTON_ON_PRESS      = 0x00000000
129IE_GUI_MOUSE_ENTER_BUTTON   = 0x00000001
130IE_GUI_MOUSE_LEAVE_BUTTON   = 0x00000002
131IE_GUI_BUTTON_ON_SHIFT_PRESS= 0x00000003
132IE_GUI_BUTTON_ON_RIGHT_PRESS= 0x00000004
133IE_GUI_BUTTON_ON_DOUBLE_PRESS = 0x00000007
134IE_GUI_PROGRESS_END_REACHED = IE_ACT_CUSTOM
135IE_GUI_SLIDER_ON_CHANGE     = 0x02000000
136IE_GUI_EDIT_ON_CHANGE       = 0x03000000
137IE_GUI_EDIT_ON_DONE         = 0x03000001
138IE_GUI_EDIT_ON_CANCEL       = 0x03000002
139IE_GUI_TEXTAREA_ON_CHANGE   = IE_ACT_VALUE_CHANGE
140IE_GUI_TEXTAREA_ON_SELECT   = IE_ACT_CUSTOM
141IE_GUI_LABEL_ON_PRESS       = 0x06000000
142IE_GUI_SCROLLBAR_ON_CHANGE  = 0x07000000
143IE_GUI_WORLDMAP_ON_PRESS    = 0x08000000
144IE_GUI_MAP_ON_PRESS         = 0x09000000
145IE_GUI_MAP_ON_RIGHT_PRESS   = 0x09000005
146
147#button states
148IE_GUI_BUTTON_ENABLED    = 0x00000000
149IE_GUI_BUTTON_UNPRESSED  = 0x00000000
150IE_GUI_BUTTON_PRESSED    = 0x00000001
151IE_GUI_BUTTON_SELECTED   = 0x00000002
152IE_GUI_BUTTON_DISABLED   = 0x00000003
153# Like DISABLED, but processes MouseOver events and draws UNPRESSED bitmap
154IE_GUI_BUTTON_LOCKED   = 0x00000004
155# Draws DISABLED bitmap, but it isn't disabled
156IE_GUI_BUTTON_FAKEDISABLED    = 0x00000005
157# Draws PRESSED bitmap, but it isn't shifted
158IE_GUI_BUTTON_FAKEPRESSED   = 0x00000006
159
160#mapcontrol states (add 0x090000000 if used with SetControlStatus)
161IE_GUI_MAP_NO_NOTES   =  0
162IE_GUI_MAP_VIEW_NOTES =  1
163IE_GUI_MAP_SET_NOTE   =  2
164IE_GUI_MAP_REVEAL_MAP =  3
165
166# !!! Keep these synchronized with Font.h !!!
167IE_FONT_ALIGN_LEFT       = 0x00
168IE_FONT_ALIGN_CENTER     = 0x01
169IE_FONT_ALIGN_RIGHT      = 0x02
170IE_FONT_ALIGN_BOTTOM     = 0x04
171IE_FONT_ALIGN_TOP        = 0x10
172IE_FONT_ALIGN_MIDDLE     = 0x20
173IE_FONT_SINGLE_LINE      = 0x40
174
175OP_SET = 0
176OP_AND = 1
177OP_OR = 2
178OP_XOR = 3
179OP_NAND = 4
180
181# Window position anchors/alignments
182# !!! Keep these synchronized with Window.h !!!
183WF_DRAGGABLE		= 0x01
184WF_BORDERLESS		= 0x02
185WF_DESTROY_ON_CLOSE	= 0x04
186WF_ALPHA_CHANNEL	= 0x08
187
188WINDOW_TOP			 = 0x01
189WINDOW_BOTTOM        = 0x02
190WINDOW_VCENTER	     = 0x03
191WINDOW_LEFT			 = 0x04
192WINDOW_RIGHT         = 0x08
193WINDOW_HCENTER       = 0xC
194WINDOW_CENTER		 = 0xF
195
196ACTION_WINDOW_CLOSED		= 0
197ACTION_WINDOW_FOCUS_GAINED	= 1
198ACTION_WINDOW_FOCUS_LOST	= 2
199
200# GameScreen flags
201GS_PARTYAI           = 1
202GS_SMALLDIALOG       = 0
203GS_MEDIUMDIALOG      = 2
204GS_LARGEDIALOG       = 6
205GS_DIALOGMASK        = 6
206GS_DIALOG            = 8
207GS_HIDEGUI           = 16
208GS_OPTIONPANE        = 32
209GS_PORTRAITPANE      = 64
210GS_MAPNOTE           = 128
211
212# GameControl screen flags
213# !!! Keep these synchronized with GameControl.h !!!
214SF_CENTERONACTOR     = 1
215SF_ALWAYSCENTER      = 2
216
217# GameControltarget modes
218# !!! Keep these synchronized with GameControl.h !!!
219TARGET_MODE_NONE    = 0
220TARGET_MODE_TALK    = 1
221TARGET_MODE_ATTACK  = 2
222TARGET_MODE_CAST    = 3
223TARGET_MODE_DEFEND  = 4
224TARGET_MODE_PICK    = 5
225
226GA_SELECT     = 16
227GA_NO_DEAD    = 32
228GA_POINT      = 64
229GA_NO_HIDDEN  = 128
230GA_NO_ALLY    = 256
231GA_NO_ENEMY   = 512
232GA_NO_NEUTRAL = 1024
233GA_NO_SELF    = 2048
234
235# Game features, for Interface::SetFeatures()
236# Defined in globals.h
237GF_ALL_STRINGS_TAGGED = 1
238
239# Shadow color for ShowModal()
240# !!! Keep these synchronized with Interface.h !!!
241MODAL_SHADOW_NONE = 0
242MODAL_SHADOW_GRAY = 1
243MODAL_SHADOW_BLACK = 2
244
245# character resource directories
246# !!! Keep these synchronized with Interface.h !!!
247CHR_PORTRAITS = 0
248CHR_SOUNDS = 1
249CHR_EXPORTS = 2
250CHR_SCRIPTS = 3
251
252# Flags for GameSelectPC()
253# !!! Keep these synchronized with Game.h !!!
254SELECT_NORMAL  = 0x00
255SELECT_REPLACE = 0x01
256SELECT_QUIET   = 0x02
257
258# Spell types
259# !!! Keep these synchronized with Spellbook.h !!!
260IE_SPELL_TYPE_PRIEST = 0
261IE_SPELL_TYPE_WIZARD = 1
262IE_SPELL_TYPE_INNATE = 2
263
264# IWD2 spell types
265IE_IWD2_SPELL_BARD = 0
266IE_IWD2_SPELL_CLERIC = 1
267IE_IWD2_SPELL_DRUID = 2
268IE_IWD2_SPELL_PALADIN = 3
269IE_IWD2_SPELL_RANGER = 4
270IE_IWD2_SPELL_SORCERER = 5
271IE_IWD2_SPELL_WIZARD = 6
272IE_IWD2_SPELL_DOMAIN = 7
273IE_IWD2_SPELL_INNATE = 8
274IE_IWD2_SPELL_SONG = 9
275IE_IWD2_SPELL_SHAPE = 10
276
277# Item Flags bits
278# !!! Keep these synchronized with Item.h !!!
279IE_ITEM_CRITICAL     = 0x00000001
280IE_ITEM_TWO_HANDED   = 0x00000002
281IE_ITEM_MOVABLE      = 0x00000004
282IE_ITEM_DISPLAYABLE  = 0x00000008
283IE_ITEM_CURSED       = 0x00000010
284IE_ITEM_NOT_COPYABLE = 0x00000020
285IE_ITEM_MAGICAL      = 0x00000040
286IE_ITEM_BOW          = 0x00000080
287IE_ITEM_SILVER       = 0x00000100
288IE_ITEM_COLD_IRON    = 0x00000200
289IE_ITEM_STOLEN       = 0x00000400
290IE_ITEM_CONVERSABLE  = 0x00000800
291IE_ITEM_PULSATING    = 0x00001000
292IE_ITEM_UNSELLABLE   = (IE_ITEM_CRITICAL | IE_ITEM_STOLEN)
293
294# CREItem (SlotItem) Flags bits
295# !!! Keep these synchronized with Inventory.h !!!
296IE_INV_ITEM_IDENTIFIED    = 0x01
297IE_INV_ITEM_UNSTEALABLE   = 0x02
298IE_INV_ITEM_STOLEN        = 0x04
299IE_INV_ITEM_STEEL         = 0x04 # pst only
300IE_INV_ITEM_UNDROPPABLE   = 0x08
301# GemRB extensions
302IE_INV_ITEM_ACQUIRED      = 0x10
303IE_INV_ITEM_DESTRUCTIBLE  = 0x20
304IE_INV_ITEM_EQUIPPED      = 0x40
305IE_INV_ITEM_STACKED       = 0x80
306# these come from the original item bits
307IE_INV_ITEM_CRITICAL      = 0x100
308IE_INV_ITEM_TWOHANDED     = 0x200
309IE_INV_ITEM_MOVABLE       = 0x400
310IE_INV_ITEM_UNKNOWN800    = 0x800
311IE_INV_ITEM_CURSED        = 0x1000
312IE_INV_ITEM_UNKNOWN2000   = 0x2000
313IE_INV_ITEM_MAGICAL       = 0x4000
314IE_INV_ITEM_BOW           = 0x8000
315IE_INV_ITEM_SILVER        = 0x10000
316IE_INV_ITEM_COLDIRON      = 0x20000
317IE_INV_ITEM_STOLEN2       = 0x40000
318IE_INV_ITEM_CONVERSABLE   = 0x80000
319IE_INV_ITEM_PULSATING     = 0x100000
320
321# !!! Keep this synchronized with Store.h !!!
322SHOP_BUY    = 1
323SHOP_SELL   = 2
324SHOP_ID     = 4
325SHOP_STEAL  = 8
326SHOP_SELECT = 0x40
327SHOP_NOREPADJ = 0x2000 # IE_STORE_NOREPADJ
328SHOP_FULL   = 0x10000 # IE_STORE_CAPACITY
329
330#game constants
331
332# !!! Keep this synchronized with Video.h !!!
333TOOLTIP_DELAY_FACTOR = 250
334
335#game strings
336STR_LOADMOS  = 0
337STR_AREANAME = 1
338STR_TEXTSCREEN = 2
339
340#game integers
341SV_BPP = 0
342SV_WIDTH = 1
343SV_HEIGHT = 2
344SV_GAMEPATH = 3
345SV_TOUCH = 4
346SV_SAVEPATH = 5
347
348# GUIEnhancements bits
349GE_SCROLLBARS = 1
350GE_TRY_IDENTIFY_ON_TRANSFER = 2
351GE_ALWAYS_OPEN_CONTAINER_ITEMS = 4
352
353# Log Levels
354# !!! Keep this synchronized with System/Logging.h !!!
355# no need for LOG_INTERNAL here since its internal to the logger class
356LOG_NONE = -1 # here just for the scripts, not needed in core
357LOG_FATAL = 0
358LOG_ERROR = 1
359LOG_WARNING = 2
360LOG_MESSAGE = 3
361LOG_COMBAT = 4
362LOG_DEBUG = 5
363
364# GetTableValue return modes
365GTV_STR = 0
366GTV_INT = 1
367GTV_STAT = 2
368GTV_REF = 3
369
370# UpdateActionsWindow action levels
371UAW_STANDARD = 0
372UAW_EQUIPMENT = 1
373UAW_SPELLS = 2
374UAW_INNATES = 3
375UAW_QWEAPONS = 4
376UAW_ALLMAGE = 5
377UAW_SKILLS = 6
378UAW_QSPELLS = 7
379UAW_QSHAPES = 8
380UAW_QSONGS = 9
381UAW_BOOK = 10
382UAW_2DASPELLS = 11
383UAW_SPELLS_DIRECT = 12
384UAW_QITEMS = 13
385
386# item extended header location field
387ITEM_LOC_WEAPON = 1  # show on quick weapon ability selection
388ITEM_LOC_EQUIPMENT = 3 # show on quick item ability selection
389
390# item function types
391ITM_F_DRINK = 1
392ITM_F_READ = 2
393ITM_F_CONTAINER = 4
394ITM_F_ABILITIES = 8
395