Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.15 KB | None | 0 0
  1. class TitleBar(Window):
  2.  
  3.     BLOCK_WIDTH = 32
  4.     BLOCK_HEIGHT = 23
  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 locale.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("d:/ymir work/ui/public/close_button_01.sub")
  45.         btnClose.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub")
  46.         btnClose.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub")
  47.         btnClose.SetToolTipText(locale.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) - self.BLOCK_WIDTH) / self.BLOCK_WIDTH, 0.0)
  59.         self.imgCenter.SetPosition(self.BLOCK_WIDTH, 0)
  60.         self.imgRight.SetPosition(width - self.BLOCK_WIDTH, 0)
  61.  
  62.         if locale.IsARABIC():
  63.             self.btnClose.SetPosition(3, 3)
  64.         else:
  65.             self.btnClose.SetPosition(width - self.btnClose.GetWidth() - 3, 3)
  66.            
  67.         self.SetSize(width, self.BLOCK_HEIGHT)
  68.  
  69.     def SetCloseEvent(self, event):
  70.         self.btnClose.SetEvent(event)
  71.  
  72.     def CloseButtonHide(self) :
  73.         self.imgRight.LoadImage("d:/ymir work/ui/pattern/titlebar_right_02.tga")
  74.         self.btnClose.Hide()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement