MenuItem focuses on hover
Styles should remove MenuItem[hover] styling
This commit is contained in:
parent
8469962c90
commit
8432cc70da
10
menuitem.go
10
menuitem.go
@ -38,6 +38,8 @@ func NewIconMenuItem (icon tomo.Icon, text string) *MenuItem {
|
|||||||
box.Add(box.label)
|
box.Add(box.label)
|
||||||
|
|
||||||
box.SetInputMask(true)
|
box.SetInputMask(true)
|
||||||
|
box.OnMouseEnter(box.handleMouseEnter)
|
||||||
|
box.OnMouseLeave(box.handleMouseLeave)
|
||||||
box.OnButtonDown(box.handleButtonDown)
|
box.OnButtonDown(box.handleButtonDown)
|
||||||
box.OnButtonUp(box.handleButtonUp)
|
box.OnButtonUp(box.handleButtonUp)
|
||||||
box.OnKeyDown(box.handleKeyDown)
|
box.OnKeyDown(box.handleKeyDown)
|
||||||
@ -62,6 +64,14 @@ func (this *MenuItem) OnClick (callback func ()) event.Cookie {
|
|||||||
return this.on.click.Connect(callback)
|
return this.on.click.Connect(callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *MenuItem) handleMouseEnter () {
|
||||||
|
this.SetFocused(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *MenuItem) handleMouseLeave () {
|
||||||
|
this.SetFocused(false)
|
||||||
|
}
|
||||||
|
|
||||||
func (this *MenuItem) handleKeyDown (key input.Key, numberPad bool) bool {
|
func (this *MenuItem) handleKeyDown (key input.Key, numberPad bool) bool {
|
||||||
if key != input.KeyEnter && key != input.Key(' ') { return false }
|
if key != input.KeyEnter && key != input.Key(' ') { return false }
|
||||||
return true
|
return true
|
||||||
|
Loading…
Reference in New Issue
Block a user