parameters: (Window, Gears=None, CloseWindowCallback=None)
return_statement: return
docstring: Binds all of the basic controls and windows to the options pane.
docstring_summary: Binds all of the basic controls and windows to the options pane.
docstring_tokens: Binds all of the basic controls and windows to the options pane .
function: def SetupMenuWindowControls (Window, Gears=None, CloseWindowCallback=None):
  	"""Binds all of the basic controls and windows to the options pane."""
  
  	global ActionBarControlOffset
  
  	bg1 = GameCheck.IsBG1()
  	bg2 = GameCheck.IsBG2()
  	iwd1 = GameCheck.IsIWD1()
  	how = GameCheck.HasHOW()
  	iwd2 = GameCheck.IsIWD2()
  	pst = GameCheck.IsPST()
  	#store these instead of doing 50 calls...
  	
  	EscButton = Window.CreateButton (99, 0, 0, 0, 0);
  	EscButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CloseTopWindow)
  	EscButton.MakeEscape()
  
  	if iwd2: # IWD2 has one spellbook to rule them all
  		ActionBarControlOffset = 6 #portrait and action window were merged
  
  		InitOptionButton(Window, MageSpellsKey)
  
  		# AI
  		Button = InitOptionButton(Window, 'Toggle_AI')
  		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, AIPress)
  		AIPress (0) #this initialises the state and tooltip
  
  		# Select All
  		Button = InitOptionButton(Window, 'SelectAll', False)
  		Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUICommon.SelectAllOnPress)
  	elif pst: #pst has these three controls here instead of portrait pane
  		# (Un)Lock view on character
  		Button = InitOptionButton(Window, 'Follow', False)  # or 41648 Unlock ...
  		Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OnLockViewPress)
  		# AI
  		Button = InitOptionButton(Window, 'Toggle_AI')
  		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, AIPress)
  		AIPress(0) #this initialises the state and tooltip
  
  		# Message popup FIXME disable on non game screen...
  		Button = InitOptionButton(Window, 'Expand', False)# or 41661 Close ...
  
  	else: ## pst lacks this control here. it is on the clock. iwd2 seems to skip it
  		# Return to Game
  		Button = InitOptionButton(Window,'Return_To_Game')
  		
  		if bg1:
  			# enabled BAM isn't present in .chu, defining it here
  			Button.SetSprites ("GUILSOP", 0,16,17,28,16)
  		if iwd1:
  			# disabled/selected frame isn't present in .chu, defining it here
  			Button.SetSprites ("GUILSOP", 0,16,17,16,16)
  
  	# Party managment / character arbitration. Distinct form reform party window.
  	if not pst:
  		Button = Window.GetControl (OptionControl['Party'])
  		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, None) #TODO: OpenPartyWindow
  		if bg1 or bg2:
  			Button.SetState (IE_GUI_BUTTON_DISABLED)
  			Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_OR)
  		else:
  			Button.SetTooltip (OptionTip['Party'])
  
  	# Map
  	Button = InitOptionButton(Window, 'Map')
  	if bg1:
  		Button.SetSprites ("GUILSOP", 0,0,1,20,0)
  	if iwd1:
  		Button.SetSprites ("GUILSOP", 0,0,1,20,20)
  
  	# Journal
  	Button = InitOptionButton(Window, 'Journal')
  	if bg1:
  		Button.SetSprites ("GUILSOP", 0,4,5,22,4)
  	if iwd1:
  		Button.SetSprites ("GUILSOP", 0,4,5,22,22)
  
  	# Inventory
  	Button = InitOptionButton(Window, 'Inventory')
  	if bg1:
  		Button.SetSprites ("GUILSOP", 0,2,3,21,2)
  	if iwd1:
  		Button.SetSprites ("GUILSOP", 0,2,3,21,21)
  
  	# Records
  	Button = InitOptionButton(Window, CharacterStatsKey)
  	if bg1:
  		Button.SetSprites ("GUILSOP", 0,6,7,23,6)
  	if iwd1:
  		Button.SetSprites ("GUILSOP", 0,6,7,23,23)
  
  	if not iwd2: # All Other Games Have Fancy Distinct Spell Pages
  		# Mage
  		Button = InitOptionButton(Window, MageSpellsKey)
  		if bg1:
  			Button.SetSprites ("GUILSOP", 0,8,9,24,8)
  		if iwd1:
  			Button.SetSprites ("GUILSOP", 0,8,9,24,24)
  
  		# Priest
  		Button = InitOptionButton(Window, 'Priest_Spells')
  		if bg1:
  			Button.SetSprites ("GUILSOP", 0,10,11,25,10)
  		if iwd1:
  			Button.SetSprites ("GUILSOP", 0,10,11,25,25)
  
  	# Options
  	Button = InitOptionButton(Window, 'Options')
  	if bg1:
  		Button.SetSprites ("GUILSOP", 0,12,13,26,12)
  	if iwd1:
  		Button.SetSprites ("GUILSOP", 0,12,13,26,26)
  	ButtonOptionFrame = Button.GetFrame()
  
  	# pause button
  	if Gears:
  		if how: # how doesn't have this in the right place
  			pos = Window.GetFrame()["h"] - 71
  			Window.CreateButton (OptionControl['Time'], 0, pos, 64, 71)
  		CreateClockButton(Window.GetControl(OptionControl['Time']))
  
  		if iwd2:
  			rb = OptionControl['Rest']
  		else:
  			rb = 11
  	else:
  		rb = OptionControl['Rest']
  
  	# BG1 doesn't have a rest button on the main window, so this creates one
  	# from what would be the multiplayer arbitration control
  	if bg1:
  		Button = Window.GetControl (8)
  		Button.SetSprites("GUIRSBUT", 0,0,1,0,0)
  		Button.SetStatus (IE_GUI_BUTTON_ENABLED)
  		Button.SetSize(55,37)
  		Button.SetPos(4,359)
  		Button.SetFlags (IE_GUI_BUTTON_PICTURE, OP_SET)
  		rb = 8
  
  	# Rest
  	Button = Window.GetControl (rb)
  	if Button:
  		Button.SetTooltip (OptionTip['Rest'])
  		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RestPress)
  	elif rb == 11 and bg2:
  		#The 15 gap came from the guiw8.chu that is the network button
  		pos = ButtonOptionFrame["y"] + ButtonOptionFrame["h"] + 15
  		Button = Window.CreateButton (rb, ButtonOptionFrame["x"], pos, ButtonOptionFrame["w"], ButtonOptionFrame["h"])
  		Button.SetSprites ("GUIRSBUT", 0,0,1,0,0)
  		Button.SetTooltip (OptionTip['Rest'])
  		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RestPress)
  	return
function_tokens: def SetupMenuWindowControls ( Window , Gears = None , CloseWindowCallback = None ) : global ActionBarControlOffset bg1 = GameCheck . IsBG1 ( ) bg2 = GameCheck . IsBG2 ( ) iwd1 = GameCheck . IsIWD1 ( ) how = GameCheck . HasHOW ( ) iwd2 = GameCheck . IsIWD2 ( ) pst = GameCheck . IsPST ( ) #store these instead of doing 50 calls... EscButton = Window . CreateButton ( 99 , 0 , 0 , 0 , 0 ) EscButton . SetEvent ( IE_GUI_BUTTON_ON_PRESS , CloseTopWindow ) EscButton . MakeEscape ( ) if iwd2 : # IWD2 has one spellbook to rule them all ActionBarControlOffset = 6 #portrait and action window were merged InitOptionButton ( Window , MageSpellsKey ) # AI Button = InitOptionButton ( Window , 'Toggle_AI' ) Button . SetEvent ( IE_GUI_BUTTON_ON_PRESS , AIPress ) AIPress ( 0 ) #this initialises the state and tooltip # Select All Button = InitOptionButton ( Window , 'SelectAll' , False ) Button . SetEvent ( IE_GUI_BUTTON_ON_PRESS , GUICommon . SelectAllOnPress ) elif pst : #pst has these three controls here instead of portrait pane # (Un)Lock view on character Button = InitOptionButton ( Window , 'Follow' , False ) # or 41648 Unlock ... Button . SetEvent ( IE_GUI_BUTTON_ON_PRESS , OnLockViewPress ) # AI Button = InitOptionButton ( Window , 'Toggle_AI' ) Button . SetEvent ( IE_GUI_BUTTON_ON_PRESS , AIPress ) AIPress ( 0 ) #this initialises the state and tooltip # Message popup FIXME disable on non game screen... Button = InitOptionButton ( Window , 'Expand' , False ) # or 41661 Close ... else : ## pst lacks this control here. it is on the clock. iwd2 seems to skip it # Return to Game Button = InitOptionButton ( Window , 'Return_To_Game' ) if bg1 : # enabled BAM isn't present in .chu, defining it here Button . SetSprites ( "GUILSOP" , 0 , 16 , 17 , 28 , 16 ) if iwd1 : # disabled/selected frame isn't present in .chu, defining it here Button . SetSprites ( "GUILSOP" , 0 , 16 , 17 , 16 , 16 ) # Party managment / character arbitration. Distinct form reform party window. if not pst : Button = Window . GetControl ( OptionControl [ 'Party' ] ) Button . SetEvent ( IE_GUI_BUTTON_ON_PRESS , None ) #TODO: OpenPartyWindow if bg1 or bg2 : Button . SetState ( IE_GUI_BUTTON_DISABLED ) Button . SetFlags ( IE_GUI_BUTTON_NO_IMAGE , OP_OR ) else : Button . SetTooltip ( OptionTip [ 'Party' ] ) # Map Button = InitOptionButton ( Window , 'Map' ) if bg1 : Button . SetSprites ( "GUILSOP" , 0 , 0 , 1 , 20 , 0 ) if iwd1 : Button . SetSprites ( "GUILSOP" , 0 , 0 , 1 , 20 , 20 ) # Journal Button = InitOptionButton ( Window , 'Journal' ) if bg1 : Button . SetSprites ( "GUILSOP" , 0 , 4 , 5 , 22 , 4 ) if iwd1 : Button . SetSprites ( "GUILSOP" , 0 , 4 , 5 , 22 , 22 ) # Inventory Button = InitOptionButton ( Window , 'Inventory' ) if bg1 : Button . SetSprites ( "GUILSOP" , 0 , 2 , 3 , 21 , 2 ) if iwd1 : Button . SetSprites ( "GUILSOP" , 0 , 2 , 3 , 21 , 21 ) # Records Button = InitOptionButton ( Window , CharacterStatsKey ) if bg1 : Button . SetSprites ( "GUILSOP" , 0 , 6 , 7 , 23 , 6 ) if iwd1 : Button . SetSprites ( "GUILSOP" , 0 , 6 , 7 , 23 , 23 ) if not iwd2 : # All Other Games Have Fancy Distinct Spell Pages # Mage Button = InitOptionButton ( Window , MageSpellsKey ) if bg1 : Button . SetSprites ( "GUILSOP" , 0 , 8 , 9 , 24 , 8 ) if iwd1 : Button . SetSprites ( "GUILSOP" , 0 , 8 , 9 , 24 , 24 ) # Priest Button = InitOptionButton ( Window , 'Priest_Spells' ) if bg1 : Button . SetSprites ( "GUILSOP" , 0 , 10 , 11 , 25 , 10 ) if iwd1 : Button . SetSprites ( "GUILSOP" , 0 , 10 , 11 , 25 , 25 ) # Options Button = InitOptionButton ( Window , 'Options' ) if bg1 : Button . SetSprites ( "GUILSOP" , 0 , 12 , 13 , 26 , 12 ) if iwd1 : Button . SetSprites ( "GUILSOP" , 0 , 12 , 13 , 26 , 26 ) ButtonOptionFrame = Button . GetFrame ( ) # pause button if Gears : if how : # how doesn't have this in the right place pos = Window . GetFrame ( ) [ "h" ] - 71 Window . CreateButton ( OptionControl [ 'Time' ] , 0 , pos , 64 , 71 ) CreateClockButton ( Window . GetControl ( OptionControl [ 'Time' ] ) ) if iwd2 : rb = OptionControl [ 'Rest' ] else : rb = 11 else : rb = OptionControl [ 'Rest' ] # BG1 doesn't have a rest button on the main window, so this creates one # from what would be the multiplayer arbitration control if bg1 : Button = Window . GetControl ( 8 ) Button . SetSprites ( "GUIRSBUT" , 0 , 0 , 1 , 0 , 0 ) Button . SetStatus ( IE_GUI_BUTTON_ENABLED ) Button . SetSize ( 55 , 37 ) Button . SetPos ( 4 , 359 ) Button . SetFlags ( IE_GUI_BUTTON_PICTURE , OP_SET ) rb = 8 # Rest Button = Window . GetControl ( rb ) if Button : Button . SetTooltip ( OptionTip [ 'Rest' ] ) Button . SetEvent ( IE_GUI_BUTTON_ON_PRESS , RestPress ) elif rb == 11 and bg2 : #The 15 gap came from the guiw8.chu that is the network button pos = ButtonOptionFrame [ "y" ] + ButtonOptionFrame [ "h" ] + 15 Button = Window . CreateButton ( rb , ButtonOptionFrame [ "x" ] , pos , ButtonOptionFrame [ "w" ] , ButtonOptionFrame [ "h" ] ) Button . SetSprites ( "GUIRSBUT" , 0 , 0 , 1 , 0 , 0 ) Button . SetTooltip ( OptionTip [ 'Rest' ] ) Button . SetEvent ( IE_GUI_BUTTON_ON_PRESS , RestPress ) return