Revision: 4391 http://vexi.svn.sourceforge.net/vexi/?rev=4391&view=rev Author: clrg Date: 2012-05-31 12:11:05 +0000 (Thu, 31 May 2012) Log Message: ----------- Context menus provide their own widgets
Modified Paths: -------------- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/contextable.t trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/text/contextmenu.t Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/contextable.t =================================================================== --- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/contextable.t 2012-05-31 12:10:10 UTC (rev 4390) +++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/contextable.t 2012-05-31 12:11:05 UTC (rev 4391) @@ -16,14 +16,7 @@ var model = trapee.surface.popup; var popup = new .submenu(); popup.popdownOnExternalEvent = true; - for (var i,action in actions) { - var item = new .menuitem(); - item.text = action.text; - item.action ++= function(v) { - cascade = v; - model.pop(popup, false); - } - item.action ++= action.action; + for (var i,item in actions) { popup.add(item); } popup.v_popbox.visible ++= function(v) { Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/text/contextmenu.t =================================================================== --- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/text/contextmenu.t 2012-05-31 12:10:10 UTC (rev 4390) +++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/text/contextmenu.t 2012-05-31 12:11:05 UTC (rev 4391) @@ -1,9 +1,10 @@ <!-- Copyright 2012 - see COPYING for details [LGPL] --> <vexi xmlns:ui="vexi://ui" - xmlns="org.vexi.lib.role"> + xmlns:role="org.vexi.lib.role" + xmlns="vexi"> - <contextable /> + <role:contextable /> <ui:box> thisbox.contextActions ++= static.getContext; @@ -11,16 +12,39 @@ </ui:box> static.getContext = function() { - var widget = trapee; + var edit = trapee.v_edit; return [ - { + new .widget.menuitem({ + text: "Cut", + icon: .icon.cut, + action: function(v) { cascade = v; edit.cut(); } + }), + new .widget.menuitem({ text: "Copy", - action: function(v) { cascade = v; vexi.trace("Copy!"); widget.KeyPressed = "C-c"; } - }, - { + icon: .icon.copy, + action: function(v) { cascade = v; edit.copy(); } + }), + new .widget.menuitem({ text: "Paste", - action: function(v) { cascade = v; vexi.trace("Paste!"); widget.KeyPressed = "C-v"; } - } + icon: .icon.paste, + action: function(v) { cascade = v; edit.paste(); } + }), + new .widget.separator(), + new .widget.menuitem({ + text: "Cut all", + icon: .icon.cut, + action: function(v) { cascade = v; edit.cutAll(); } + }), + new .widget.menuitem({ + text: "Copy all", + icon: .icon.copy, + action: function(v) { cascade = v; edit.copyAll(); } + }), + new .widget.menuitem({ + text: "Select all", + icon: .icon.select, + action: function(v) { cascade = v; edit.selectAll(); } + }) ]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn