示例#1
0
 def close_rect(self):
     border = self.border_width()
     rc = Rect(border, border, self.width(), self.caption_height())
     margin = self.system_control_margin()
     side = rc.height() - 2 * margin
     rc.set_top(rc.top() + margin)
     rc.set_bottom(rc.bottom() - margin)
     rc.set_left(rc.right() - side)
     rc.translate(-margin, 0)
     return rc
示例#2
0
 def draw_bitmap(self, *args):
     painter = self.painter
     if isinstance(args[0], int):
         x, y, bitmap = args
         rc = self.rc
         dst_rc = Rect(x + rc.left(), y + rc.top(), bitmap.width(),
                       bitmap.height())
         dst_rc = dst_rc.intersected(rc)
         src_rc = Rect(dst_rc)
         src_rc.translate(-rc.left() - x, -rc.top() - y)
         src_rc = src_rc.intersected(bitmap.rect())
         painter.drawImage(dst_rc.rc, bitmap.im, src_rc.rc)
     else:
         dst_rc, bitmap, src_rc = args
         painter.drawImage(dst_rc.rc, bitmap.im, src_rc.rc)