source: Dev/trunk/src/client/dijit/form/HorizontalRule.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

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