initial checkin
[org.ibex.widgets.git] / src / ibex / lib / tabpane.t
1 <!-- Copyleft 2004 - see COPYING for details [LGPL] -->
2
3 <ibex>
4     <meta:doc>
5         Author: Charles Goodwin
6     </meta:doc>
7
8     <ui:box>
9
10         thisbox.th_head;
11         thisbox.th_content;
12
13         var tabgroup;
14
15         th_content ++= function(v) {
16             v.childadded ++= function(c) {
17                 // create the tab if needed
18                 if (!c.tab) {
19                     if (!c.tab) c.tab = ibex..ibex.widget.tab(ibex.box);
20
21                     if (!tabgroup) tabgroup = c.tab.group;
22                     else c.tab.group = tabgroup;
23  
24                     c.tab.selected ++= function(s) {
25                         cascade = s;
26                         if (c.tab.selected and !c.visible) th_content.show = c;
27                     }
28
29                     c.tab.text = c.tabtext;
30
31                     c.tabtext ++= function(t) {
32                         c.tab.text = t;
33                     }
34                 }
35
36                 // place the tab
37                 th_head[v.indexof(c)] = c.tab;
38             }
39
40             v.show ++= function(c) {
41                 cascade = c;
42                 if (c.visible and !c.tab.selected) c.tab.selected = true;
43             }
44
45             th_content --= callee;
46         }
47
48     </ui:box>
49 </ibex>