]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/layout/_TabContainerBase.js.uncompressed.js
2 'url:dijit/layout/templates/TabContainer.html':"<div class=\"dijitTabContainer\">\n\t<div class=\"dijitTabListWrapper\" data-dojo-attach-point=\"tablistNode\"></div>\n\t<div data-dojo-attach-point=\"tablistSpacer\" class=\"dijitTabSpacer ${baseClass}-spacer\"></div>\n\t<div class=\"dijitTabPaneWrapper ${baseClass}-container\" data-dojo-attach-point=\"containerNode\"></div>\n</div>\n"}});
3 define("dijit/layout/_TabContainerBase", [
4 "dojo/text!./templates/TabContainer.html",
6 "./utils", // marginBox2contextBox, layoutChildren
8 "dojo/_base/declare", // declare
9 "dojo/dom-class", // domClass.add
10 "dojo/dom-geometry", // domGeometry.contentBox
11 "dojo/dom-style" // domStyle.style
12 ], function(template
, StackContainer
, layoutUtils
, _TemplatedMixin
, declare
, domClass
, domGeometry
, domStyle
){
16 var StackContainer = dijit.layout.StackContainer;
17 var _TemplatedMixin = dijit._TemplatedMixin;
21 // dijit/layout/_TabContainerBase
23 // Abstract base class for TabContainer. Must define _makeController() to instantiate
24 // and return the widget that displays the tab labels
27 return declare("dijit.layout._TabContainerBase", [StackContainer
, _TemplatedMixin
], {
29 // Abstract base class for TabContainer. Must define _makeController() to instantiate
30 // and return the widget that displays the tab labels
32 // A TabContainer is a container that has multiple panes, but shows only
33 // one pane at a time. There are a set of tabs corresponding to each pane,
34 // where each tab has the name (aka title) of the pane, and optionally a close button.
36 // tabPosition: String
37 // Defines where tabs go relative to tab content.
38 // "top", "bottom", "left-h", "right-h"
41 baseClass
: "dijitTabContainer",
43 // tabStrip: [const] Boolean
44 // Defines whether the tablist gets an extra class for layouting, putting a border/shading
45 // around the set of tabs. Not supported by claro theme.
48 // nested: [const] Boolean
49 // If true, use styling for a TabContainer nested inside another TabContainer.
50 // For tundra etc., makes tabs look like links, and hides the outer
51 // border since the outer TabContainer already has a border.
54 templateString
: template
,
56 postMixInProperties: function(){
57 // set class name according to tab position, ex: dijitTabContainerTop
58 this.baseClass
+= this.tabPosition
.charAt(0).toUpperCase() + this.tabPosition
.substr(1).replace(/-.*/, "");
60 this.srcNodeRef
&& domStyle
.set(this.srcNodeRef
, "visibility", "hidden");
62 this.inherited(arguments
);
65 buildRendering: function(){
66 this.inherited(arguments
);
68 // Create the tab list that will have a tab (a.k.a. tab button) for each tab panel
69 this.tablist
= this._makeController(this.tablistNode
);
71 if(!this.doLayout
){ domClass
.add(this.domNode
, "dijitTabContainerNoLayout"); }
74 /* workaround IE's lack of support for "a > b" selectors by
75 * tagging each node in the template.
77 domClass
.add(this.domNode
, "dijitTabContainerNested");
78 domClass
.add(this.tablist
.containerNode
, "dijitTabContainerTabListNested");
79 domClass
.add(this.tablistSpacer
, "dijitTabContainerSpacerNested");
80 domClass
.add(this.containerNode
, "dijitTabPaneWrapperNested");
82 domClass
.add(this.domNode
, "tabStrip-" + (this.tabStrip
? "enabled" : "disabled"));
86 _setupChild: function(/*dijit._Widget*/ tab
){
87 // Overrides StackContainer._setupChild().
88 domClass
.add(tab
.domNode
, "dijitTabPane");
89 this.inherited(arguments
);
93 if(this._started
){ return; }
95 // wire up the tablist and its tabs
96 this.tablist
.startup();
98 this.inherited(arguments
);
102 // Overrides StackContainer.layout().
103 // Configure the content pane to take up all the space except for where the tabs are
105 if(!this._contentBox
|| typeof(this._contentBox
.l
) == "undefined"){return;}
107 var sc
= this.selectedChildWidget
;
110 // position and size the titles and the container node
111 var titleAlign
= this.tabPosition
.replace(/-h/, "");
112 this.tablist
.layoutAlign
= titleAlign
;
113 var children
= [this.tablist
, {
114 domNode
: this.tablistSpacer
,
115 layoutAlign
: titleAlign
117 domNode
: this.containerNode
,
118 layoutAlign
: "client"
120 layoutUtils
.layoutChildren(this.domNode
, this._contentBox
, children
);
122 // Compute size to make each of my children.
123 // children[2] is the margin-box size of this.containerNode, set by layoutChildren() call above
124 this._containerContentBox
= layoutUtils
.marginBox2contentBox(this.containerNode
, children
[2]);
127 sc
.resize(this._containerContentBox
);
130 // just layout the tab controller, so it can position left/right buttons etc.
131 if(this.tablist
.resize
){
132 //make the tabs zero width so that they don't interfere with width calc, then reset
133 var s
= this.tablist
.domNode
.style
;
135 var width
= domGeometry
.getContentBox(this.domNode
).w
;
137 this.tablist
.resize({w
: width
});
140 // and call resize() on the selected pane just to tell it that it's been made visible
149 this.tablist
.destroy();
151 this.inherited(arguments
);