Add hovering to MenuItem.

This commit is contained in:
Tomeu Vizoso 2007-02-24 15:30:16 +01:00
parent 2b1445be6c
commit 5714396e34
2 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,7 @@ _system_colors = {
'label-text' : '#FFFFFF',
'desktop-background' : '#E2E2E3',
'menu-background' : '#000000',
'menu-background-hover' : '#424242',
'menu-separator' : '#D1D1D2',
'menu-border' : '#D1D1D2',
'button-normal' : '#FFFFFF',
@ -90,6 +91,7 @@ ENTRY_BORDER = SystemColor('entry-border')
LABEL_TEXT = SystemColor('label-text')
DESKTOP_BACKGROUND = SystemColor('desktop-background')
MENU_BACKGROUND = SystemColor('menu-background')
MENU_BACKGROUND_HOVER = SystemColor('menu-background-hover')
MENU_SEPARATOR = SystemColor('menu-separator')
MENU_BORDER = SystemColor('menu-border')
BUTTON_NORMAL = SystemColor('button-normal')

View File

@ -56,6 +56,14 @@ class MenuItem(hippo.CanvasBox):
self._canvas_text.props.color = color.LABEL_TEXT.get_int()
self._canvas_text.props.font_desc = font.DEFAULT.get_pango_desc()
self.append(self._canvas_text)
self.connect('motion-notify-event', self._motion_notify_event_cb)
def _motion_notify_event_cb(self, menu_item, event):
if event.detail == hippo.MOTION_DETAIL_ENTER:
self.props.background_color = color.MENU_BACKGROUND_HOVER.get_int()
elif event.detail == hippo.MOTION_DETAIL_LEAVE:
self.props.background_color = color.MENU_BACKGROUND.get_int()
def do_set_property(self, pspec, value):
if pspec.name == 'action-id':