ui.gadgets.buttons: simplify.
parent
1431c33f1f
commit
ed98332263
|
@ -25,17 +25,17 @@ TUPLE: button < border pressed? selected? quot tooltip ;
|
||||||
: mouse-clicked? ( gadget -- ? )
|
: mouse-clicked? ( gadget -- ? )
|
||||||
hand-clicked get-global child? ;
|
hand-clicked get-global child? ;
|
||||||
|
|
||||||
|
: button-pressed? ( button -- ? )
|
||||||
|
{ [ mouse-clicked? ] [ button-rollover? ] } 1&&
|
||||||
|
buttons-down? and ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: button-update ( button -- )
|
: button-update ( button -- )
|
||||||
dup
|
dup button-pressed? >>pressed? relayout-1 ;
|
||||||
{ [ mouse-clicked? ] [ button-rollover? ] } 1&&
|
|
||||||
buttons-down? and
|
|
||||||
>>pressed?
|
|
||||||
relayout-1 ;
|
|
||||||
|
|
||||||
: button-enter ( button -- )
|
: button-enter ( button -- )
|
||||||
dup dup tooltip>> [ swap show-status ] [ drop ] if* button-update ;
|
dup tooltip>> [ over show-status ] when* button-update ;
|
||||||
|
|
||||||
: button-leave ( button -- )
|
: button-leave ( button -- )
|
||||||
[ hide-status ] [ button-update ] bi ;
|
[ hide-status ] [ button-update ] bi ;
|
||||||
|
|
Loading…
Reference in New Issue