5a575ffa1b42edc90264753fb4dd536df71a164b
[app.Builder.js] / oldbuilder / LeftTopPanel.js
1 //<Script type="text/javascript">
2 Gio = imports.gi.Gio;
3 Gtk = imports.gi.Gtk;
4 Gdk = imports.gi.Gdk;
5 Pango = imports.gi.Pango ;
6 GObject = imports.gi.GObject;
7
8 XObject = imports.XObject.XObject;
9 console = imports.console;
10
11 ProjectManager      = imports.Builder.Provider.ProjectManager.ProjectManager; 
12 LeftProjectTree     = imports.Builder.LeftProjectTree.LeftProjectTree;
13 LeftTree            = imports.Builder.LeftTree.LeftTree;
14
15 // vbox
16
17
18 // expander
19 // notebook
20
21 LeftTopPanel = new XObject({
22         
23         xtype : Gtk.VBox,
24         
25         items : [
26             
27             {
28                 id : 'expander',
29                 xtype : Gtk.Expander,
30                 
31                 label : 'Project Tree',
32                 pack : ['pack_start', false , true ], // expand // fill.
33                 init : function(){
34                     XObject.prototype.init.call(this); 
35                     this.el.add_events (Gdk.EventMask.BUTTON_MOTION_MASK );
36                 },
37                 listeners : {
38                     
39                     activate : function () 
40                     {
41                         var nb = LeftTopPanel.get('notebook');
42                         if (this.el.expanded) {
43                             // now expanded..
44                             var pm  = ProjectManager;
45                             
46                            
47                             var model = LeftProjectTree.get('combomodel');
48                             
49                             model.loadData(ProjectManager.projects);
50                              
51                             
52                             nb.el.set_current_page(1);
53                             //pm.on('changed', function() {
54                                 //console.log("CAUGHT project manager change");
55                             //    _combo.model.loadData(pm.projects);
56                             //}
57                             return;
58                         }
59                         nb.el.set_current_page(0);
60                         
61                        //Seed.print("ACTIVATE?");
62                        // var pm  = Builder.Provider.ProjectManager;
63                        // _combo.model.loadData(pm.projects);
64                        // pm.on('changed', function() {
65                        //     console.log("CAUGHT project manager change");
66                        //    _combo.model.loadData(pm.projects);
67                         //});
68                        // this.items[0].el[this.get_expanded() ? 'hide' : 'show']();
69                     },
70                     'enter-notify-event' : function (w,e)
71                     {
72                         
73                         //console.log("enter!");
74                         this.el.expanded = !this.el.expanded;
75                         //if (this.el.expanded ) {
76                             this.listeners.activate.call(this);
77                         //   }
78                         
79                        return true;
80                     }
81                     
82                 },
83             },
84             {
85                     
86                 xtype : Gtk.Notebook,
87                 id: 'notebook',
88                 label : 'Project Tree',
89                 'show-border' : false,
90                 'show-tabs' : false,
91                 pack : ['pack_start', true , true ], // expand // fill.
92                 
93                 init : function()
94                 {
95                     XObject.prototype.init.call(this); 
96                     this.el.set_current_page(0);
97                 },
98                 
99                 items :  [
100                     LeftTree,
101                     LeftProjectTree
102                     
103                 ]
104             }
105             
106         ]
107     }
108 );
109             
110             
111