tests/menu.vala
[app.Builder.js] / tests / menu.vala
1 /* -- to compile
2 valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0  \
3     menu.vala  -o /tmp/menutest
4 */
5
6
7 /* -- to test class
8 static int main (string[] args) {
9     Gtk.init (ref args);
10     new Xcls_WindowLeftTree();
11     WindowLeftTree.show_all();
12      Gtk.main ();
13     return 0;
14 }
15 */
16         
17 int main (string[] args) {
18     Gtk.init (ref args);
19     
20         GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); 
21
22
23         var w = new Gtk.Window(  );
24
25         var b = new Gtk.Button.with_label ("Click me (0)");
26
27         var leftmenu = new Gtk.Menu();
28         
29     b.button_press_event.connect(   ( ev) => {
30         
31         if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
32             return false;
33         }
34
35             
36         //leftmenu.el.set_screen(Gdk.Screen.get_default());
37          
38         leftmenu.popup(null, null, null,  ev.button, ev.time);
39         
40           return true;
41     } );
42
43
44         var child_0 = new Xcls_MenuItem7();
45         child_0.init();
46         leftmenu.append (  child_0.el  );
47         
48         Gtk.main();
49 }
50 public class Xcls_MenuItem7 : Object  
51 {
52     public Gtk.MenuItem el;
53  
54         public void init( ) {
55  
56          
57                 this.el = new Gtk.MenuItem.with_label("Delete Element");
58         print("add activate\n");
59         this.el.activate.connect(   ( ) => {
60             
61             print("SELECT?");
62             
63                         return  ;
64         } );
65     }
66
67 }
68