Embed/unembed the menu on state changes, keeping it around

cause some weird drawing issues.

Redraw on palette size changes (patch by Benzea).
This commit is contained in:
Marco Pesenti Gritti
2007-08-11 12:16:49 +02:00
parent a85bc85a82
commit dcef110223
4 changed files with 29 additions and 5 deletions
+9 -4
View File
@@ -138,9 +138,9 @@ class Palette(gtk.Window):
self._separator = gtk.HSeparator()
self._secondary_box.pack_start(self._separator)
menu_box = gtk.VBox()
self._secondary_box.pack_start(menu_box)
menu_box.show()
self._menu_box = gtk.VBox()
self._secondary_box.pack_start(self._menu_box)
self._menu_box.show()
self._content = gtk.VBox()
self._secondary_box.pack_start(self._content)
@@ -154,7 +154,6 @@ class Palette(gtk.Window):
vbox.show()
self.menu = _Menu(self)
self.menu.embed(menu_box)
self.menu.show()
self.connect('enter-notify-event',
@@ -223,6 +222,10 @@ class Palette(gtk.Window):
else:
raise AssertionError
def do_size_allocate(self, allocation):
gtk.Window.do_size_allocate(self, allocation)
self.queue_draw()
def do_expose_event(self, event):
# We want to draw a border with a beautiful gap
if self._draw_gap:
@@ -428,8 +431,10 @@ class Palette(gtk.Window):
return
if state == self._PRIMARY:
self.menu.unembed()
self._secondary_box.hide()
elif state == self._SECONDARY:
self.menu.embed(self._menu_box)
self._secondary_box.show()
self._state = state