Go to the documentation of this file.00001 import BigWorld, GUI, Keys
00002
00003 from PyGUIBase import PyGUIBase
00004 from DraggableComponent import DraggableComponent
00005
00006 class Window( PyGUIBase ):
00007
00008 factoryString="PyGUI.Window"
00009
00010 def __init__( self, component ):
00011 PyGUIBase.__init__( self, component )
00012 component.script = self
00013
00014
00015 def onSave( self, dataSection ):
00016 PyGUIBase.onSave( self, dataSection )
00017
00018
00019 def onLoad( self, dataSection ):
00020 PyGUIBase.onLoad( self, dataSection )
00021
00022
00023 @staticmethod
00024 def create( texture ):
00025 c = GUI.Window( texture )
00026 return Window( c ).component
00027
00028 class EscapableWindow( Window ):
00029
00030 factoryString="PyGUI.EscapableWindow"
00031
00032 def __init__( self, component = None ):
00033 Window.__init__( self, component )
00034 component.script = self
00035 self.onEscape = None
00036
00037 def handleKeyEvent( self, down, key, modifiers ):
00038 if ( down ):
00039 if ( key == Keys.KEY_ESCAPE ) :
00040 if self.onEscape is not None:
00041 self.onEscape()
00042 return 1
00043 return 0
00044
00045 class DraggableWindow( Window, DraggableComponent ):
00046
00047 factoryString="PyGUI.DraggableWindow"
00048
00049 def __init__( self, component, horzDrag = True, vertDrag = True, restrictToParent = True ):
00050 Window.__init__( self, component )
00051 DraggableComponent.__init__( self, horzDrag, vertDrag, restrictToParent )
00052 component.script = self
00053 self.onBeginDrag = self._onBeginDrag
00054
00055
00056 def handleMouseButtonEvent( self, comp, key, down, modifiers ):
00057 return DraggableComponent.handleMouseButtonEvent( self, comp, key, down, modifiers )
00058
00059
00060 def onSave( self, dataSection ):
00061 DraggableComponent.onSave( self, dataSection )
00062 Window.onSave( self, dataSection )
00063
00064
00065 def onLoad( self, dataSection ):
00066 DraggableComponent.onLoad( self, dataSection )
00067 Window.onLoad( self, dataSection )
00068
00069
00070 def _onBeginDrag( self ):
00071 self.listeners.onBeginDrag()
00072
00073
00074 @staticmethod
00075 def create( texture ):
00076 c = GUI.Window( texture )
00077 return DraggableWindow( c ).component
00078