From 4ce72ddbfb364bffb0454a98e468e0906d442d3f Mon Sep 17 00:00:00 2001 From: Sankaranarayanan Viswanathan Date: Mon, 2 Nov 2015 22:24:36 -0500 Subject: [PATCH] Show persistent border on right clicking presentation gadgets --- .../presentations/presentations.factor | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/basis/ui/gadgets/presentations/presentations.factor b/basis/ui/gadgets/presentations/presentations.factor index 7218fa52a2..d542494096 100644 --- a/basis/ui/gadgets/presentations/presentations.factor +++ b/basis/ui/gadgets/presentations/presentations.factor @@ -1,13 +1,16 @@ ! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors kernel namespaces ui.commands ui.gadgets -ui.gadgets.buttons ui.gadgets.buttons.private ui.gadgets.menus -ui.gadgets.status-bar ui.gadgets.worlds ui.gestures -ui.operations ; +USING: accessors kernel memoize namespaces ui.commands ui.gadgets +ui.gadgets.borders ui.gadgets.buttons ui.gadgets.buttons.private +ui.gadgets.glass ui.gadgets.menus ui.gadgets.status-bar +ui.gadgets.theme ui.gadgets.worlds ui.gestures +ui.operations ui.pens.solid ; IN: ui.gadgets.presentations TUPLE: presentation < button object hook ; +TUPLE: presentation-menu < border presentation ; + : invoke-presentation ( presentation command -- ) [ [ dup hook>> call( presentation -- ) ] [ object>> ] bi ] dip invoke-command ; @@ -33,9 +36,26 @@ M: presentation ungraft* dup hand-gadget get-global child? [ dup hide-status ] when call-next-method ; +MEMO: selected-pen-boundary ( -- button-pen ) + roll-button-rollover-border dup dup f f ; + +>boundary ; +PRIVATE> + +: ( presentation target hook -- menu ) + presentation-menu new-border + swap >>presentation + { 0 0 } >>size ; + : show-presentation-menu ( presentation -- ) + setup-presentation dup [ ] [ object>> ] [ dup hook>> curry ] tri - show-operations-menu ; + show-menu ; + +M: presentation-menu hide-glass-hook + presentation>> button-pen-boundary >>boundary drop ; presentation H{ { T{ button-down f f 3 } [ show-presentation-menu ] }