Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Window(object):
- def NoneMethod(cls):
- pass
- NoneMethod = classmethod(NoneMethod)
- def __init__(self, layer = "UI"):
- self.hWnd = None
- self.parentWindow = 0
- self.RegisterWindow(layer)
- self.clickEvent = None
- 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 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 GetLeft(self):
- (x, y) = self.GetLocalPosition()
- return x
- def GetRight(self):
- return self.GetLeft() + self.GetWidth()
- def GetTop(self):
- (x, y) = self.GetLocalPosition()
- return y
- def GetBottom(self):
- return self.GetTop() + self.GetHeight()
- def GetGlobalPosition(self):
- return wndMgr.GetWindowGlobalPosition(self.hWnd)
- def GetGlobalLeft(self):
- (x, y) = self.GetGlobalPosition()
- return x
- def GetGlobalRight(self):
- return self.GetGlobalLeft() + self.GetWidth()
- def GetGlobalTop(self):
- (x, y) = self.GetGlobalPosition()
- return y
- def GetGlobalBottom(self):
- return self.GetGlobalTop() + self.GetHeight()
- 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 SetClickEvent(self, event):
- self.clickEvent = __mem_func__(event)
- def OnMouseLeftButtonDown(self):
- if self.clickEvent:
- self.clickEvent()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement