class ExpandedImageBox(ImageBox):
def __init__(self, layer = "UI"):
ImageBox.__init__(self, layer)
self.eventFunc = {"mouse_click" : None, "mouse_over_in" : None, "mouse_over_out" : None}
self.eventArgs = {"mouse_click" : None, "mouse_over_in" : None, "mouse_over_out" : None}
def __del__(self):
ImageBox.__del__(self)
self.eventFunc = None
self.eventArgs = None
def RegisterWindow(self, layer):
self.hWnd = wndMgr.RegisterExpandedImageBox(self, layer)
def SetScale(self, xScale, yScale):
wndMgr.SetScale(self.hWnd, xScale, yScale)
def SetOrigin(self, x, y):
wndMgr.SetOrigin(self.hWnd, x, y)
def SetRotation(self, rotation):
wndMgr.SetRotation(self.hWnd, rotation)
def SetRenderingMode(self, mode):
wndMgr.SetRenderingMode(self.hWnd, mode)
def SetRenderingRect(self, left, top, right, bottom):
wndMgr.SetRenderingRect(self.hWnd, left, top, right, bottom)
def SetClipRect(self, left, top, right, bottom, isVertical = False):
wndMgr.SetClipRect(self.hWnd, left, top, right, bottom, isVertical)
def SetRenderingRect(self, left, top, right, bottom):
wndMgr.SetRenderingRect(self.hWnd, left, top, right, bottom)
def SetPercentage(self, curValue, maxValue):
if maxValue:
self.SetRenderingRect(0.0, 0.0, -1.0 + float(curValue) / float(maxValue), 0.0)
else:
self.SetRenderingRect(0.0, 0.0, 0.0, 0.0)
def GetWidth(self):
return wndMgr.GetWindowWidth(self.hWnd)
def GetHeight(self):
return wndMgr.GetWindowHeight(self.hWnd)
def SetEvent(self, func, *args) :
result = self.eventFunc.has_key(args[0])
if result :
self.eventFunc[args[0]] = func
self.eventArgs[args[0]] = args
else :
print "[ERROR] ui.py SetEvent, Can`t Find has_key : %s" % args[0]