]>
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
){
15 // dijit/layout/_TabContainerBase
18 return declare("dijit.layout._TabContainerBase", [StackContainer
, _TemplatedMixin
], {
20 // Abstract base class for TabContainer. Must define _makeController() to instantiate
21 // and return the widget that displays the tab labels
23 // A TabContainer is a container that has multiple panes, but shows only
24 // one pane at a time. There are a set of tabs corresponding to each pane,
25 // where each tab has the name (aka title) of the pane, and optionally a close button.
27 // tabPosition: String
28 // Defines where tabs go relative to tab content.
29 // "top", "bottom", "left-h", "right-h"
32 baseClass
: "dijitTabContainer",
34 // tabStrip: [const] Boolean
35 // Defines whether the tablist gets an extra class for layouting, putting a border/shading
36 // around the set of tabs. Not supported by claro theme.
39 // nested: [const] Boolean
40 // If true, use styling for a TabContainer nested inside another TabContainer.
41 // For tundra etc., makes tabs look like links, and hides the outer
42 // border since the outer TabContainer already has a border.
45 templateString
: template
,
47 postMixInProperties: function(){
48 // set class name according to tab position, ex: dijitTabContainerTop
49 this.baseClass
+= this.tabPosition
.charAt(0).toUpperCase() + this.tabPosition
.substr(1).replace(/-.*/, "");
51 this.srcNodeRef
&& domStyle
.set(this.srcNodeRef
, "visibility", "hidden");
53 this.inherited(arguments
);
56 buildRendering: function(){
57 this.inherited(arguments
);
59 // Create the tab list that will have a tab (a.k.a. tab button) for each tab panel
60 this.tablist
= this._makeController(this.tablistNode
);
62 if(!this.doLayout
){ domClass
.add(this.domNode
, "dijitTabContainerNoLayout"); }
65 /* workaround IE's lack of support for "a > b" selectors by
66 * tagging each node in the template.
68 domClass
.add(this.domNode
, "dijitTabContainerNested");
69 domClass
.add(this.tablist
.containerNode
, "dijitTabContainerTabListNested");
70 domClass
.add(this.tablistSpacer
, "dijitTabContainerSpacerNested");
71 domClass
.add(this.containerNode
, "dijitTabPaneWrapperNested");
73 domClass
.add(this.domNode
, "tabStrip-" + (this.tabStrip
? "enabled" : "disabled"));
77 _setupChild: function(/*dijit/_WidgetBase*/ tab){
78 // Overrides StackContainer._setupChild().
79 domClass.add(tab.domNode, "dijitTabPane");
80 this.inherited(arguments);
84 if(this._started){ return; }
86 // wire up the tablist and its tabs
87 this.tablist.startup();
89 this.inherited(arguments);
93 // Overrides StackContainer.layout().
94 // Configure the content pane to take up all the space except for where the tabs are
96 if(!this._contentBox || typeof(this._contentBox.l) == "undefined"){return;}
98 var sc = this.selectedChildWidget;
101 // position and size the titles and the container node
102 var titleAlign = this.tabPosition.replace(/-h/, "");
103 this.tablist.layoutAlign = titleAlign;
104 var children = [this.tablist, {
105 domNode: this.tablistSpacer,
106 layoutAlign: titleAlign
108 domNode: this.containerNode,
109 layoutAlign: "client"
111 layoutUtils.layoutChildren(this.domNode, this._contentBox, children);
113 // Compute size to make each of my children.
114 // children[2] is the margin-box size of this.containerNode, set by layoutChildren() call above
115 this._containerContentBox = layoutUtils.marginBox2contentBox(this.containerNode, children[2]);
118 sc.resize(this._containerContentBox);
121 // just layout the tab controller, so it can position left/right buttons etc.
122 if(this.tablist.resize){
123 //make the tabs zero width so that they don't interfere with width calc, then reset
124 var s = this.tablist.domNode.style;
126 var width = domGeometry.getContentBox(this.domNode).w;
128 this.tablist.resize({w: width});
131 // and call resize() on the selected pane just to tell it that it's been made visible
140 this.tablist.destroy();
142 this.inherited(arguments);