def invalidate_frame(self, rect): # Below is a logic to invalidate just the frame, not the whole rect. # This is to fight flicker. A better fix is to use double buffering. # If fixed, all of this could be just: self.invalidate_rect(rect) w, h = rect_size(rect) topleft = rect_topleft(rect) topright = add_pt(topleft, (w-1, 0)) botleft = add_pt(topleft, (0, h-1)) self.invalidate_rect(rect_sized(topleft, (1, h))) self.invalidate_rect(rect_sized(topleft, (w, 1))) self.invalidate_rect(rect_sized(topright, (1, h))) self.invalidate_rect(rect_sized(botleft, (w, 1)))
def global_to_local(self, g): win = self._win q = win.ScreenToClient(g) return add_pt(q, win.GetScrollPosition())
def local_to_container(self, p): if self._has_local_coords: return add_pt(p, self.local_to_container_offset()) else: return p
def set_content_size(self, size): self.size = add_pt(size, self._win_content_size_adjustment())
def scroll_by(self, dx, dy): """Scroll by the given amount horizontally and vertically.""" self.scroll_offset = add_pt(self.scroll_offset, (dx, dy))
def global_to_local(self, g): q = self._win.ScreenToClient(g) return add_pt(q, self.scroll_offset)
def scroll_by(self, dx, dy): """Scroll by the given amount horizontally and vertically.""" self.scroll_offset = add_pt(self.scroll_offset, (dx, dy))
def global_to_local(self, g): win = self._win q = win.ScreenToClient(g) return add_pt(q, win.GetScrollPosition())
def global_to_local(self, g): q = self._win.ScreenToClient(g) return add_pt(q, self.scroll_offset)
def set_content_size(self, size): self.size = add_pt(size, self._win_content_size_adjustment())
def local_to_container(self, p): if self._has_local_coords: return add_pt(p, self.local_to_container_offset()) else: return p