resources/RooUsage.txt
[app.Builder.js] / src / Builder4 / WindowAddProp.vala
1 static Xcls_WindowAddProp  _WindowAddProp;
2
3 public class Xcls_WindowAddProp : Object 
4 {
5     public Gtk.ScrolledWindow el;
6     private Xcls_WindowAddProp  _this;
7
8     public static Xcls_WindowAddProp singleton()
9     {
10         if (_WindowAddProp == null) {
11             _WindowAddProp= new Xcls_WindowAddProp();
12         }
13         return _WindowAddProp;
14     }
15     public Xcls_model model;
16     public Xcls_namecol namecol;
17     public Xcls_namerender namerender;
18
19         // my vars (def)
20     public signal void select (string key, string type, string skel, string etype);
21
22     // ctor 
23     public Xcls_WindowAddProp()
24     {
25         _this = this;
26         this.el = new Gtk.ScrolledWindow( null, null );
27
28         // my vars (dec)
29
30         // set gobject values
31         this.el.shadow_type = Gtk.ShadowType.IN;
32         var child_0 = new Xcls_TreeView2( _this );
33         child_0.ref();
34         this.el.add (  child_0.el  );
35
36         // init method 
37
38         this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
39     }
40
41     // user defined functions 
42     public void show (Palete.Palete pal, string etype, string xtype) {
43         this.model.el.clear();
44     
45         Gtk.TreeIter iter;
46         var elementList = pal.getPropertiesFor( xtype,etype);
47         
48         
49         //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
50                // console.dump(elementList);
51                
52         var miter = elementList.map_iterator();
53         while (miter.next()) {
54            var p = miter.get_value();
55             
56             this.model.el.append(out iter);
57     
58             this.model.el.set(iter,
59                     0,  p.name, 
60                     1, p.type,
61                     2, "<b>" + p.name +"</b> <i>"+p.type+"</i>\n" + 
62                             GLib.Markup.escape_text(p.doctxt),
63                     3, p.sig,
64                     4, "<b>" + p.name +"</b> <span size=\"small\"><i>"+p.type+"</i></span>",
65                     5, etype,
66                     -1
67             );
68         }
69         this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
70                                  
71     }
72     public void clear () {
73         this.model.el.clear();
74     
75     }
76     public class Xcls_TreeView2 : Object 
77     {
78         public Gtk.TreeView el;
79         private Xcls_WindowAddProp  _this;
80
81
82             // my vars (def)
83
84         // ctor 
85         public Xcls_TreeView2(Xcls_WindowAddProp _owner )
86         {
87             _this = _owner;
88             this.el = new Gtk.TreeView();
89
90             // my vars (dec)
91
92             // set gobject values
93             this.el.tooltip_column = 2;
94             this.el.enable_tree_lines = true;
95             this.el.headers_visible = true;
96             var child_0 = new Xcls_model( _this );
97             child_0.ref();
98             this.el.set_model (  child_0.el  );
99             var child_1 = new Xcls_namecol( _this );
100             child_1.ref();
101             this.el.append_column (  child_1.el  );
102
103             // init method 
104
105             {  
106                    var description = new Pango.FontDescription();
107                  description.set_size(8000);
108                 this.el.override_font(description);     
109                                 
110                 this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);
111              
112             
113                 
114               
115                 
116             }
117
118             // listeners 
119             this.el.row_activated.connect( (path, column)  => {
120             
121                     Gtk.TreeIter iter;
122             
123             
124                     var m = _this.model;
125                     
126                     m.el.get_iter(out iter,path);
127                     
128                     
129                     // var val = "";
130                     
131                     
132                     var key = m.getValue(iter, 0);
133                     
134                     var type = m.getValue(iter, 1);
135                     var skel = m.getValue(iter, 3);
136                     var etype = m.getValue(iter, 5);
137                     
138                     
139                     _this.select(key,etype == "signals" ? "" : type,skel, etype);
140                     
141             });
142         }
143
144         // user defined functions 
145     }
146     public class Xcls_model : Object 
147     {
148         public Gtk.ListStore el;
149         private Xcls_WindowAddProp  _this;
150
151
152             // my vars (def)
153
154         // ctor 
155         public Xcls_model(Xcls_WindowAddProp _owner )
156         {
157             _this = _owner;
158             _this.model = this;
159             this.el = new Gtk.ListStore( 6, typeof(string),  // 0 real key
160 typeof(string), // 1 real type
161 typeof(string), // 2 docs ?
162 typeof(string), // 3 visable desc
163 typeof(string), // 4 function desc
164 typeof(string) // 5 element type (event|prop)
165          );
166
167             // my vars (dec)
168
169             // set gobject values
170         }
171
172         // user defined functions 
173         public string getValue (Gtk.TreeIter iter, int col)
174         {
175         
176             GLib.Value value;
177             this.el.get_value(iter, col, out value);
178         
179             return (string)value;
180             
181         }
182     }
183     public class Xcls_namecol : Object 
184     {
185         public Gtk.TreeViewColumn el;
186         private Xcls_WindowAddProp  _this;
187
188
189             // my vars (def)
190
191         // ctor 
192         public Xcls_namecol(Xcls_WindowAddProp _owner )
193         {
194             _this = _owner;
195             _this.namecol = this;
196             this.el = new Gtk.TreeViewColumn();
197
198             // my vars (dec)
199
200             // set gobject values
201             this.el.title = "Double click to add";
202             var child_0 = new Xcls_namerender( _this );
203             child_0.ref();
204             this.el.pack_start (  child_0.el , true );
205
206             // init method 
207
208             this.el.add_attribute(_this.namerender.el , "markup", 4  );
209         }
210
211         // user defined functions 
212     }
213     public class Xcls_namerender : Object 
214     {
215         public Gtk.CellRendererText el;
216         private Xcls_WindowAddProp  _this;
217
218
219             // my vars (def)
220
221         // ctor 
222         public Xcls_namerender(Xcls_WindowAddProp _owner )
223         {
224             _this = _owner;
225             _this.namerender = this;
226             this.el = new Gtk.CellRendererText();
227
228             // my vars (dec)
229
230             // set gobject values
231         }
232
233         // user defined functions 
234     }
235 }