Revision: 4388
          http://vexi.svn.sourceforge.net/vexi/?rev=4388&view=rev
Author:   clrg
Date:     2012-05-31 02:05:33 +0000 (Thu, 31 May 2012)
Log Message:
-----------
Right click copy/paste menu for text widgets

Added 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

Added: 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        
                        (rev 0)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/role/contextable.t        
2012-05-31 02:05:33 UTC (rev 4388)
@@ -0,0 +1,41 @@
+<!-- Copyright 2012 - see COPYING for details [LGPL] -->
+
+<vexi xmlns:ui="vexi://ui"
+      xmlns="vexi.widget">
+    
+    <ui:box>
+        
+        thisbox.Press2 ++= static.popupContext;
+        
+    </ui:box>
+    
+    static.popupContext = function(p) {
+        cascade = p;
+        var actions = trapee.contextActions;
+        if (actions != null and actions.length>1) {
+            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;
+                popup.add(item);
+            }
+            popup.v_popbox.visible ++= function(v) {
+                cascade = v;
+                if (!v) model.delPopBox(popup);
+            }
+            var m = trapee.surface.frame.mouse;
+            popup.v_popbox.surface_x = m.x;
+            popup.v_popbox.surface_y = m.y;
+            model.addPopBox(popup);
+            model.pop(popup, true);
+        }
+    }
+    
+</vexi>

Added: 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        
                        (rev 0)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/text/contextmenu.t        
2012-05-31 02:05:33 UTC (rev 4388)
@@ -0,0 +1,27 @@
+<!-- Copyright 2012 - see COPYING for details [LGPL] -->
+
+<vexi xmlns:ui="vexi://ui"
+      xmlns="org.vexi.lib.role">
+    
+    <contextable />
+    <ui:box>
+        
+        thisbox.contextActions ++= static.getContext;
+        
+    </ui:box>
+    
+    static.getContext = function() {
+        var widget = trapee;
+        return [
+            {
+                text: "Copy",
+                action: function(v) { cascade = v; vexi.trace("Copy!"); 
widget.KeyPressed = "C-c"; }
+            },
+            {
+                text: "Paste",
+                action: function(v) { cascade = v; vexi.trace("Paste!"); 
widget.KeyPressed = "C-v"; }
+            }
+        ];
+    }
+    
+</vexi>

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

Reply via email to