def draw(self, surface): GridView.draw(self, surface) if self.can_scroll_up(): self.draw_scroll_up_button(surface) if self.can_scroll_down(): self.draw_scroll_down_button(surface)
def mouse_down(self, event): if self.scrolling: p = event.local if self.scroll_up_rect.collidepoint(p): self.scroll_up() return elif self.scroll_down_rect.collidepoint(p): self.scroll_down() return GridView.mouse_down(self, event)
def __init__(self, cell_size, nrows, ncols, scrolling=False, **kwds): GridView.__init__(self, cell_size, nrows, ncols, **kwds) self.scrolling = scrolling if scrolling: d = self.scroll_button_size #l = self.width #b = self.height self.width += d #self.scroll_up_rect = Rect(l, 0, d, d).inflate(-4, -4) #self.scroll_down_rect = Rect(l, b - d, d, d).inflate(-4, -4) self.scroll = 0
def __init__(self, cell_size, nrows, ncols, scrolling = False): GridView.__init__(self, cell_size, nrows, ncols) self.nrows = nrows self.ncols = ncols self.scrolling = scrolling if scrolling: d = self.scroll_button_size l = self.rect.width b = self.rect.height self.rect.width += d self.scroll_up_rect = Rect(l, 0, d, d).inflate(-4, -4) self.scroll_down_rect = Rect(l, b - d, d, d).inflate(-4, -4) self.scroll = 0
def __init__(self, cell_size, nrows, ncols, scrolling=False, **kwds): GridView.__init__(self, cell_size, nrows, ncols, **kwds) self.scrolling = scrolling if scrolling: d = self.scroll_button_size #l = self.width #b = self.height self.width += d #self.scroll_up_rect = Rect(l, 0, d, d).inflate(-4, -4) #self.scroll_down_rect = Rect(l, b - d, d, d).inflate(-4, -4) self.scroll = 0 self.dragging_hover = False self.scroll_rel = 0
def draw(self, surface): GridView.draw(self, surface) u = False d = False if self.can_scroll_up(): u = True self.draw_scroll_up_button(surface) if self.can_scroll_down(): d = True self.draw_scroll_down_button(surface) if u or d: self.draw_scrollbar(surface)
def mouse_down(self, event): if event.button == 1: if self.scrolling: p = event.local if self.scroll_up_rect().collidepoint(p): self.scroll_up() return elif self.scroll_down_rect().collidepoint(p): self.scroll_down() return if event.button == 4: self.scroll_up() if event.button == 5: self.scroll_down() GridView.mouse_down(self, event)