resources/RooUsage.txt
[app.Builder.js] / tests / menu.vala
index a50daf0..8423e05 100644 (file)
@@ -18,187 +18,59 @@ int main (string[] args) {
     Gtk.init (ref args);
     
        GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); 
-       
-       var a  = new Xcls_WindowLeftTree();
-       a.el.show_all();
-       
-       Gtk.main();
+    new Xcls_Window();
 
-    
-       
+       Gtk.main();
        return 0;
 }
 
-public static Xcls_WindowLeftTree  WindowLeftTree;
-
-public class Xcls_WindowLeftTree : Object 
-{
-    public Gtk.Window el;
-    private Xcls_WindowLeftTree  _this;
-       public Xcls_button button;
-    public Xcls_LeftTreeMenu LeftTreeMenu;
-
-        // ctor 
-    public void init()
-    {
-                
-               this.el = new Gtk.Window(  );
-        _this = this;
-        WindowLeftTree = this;
+public class Xcls_Window : Object {
 
-        // my vars
 
-        // set gobject values
-        
-        var child_0 = new Xcls_button(); child_0.init(_this);
-        this.el.add (  child_0.el  );
-        _this.LeftTreeMenu = new Xcls_LeftTreeMenu();
-               _this.LeftTreeMenu.init();
-
-        // init method 
-         
-         
-    }
+       public Xcls_Window() {
+               var w = new Gtk.Window(  );
 
-    // skip xvala_id - not pipe 
-    public class Xcls_button : Object 
-    {
-        public Gtk.Button el;
-        private Xcls_WindowLeftTree  _this;
-            // ctor 
-        public void init(Xcls_WindowLeftTree _owner)
-        {
-                       
-                       this.el = new Gtk.Button.with_label ("Click me (0)");
-            _this = _owner;
-            _this.button = this;
-
-             
-
-            // listeners 
-            this.el.button_press_event.connect(   ( ev) => {
-                //console.log("button press?");
-            
-                
-                  if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
-                    //print("click" + ev.type);
-                    return false;
-                }
+               var b = new Gtk.Button.with_label ("Click me (0)");
+               w.add(b);
+               var leftmenu = new Gtk.Menu();
+       
+               b.button_press_event.connect(   ( ev) => {
+                   
+                   if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
+                       return false;
+                   }
  
-                    
-                 //_this.LeftTreeMenu.el.set_screen(Gdk.Screen.get_default());
-                 
-                 _this.LeftTreeMenu.el.popup(null, null, null,  ev.button, ev.time);
-                       
-                               //   print("click:" + res.path.to_string());
-                  return true;
-            } );
-            
-        }
-
-         
-    }
-
-
-
+                   leftmenu.popup(null, null, null,  ev.button, ev.time);
        
-    public class Xcls_LeftTreeMenu : Object 
-    {
-        public Gtk.Menu el;
-        private Xcls_WindowLeftTree  _this;
-
-
-            // my vars
-
-            // ctor 
-        public void init(Xcls_WindowLeftTree _owner)
-        {
-                       
-                       print("Xcls_LeftTreeMenu:Ctor called\n");
-            _this = _owner;
-                
-                       
-                       this.el = new Gtk.Menu();
-            _this.LeftTreeMenu = this;
-
-            // my vars
-
-            // set gobject values
-            var child_0 = new Xcls_MenuItem7();
-                       child_0.init(_this);
-                       this.el.append (  child_0.el  );
-                       
-            var child_1 = new Xcls_MenuItem8(_this);
-                       child_1.init(_this);
-            this.el.append (  child_1.el  );
-                       this.el.show_all();
-        }
-
-        
-    }
-    public class Xcls_MenuItem7 : Object 
-    {
-        public Gtk.MenuItem el;
-        private Xcls_WindowLeftTree  _this;
-
-
-            // my vars
-
-            // ctor 
-        
-               public void init(Xcls_WindowLeftTree  _owner) {
-        
-            _this = _owner;
-                
+                     return true;
+               } );
+
+
+               var child_0 = new Xcls_MenuItem7();
+               child_0.ref();
+               child_0.init(this);
+               leftmenu.append (  child_0.el  );
+               leftmenu.show_all();
+               w.show_all();
+
+       }
+       public class Xcls_MenuItem7 : Object  
+       {
+               public Gtk.MenuItem el;
+               public Xcls_Window _this;
+       
+               public void init(Xcls_Window _owner ) {
+                       //_this = _owner;
                        this.el = new Gtk.MenuItem.with_label("Delete Element");
-            // my vars
-
-            // set gobject values
-            //this.el.label = "Delete Element";
-                       
-            // listeners 
-
-                       print("add activate\n");
-            this.el.activate.connect(   ( ) => {
-                
-                print("SELECT?");
-                
+                       this.el.ref();
+                   print("add activate\n");
+                   this.el.activate.connect(   ( ) => {
+                       
+                       print("SELECT?");
+                       
                                return  ;
-            } );
-        }
-    }
-    public class Xcls_MenuItem8 : Object 
-    {
-        public Gtk.MenuItem el;
-        private Xcls_WindowLeftTree  _this;
-
-
-            // my vars
-
-            // ctor 
-        public void init(Xcls_WindowLeftTree _owner)
-        {
-                       
-                       this.el = new Gtk.MenuItem();
-            _this = _owner;
-
-            // my vars
-
-            // set gobject values
-            this.el.label = "Save as Template";
-
-            // listeners 
-            this.el.activate.connect(   () => {
-            
-                print("connect");  
-                
-            } );
-        }
+                   } );
+               }
 
-         
-    }
+       }
 }