Let the invoker deal with popup/popdown redraw.

This commit is contained in:
Marco Pesenti Gritti
2007-08-15 21:18:58 +02:00
parent 43fb1627a7
commit 4f1986e8a4
4 changed files with 19 additions and 21 deletions
+19
View File
@@ -398,6 +398,9 @@ class Palette(gtk.Window):
self.menu.set_active(True)
self.show()
if self._invoker:
self._invoker.notify_popup()
self._up = True
_palette_observer.emit('popup', self)
self.emit('popup')
@@ -406,9 +409,13 @@ class Palette(gtk.Window):
if not self._palette_popup_sid is None:
_palette_observer.disconnect(self._palette_popup_sid)
self._palette_popup_sid = None
self.menu.set_active(False)
self.hide()
if self._invoker:
self._invoker.notify_popdown()
self._up = False
self.emit('popdown')
@@ -543,6 +550,12 @@ class Invoker(gobject.GObject):
height = gtk.gdk.screen_height()
return gtk.gdk.Rectangle(0, 0, width, height)
def notify_popup(self):
pass
def notify_popdown(self):
pass
class WidgetInvoker(Invoker):
def __init__(self, widget):
Invoker.__init__(self)
@@ -602,6 +615,12 @@ class WidgetInvoker(Invoker):
def get_toplevel(self):
return self._widget.get_toplevel()
def notify_popup(self):
self._widget.queue_draw()
def notify_popdown(self):
self._widget.queue_draw()
class CanvasInvoker(Invoker):
def __init__(self, item):
Invoker.__init__(self)