Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. class TitleBar(Window):
  2.  
  3. BLOCK_WIDTH = 77
  4. BLOCK_HEIGHT = 36
  5.  
  6. def __init__(self):
  7. Window.__init__(self)
  8. self.AddFlag("attach")
  9.  
  10. def __del__(self):
  11. Window.__del__(self)
  12.  
  13. def MakeTitleBar(self, width, color):
  14.  
  15. ## ???? Color?? ??????? ???? ????
  16.  
  17. width = max(64, width)
  18.  
  19. imgLeft = ImageBox()
  20. imgCenter = ExpandedImageBox()
  21. imgRight = ImageBox()
  22. imgLeft.AddFlag("not_pick")
  23. imgCenter.AddFlag("not_pick")
  24. imgRight.AddFlag("not_pick")
  25. imgLeft.SetParent(self)
  26. imgCenter.SetParent(self)
  27. imgRight.SetParent(self)
  28.  
  29. if localeInfo.IsARABIC():
  30. imgLeft.LoadImage("locale/ae/ui/pattern/titlebar_left.tga")
  31. imgCenter.LoadImage("locale/ae/ui/pattern/titlebar_center.tga")
  32. imgRight.LoadImage("locale/ae/ui/pattern/titlebar_right.tga")
  33. else:
  34. imgLeft.LoadImage("d:/ymir work/ui/pattern/titlebar_left.tga")
  35. imgCenter.LoadImage("d:/ymir work/ui/pattern/titlebar_center.tga")
  36. imgRight.LoadImage("d:/ymir work/ui/pattern/titlebar_right.tga")
  37.  
  38. imgLeft.Show()
  39. imgCenter.Show()
  40. imgRight.Show()
  41.  
  42. btnClose = Button()
  43. btnClose.SetParent(self)
  44. btnClose.SetUpVisual("interface/ui/close_01.tga")
  45. btnClose.SetOverVisual("interface/ui/close_02.tga")
  46. btnClose.SetDownVisual("interface/ui/close_03.tga")
  47. btnClose.SetToolTipText(localeInfo.UI_CLOSE, 0, -23)
  48. btnClose.Show()
  49.  
  50. self.imgLeft = imgLeft
  51. self.imgCenter = imgCenter
  52. self.imgRight = imgRight
  53. self.btnClose = btnClose
  54.  
  55. self.SetWidth(width)
  56.  
  57. def SetWidth(self, width):
  58. self.imgCenter.SetRenderingRect(0.0, 0.0, float((width - self.BLOCK_WIDTH*2) - 84) / 84, 0.0)
  59. self.imgCenter.SetPosition(self.BLOCK_WIDTH, 0)
  60. self.imgRight.SetPosition(width - self.BLOCK_WIDTH, 0)
  61.  
  62. if localeInfo.IsARABIC():
  63. self.btnClose.SetPosition(3, 3)
  64. else:
  65. self.btnClose.SetPosition(width - self.btnClose.GetWidth() - 25, 10)
  66.  
  67. self.SetSize(width, self.BLOCK_HEIGHT)
  68.  
  69. def SetCloseEvent(self, event):
  70. self.btnClose.SetEvent(event)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement