Add hovering to MenuItem.
This commit is contained in:
parent
2b1445be6c
commit
5714396e34
@ -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')
|
||||
|
@ -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':
|
||||
|
Loading…
Reference in New Issue
Block a user