ColorToolButton, ToggleToolButton: do the drawing in the correct order - SL #4303

1. if the palette is up, draw the black background
2. draw the button itself
3. if the palette is up, draw the grey outline

Exactly as the ToolButton does.  Otherwise the outline is not visible.

Signed-off-by: Manuel Quiñones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
master
Manuel Quiñones 12 years ago
parent 4de6057e1b
commit 8a9d10cda7

@ -541,18 +541,20 @@ class ColorToolButton(Gtk.ToolItem):
def do_draw(self, cr):
child = self.get_child()
allocation = self.get_allocation()
if self._palette and self._palette.is_up():
invoker = self._palette.props.invoker
invoker.draw_rectangle(cr, self._palette)
allocation = self.get_allocation()
# draw a black background, has been done by the engine before
cr.set_source_rgb(0, 0, 0)
cr.rectangle(0, 0, allocation.width, allocation.height)
cr.paint()
Gtk.ToolButton.do_draw(self, cr)
Gtk.ToolItem.do_draw(self, cr)
if self._palette and self._palette.is_up():
invoker = self._palette.props.invoker
invoker.draw_rectangle(cr, self._palette)
return False
def __notify_change(self, widget, pspec):
self.notify(pspec.name)

@ -125,13 +125,8 @@ class ToggleToolButton(Gtk.ToggleToolButton):
getter=get_accelerator)
def do_draw(self, cr):
allocation = self.get_allocation()
child = self.get_child()
if self.palette and self.palette.is_up():
invoker = self.palette.props.invoker
invoker.draw_rectangle(cr, self.palette)
allocation = self.get_allocation()
# draw a black background, has been done by the engine before
cr.set_source_rgb(0, 0, 0)
@ -140,4 +135,10 @@ class ToggleToolButton(Gtk.ToggleToolButton):
Gtk.ToggleToolButton.do_draw(self, cr)
if self.palette and self.palette.is_up():
invoker = self.palette.props.invoker
invoker.draw_rectangle(cr, self.palette)
return False
palette = property(get_palette, set_palette)

Loading…
Cancel
Save