editors/ConfTreeNodeEditor.py
changeset 1743 c3c3d1318130
parent 1742 92932cd370a4
child 1744 69dfdb26f600
equal deleted inserted replaced
1742:92932cd370a4 1743:c3c3d1318130
    70             width = w
    70             width = w
    71         return width, height, False
    71         return width, height, False
    72 
    72 
    73     def DrawLabel(self, dc, width, height, dw=0, dy=0):
    73     def DrawLabel(self, dc, width, height, dw=0, dy=0):
    74         bmp = self.bmpLabel
    74         bmp = self.bmpLabel
    75         if bmp != None:     # if the bitmap is used
    75         if bmp is not None:     # if the bitmap is used
    76             if self.bmpDisabled and not self.IsEnabled():
    76             if self.bmpDisabled and not self.IsEnabled():
    77                 bmp = self.bmpDisabled
    77                 bmp = self.bmpDisabled
    78             if self.bmpFocus and self.hasFocus:
    78             if self.bmpFocus and self.hasFocus:
    79                 bmp = self.bmpFocus
    79                 bmp = self.bmpFocus
    80             if self.bmpSelected and not self.up:
    80             if self.bmpSelected and not self.up:
    81                 bmp = self.bmpSelected
    81                 bmp = self.bmpSelected
    82             bw, bh = bmp.GetWidth(), bmp.GetHeight()
    82             bw, bh = bmp.GetWidth(), bmp.GetHeight()
    83             if not self.up:
    83             if not self.up:
    84                 dw = dy = self.labelDelta
    84                 dw = dy = self.labelDelta
    85             hasMask = bmp.GetMask() != None
    85             hasMask = bmp.GetMask() is not None
    86         else:
    86         else:
    87             bw = bh = 0     # no bitmap -> size is zero
    87             bw = bh = 0     # no bitmap -> size is zero
    88 
    88 
    89         dc.SetFont(self.GetFont())
    89         dc.SetFont(self.GetFont())
    90         if self.IsEnabled():
    90         if self.IsEnabled():
    97         if not self.up:
    97         if not self.up:
    98             dw = dy = self.labelDelta
    98             dw = dy = self.labelDelta
    99 
    99 
   100         pos_x = (width-bw)/2+dw      # adjust for bitmap and text to centre
   100         pos_x = (width-bw)/2+dw      # adjust for bitmap and text to centre
   101         pos_y = (height-bh-th)/2+dy
   101         pos_y = (height-bh-th)/2+dy
   102         if bmp != None:
   102         if bmp is not None:
   103             dc.DrawBitmap(bmp, pos_x, pos_y, hasMask)  # draw bitmap if available
   103             dc.DrawBitmap(bmp, pos_x, pos_y, hasMask)  # draw bitmap if available
   104             pos_x = (width-tw)/2+dw      # adjust for bitmap and text to centre
   104             pos_x = (width-tw)/2+dw      # adjust for bitmap and text to centre
   105             pos_y += bh + 2
   105             pos_y += bh + 2
   106 
   106 
   107         dc.DrawText(label, pos_x, pos_y)      # draw the text
   107         dc.DrawText(label, pos_x, pos_y)      # draw the text