]> git.wh0rd.org Git - tt-rss.git/blob - lib/dijit/form/HorizontalRule.js.uncompressed.js
update dojo to 1.7.3
[tt-rss.git] / lib / dijit / form / HorizontalRule.js.uncompressed.js
1 define("dijit/form/HorizontalRule", [
2         "dojo/_base/declare",   // declare
3         "../_Widget",
4         "../_TemplatedMixin"
5 ], function(declare, _Widget, _TemplatedMixin){
6
7 /*=====
8         var _Widget = dijit._Widget;
9         var _TemplatedMixin = dijit._TemplatedMixin;
10 =====*/
11
12 // module:
13 //              dijit/form/HorizontalRule
14 // summary:
15 //              Hash marks for `dijit.form.HorizontalSlider`
16
17
18 return declare("dijit.form.HorizontalRule", [_Widget, _TemplatedMixin], {
19         // summary:
20         //              Hash marks for `dijit.form.HorizontalSlider`
21
22         templateString: '<div class="dijitRuleContainer dijitRuleContainerH"></div>',
23
24         // count: Integer
25         //              Number of hash marks to generate
26         count: 3,
27
28         // container: String
29         //              For HorizontalSlider, this is either "topDecoration" or "bottomDecoration",
30         //              and indicates whether this rule goes above or below the slider.
31         container: "containerNode",
32
33         // ruleStyle: String
34         //              CSS style to apply to individual hash marks
35         ruleStyle: "",
36
37         _positionPrefix: '<div class="dijitRuleMark dijitRuleMarkH" style="left:',
38         _positionSuffix: '%;',
39         _suffix: '"></div>',
40
41         _genHTML: function(pos){
42                 return this._positionPrefix + pos + this._positionSuffix + this.ruleStyle + this._suffix;
43         },
44
45         // _isHorizontal: [protected extension] Boolean
46         //              VerticalRule will override this...
47         _isHorizontal: true,
48
49         buildRendering: function(){
50                 this.inherited(arguments);
51
52                 var innerHTML;
53                 if(this.count == 1){
54                         innerHTML = this._genHTML(50, 0);
55                 }else{
56                         var i;
57                         var interval = 100 / (this.count-1);
58                         if(!this._isHorizontal || this.isLeftToRight()){
59                                 innerHTML = this._genHTML(0, 0);
60                                 for(i=1; i < this.count-1; i++){
61                                         innerHTML += this._genHTML(interval*i, i);
62                                 }
63                                 innerHTML += this._genHTML(100, this.count-1);
64                         }else{
65                                 innerHTML = this._genHTML(100, 0);
66                                 for(i=1; i < this.count-1; i++){
67                                         innerHTML += this._genHTML(100-interval*i, i);
68                                 }
69                                 innerHTML += this._genHTML(0, this.count-1);
70                         }
71                 }
72                 this.domNode.innerHTML = innerHTML;
73         }
74 });
75
76 });