def _paint_arrow(widget, cr, angle): alloc = widget.get_allocation() arrow_size = style.TOOLBAR_ARROW_SIZE / 2 y = alloc.height - arrow_size x = (alloc.width - arrow_size) / 2 context = widget.get_style_context() context.add_class('toolitem') Gtk.render_arrow(context, cr, angle, x, y, arrow_size)
def __drawing_cb(self, widget, cr): if not self.props.lock_palette: return False alloc = widget.get_allocation() arrow_size = style.TOOLBAR_ARROW_SIZE / 2 y = alloc.height - arrow_size x = (alloc.width - arrow_size) / 2 context = widget.get_style_context() context.add_class('toolitem') if self.locked: Gtk.render_arrow(context, cr, 0, x, y, arrow_size) else: Gtk.render_arrow(context, cr, math.pi, x, y, arrow_size)
def draw_pos(self, cr): cr.save() sc = self.get_style_context() horizontal = self.orientation == Gtk.Orientation.HORIZONTAL x, y = self.position - self.size // 4, self.size // 2 - 2 x, y = (x, y) if horizontal else (y, x) Gtk.render_arrow(sc, cr, pi if horizontal else pi / 2, x, y, # we need to ensure the arrow size is even, # so it doesn't get blurrified (self.size + (-self.size % 4)) // 2) cr.restore()