From ed98332263ac9c6eda5c7f0e2ba3069a5f070bfd Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 14 Jul 2015 15:43:58 -0700 Subject: [PATCH] ui.gadgets.buttons: simplify. --- basis/ui/gadgets/buttons/buttons.factor | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/basis/ui/gadgets/buttons/buttons.factor b/basis/ui/gadgets/buttons/buttons.factor index c768b26301..a8da106917 100644 --- a/basis/ui/gadgets/buttons/buttons.factor +++ b/basis/ui/gadgets/buttons/buttons.factor @@ -25,17 +25,17 @@ TUPLE: button < border pressed? selected? quot tooltip ; : mouse-clicked? ( gadget -- ? ) hand-clicked get-global child? ; +: button-pressed? ( button -- ? ) + { [ mouse-clicked? ] [ button-rollover? ] } 1&& + buttons-down? and ; + PRIVATE> : button-update ( button -- ) - dup - { [ mouse-clicked? ] [ button-rollover? ] } 1&& - buttons-down? and - >>pressed? - relayout-1 ; + dup button-pressed? >>pressed? relayout-1 ; : button-enter ( button -- ) - dup dup tooltip>> [ swap show-status ] [ drop ] if* button-update ; + dup tooltip>> [ over show-status ] when* button-update ; : button-leave ( button -- ) [ hide-status ] [ button-update ] bi ;