1 | define([ |
---|
2 | "dojo/_base/declare", |
---|
3 | "dojo/dom-construct", |
---|
4 | "./Pane", |
---|
5 | "./iconUtils", |
---|
6 | "./sniff" |
---|
7 | ], function(declare, domConstruct, Pane, iconUtils, has){ |
---|
8 | |
---|
9 | // module: |
---|
10 | // dojox/mobile/_IconItemPane |
---|
11 | |
---|
12 | return declare("dojox.mobile._IconItemPane", Pane, { |
---|
13 | // summary: |
---|
14 | // An internal widget used for IconContainer. |
---|
15 | |
---|
16 | // iconPos: String |
---|
17 | // The default icon position for child items. |
---|
18 | iconPos: "", |
---|
19 | |
---|
20 | // closeIconRole: String |
---|
21 | // The HTML role of the close icon. Example: "button". |
---|
22 | closeIconRole: "", |
---|
23 | |
---|
24 | // closeIconTitle: String |
---|
25 | // The title of the close icon. |
---|
26 | closeIconTitle: "", |
---|
27 | |
---|
28 | // label: String |
---|
29 | // The label of the item. |
---|
30 | label: "", |
---|
31 | |
---|
32 | // closeIcon: String |
---|
33 | // CSS class for the close icon. |
---|
34 | closeIcon: "mblDomButtonBlueMinus", |
---|
35 | |
---|
36 | // baseClass: String |
---|
37 | // The name of the CSS class of this widget. |
---|
38 | baseClass: "mblIconItemPane", |
---|
39 | |
---|
40 | // tabIndex: String |
---|
41 | // Tab index for the close button, such that users can hit the tab |
---|
42 | // key to focus on it. |
---|
43 | tabIndex: "0", |
---|
44 | |
---|
45 | // _setTabIndexAttr: [private] String |
---|
46 | // Sets tabIndex to closeIconNode. |
---|
47 | _setTabIndexAttr: "closeIconNode", |
---|
48 | |
---|
49 | buildRendering: function(){ |
---|
50 | this.inherited(arguments); |
---|
51 | this.hide(); |
---|
52 | this.closeHeaderNode = domConstruct.create("h2", {className:"mblIconItemPaneHeading"}, this.domNode); |
---|
53 | this.closeIconNode = domConstruct.create("div", { |
---|
54 | className: "mblIconItemPaneIcon", |
---|
55 | role: this.closeIconRole, |
---|
56 | title: this.closeIconTitle |
---|
57 | }, this.closeHeaderNode); |
---|
58 | this.labelNode = domConstruct.create("span", {className:"mblIconItemPaneTitle"}, this.closeHeaderNode); |
---|
59 | this.containerNode = domConstruct.create("div", {className:"mblContent"}, this.domNode); |
---|
60 | }, |
---|
61 | |
---|
62 | show: function(){ |
---|
63 | // summary: |
---|
64 | // Shows the widget. |
---|
65 | this.domNode.style.display = ""; |
---|
66 | }, |
---|
67 | |
---|
68 | hide: function(){ |
---|
69 | // summary: |
---|
70 | // Hides the widget. |
---|
71 | this.domNode.style.display = "none"; |
---|
72 | }, |
---|
73 | |
---|
74 | isOpen: function(e){ |
---|
75 | // summary: |
---|
76 | // Tests whether the widget is open. |
---|
77 | return this.domNode.style.display !== "none"; |
---|
78 | }, |
---|
79 | |
---|
80 | _setLabelAttr: function(/*String*/text){ |
---|
81 | // tags: |
---|
82 | // private |
---|
83 | this._set("label", text); |
---|
84 | this.labelNode.innerHTML = this._cv ? this._cv(text) : text; |
---|
85 | }, |
---|
86 | |
---|
87 | _setCloseIconAttr: function(icon){ |
---|
88 | // tags: |
---|
89 | // private |
---|
90 | this._set("closeIcon", icon); |
---|
91 | this.closeIconNode = iconUtils.setIcon(icon, this.iconPos, this.closeIconNode, null, this.closeHeaderNode); |
---|
92 | |
---|
93 | if(has("windows-theme") && this.closeIconTitle !== ""){ |
---|
94 | this.closeButtonNode = domConstruct.create("span", {className:"mblButton mblCloseButton", innerHTML:this.closeIconTitle, |
---|
95 | style: {display: "none"}}, this.closeIconNode); |
---|
96 | } |
---|
97 | } |
---|
98 | }); |
---|
99 | }); |
---|