class Window(object): def SetClickEvent(self, event): self.clickEvent = __mem_func__(event) def OnMouseLeftButtonDown(self): if self.clickEvent: self.clickEvent() def NoneMethod(cls): pass NoneMethod = classmethod(NoneMethod) def __init__(self, layer = "UI"): self.clickEvent = None self.hWnd = None self.parentWindow = 0 self.onMouseLeftButtonUpEvent = None self.RegisterWindow(layer) self.Hide() def __del__(self): wndMgr.Destroy(self.hWnd) def RegisterWindow(self, layer): self.hWnd = wndMgr.Register(self, layer) def Destroy(self): pass def GetWindowHandle(self): return self.hWnd def AddFlag(self, style): wndMgr.AddFlag(self.hWnd, style) def IsRTL(self): return wndMgr.IsRTL(self.hWnd) def SetWindowName(self, Name): wndMgr.SetName(self.hWnd, Name) def GetWindowName(self): return wndMgr.GetName(self.hWnd) def SetParent(self, parent): wndMgr.SetParent(self.hWnd, parent.hWnd) def SetParentProxy(self, parent): self.parentWindow=proxy(parent) wndMgr.SetParent(self.hWnd, parent.hWnd) def GetParentProxy(self): return self.parentWindow def SetPickAlways(self): wndMgr.SetPickAlways(self.hWnd) def SetWindowHorizontalAlignLeft(self): wndMgr.SetWindowHorizontalAlign(self.hWnd, wndMgr.HORIZONTAL_ALIGN_LEFT) def SetWindowHorizontalAlignCenter(self): wndMgr.SetWindowHorizontalAlign(self.hWnd, wndMgr.HORIZONTAL_ALIGN_CENTER) def SetWindowHorizontalAlignRight(self): wndMgr.SetWindowHorizontalAlign(self.hWnd, wndMgr.HORIZONTAL_ALIGN_RIGHT) def SetWindowVerticalAlignTop(self): wndMgr.SetWindowVerticalAlign(self.hWnd, wndMgr.VERTICAL_ALIGN_TOP) def SetWindowVerticalAlignCenter(self): wndMgr.SetWindowVerticalAlign(self.hWnd, wndMgr.VERTICAL_ALIGN_CENTER) def SetWindowVerticalAlignBottom(self): wndMgr.SetWindowVerticalAlign(self.hWnd, wndMgr.VERTICAL_ALIGN_BOTTOM) def SetTop(self): wndMgr.SetTop(self.hWnd) def Show(self): wndMgr.Show(self.hWnd) def Hide(self): wndMgr.Hide(self.hWnd) def Lock(self): wndMgr.Lock(self.hWnd) def Unlock(self): wndMgr.Unlock(self.hWnd) def IsShow(self): return wndMgr.IsShow(self.hWnd) def UpdateRect(self): wndMgr.UpdateRect(self.hWnd) def SetSize(self, width, height): wndMgr.SetWindowSize(self.hWnd, width, height) def GetWidth(self): return wndMgr.GetWindowWidth(self.hWnd) def GetHeight(self): return wndMgr.GetWindowHeight(self.hWnd) def GetLocalPosition(self): return wndMgr.GetWindowLocalPosition(self.hWnd) def GetGlobalPosition(self): return wndMgr.GetWindowGlobalPosition(self.hWnd) def GetMouseLocalPosition(self): return wndMgr.GetMouseLocalPosition(self.hWnd) def GetRect(self): return wndMgr.GetWindowRect(self.hWnd) def SetPosition(self, x, y): wndMgr.SetWindowPosition(self.hWnd, x, y) def SetCenterPosition(self, x = 0, y = 0): self.SetPosition((wndMgr.GetScreenWidth() - self.GetWidth()) / 2 + x, (wndMgr.GetScreenHeight() - self.GetHeight()) / 2 + y) def IsFocus(self): return wndMgr.IsFocus(self.hWnd) def SetFocus(self): wndMgr.SetFocus(self.hWnd) def KillFocus(self): wndMgr.KillFocus(self.hWnd) def GetChildCount(self): return wndMgr.GetChildCount(self.hWnd) def IsIn(self): return wndMgr.IsIn(self.hWnd) def SetOnMouseLeftButtonUpEvent(self, event): self.onMouseLeftButtonUpEvent = event def OnMouseLeftButtonUp(self): if self.onMouseLeftButtonUpEvent: self.onMouseLeftButtonUpEvent()