X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=tests%2Fmenu.vala;h=8423e05d867cd24a9f0d1ad4bb678da33d9d0ab4;hb=f10e0933c16d3bea5bdd2bde43c8b149a2312b30;hp=b67fb2dbb263b198b7ea85f96b602755ba299ad2;hpb=465834889d8e4d8a2800945dc0692a219f9d0e5b;p=app.Builder.js diff --git a/tests/menu.vala b/tests/menu.vala index b67fb2dbb..8423e05d8 100644 --- a/tests/menu.vala +++ b/tests/menu.vala @@ -18,51 +18,59 @@ int main (string[] args) { Gtk.init (ref args); GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); + new Xcls_Window(); + Gtk.main(); + return 0; +} - var w = new Gtk.Window( ); +public class Xcls_Window : Object { - var b = new Gtk.Button.with_label ("Click me (0)"); - var leftmenu = new Gtk.Menu(); - - b.button_press_event.connect( ( ev) => { - - if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) { - return false; - } + public Xcls_Window() { + var w = new Gtk.Window( ); - - //leftmenu.el.set_screen(Gdk.Screen.get_default()); - - leftmenu.popup(null, null, null, ev.button, ev.time); + var b = new Gtk.Button.with_label ("Click me (0)"); + w.add(b); + var leftmenu = new Gtk.Menu(); - return true; - } ); + b.button_press_event.connect( ( ev) => { + + if (ev.type != Gdk.EventType.BUTTON_PRESS || ev.button != 3) { + return false; + } + + leftmenu.popup(null, null, null, ev.button, ev.time); + + 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(); - var child_0 = new Xcls_MenuItem7(); - child_0.init(); - leftmenu.append ( child_0.el ); + } + public class Xcls_MenuItem7 : Object + { + public Gtk.MenuItem el; + public Xcls_Window _this; - Gtk.main(); -} -public class Xcls_MenuItem7 : Object -{ - public Gtk.MenuItem el; - - public void init( ) { - - - this.el = new Gtk.MenuItem.with_label("Delete Element"); - print("add activate\n"); - this.el.activate.connect( ( ) => { - - print("SELECT?"); - - return ; - } ); - } + public void init(Xcls_Window _owner ) { + //_this = _owner; + this.el = new Gtk.MenuItem.with_label("Delete Element"); + this.el.ref(); + print("add activate\n"); + this.el.activate.connect( ( ) => { + + print("SELECT?"); + + return ; + } ); + } + } } -