]> git.wh0rd.org - tt-rss.git/blame - lib/dijit/_PaletteMixin.js
Update SimplePie to version 1.2.
[tt-rss.git] / lib / dijit / _PaletteMixin.js
CommitLineData
2f01fe57
AD
1/*
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
5*/
6
7
8if(!dojo._hasResource["dijit._PaletteMixin"]){
9dojo._hasResource["dijit._PaletteMixin"]=true;
10dojo.provide("dijit._PaletteMixin");
11dojo.require("dijit._CssStateMixin");
12dojo.declare("dijit._PaletteMixin",[dijit._CssStateMixin],{defaultTimeout:500,timeoutChangeRate:0.9,value:null,_selectedCell:-1,tabIndex:"0",cellClass:"dijitPaletteCell",dyeClass:"",_preparePalette:function(_1,_2){
13this._cells=[];
14var _3=this._blankGif;
15var _4=dojo.getObject(this.dyeClass);
16for(var _5=0;_5<_1.length;_5++){
17var _6=dojo.create("tr",{tabIndex:"-1"},this.gridNode);
18for(var _7=0;_7<_1[_5].length;_7++){
19var _8=_1[_5][_7];
20if(_8){
21var _9=new _4(_8);
22var _a=dojo.create("td",{"class":this.cellClass,tabIndex:"-1",title:_2[_8]});
23_9.fillCell(_a,_3);
24this.connect(_a,"ondijitclick","_onCellClick");
25this._trackMouseState(_a,this.cellClass);
26dojo.place(_a,_6);
27_a.index=this._cells.length;
28this._cells.push({node:_a,dye:_9});
29}
30}
31}
32this._xDim=_1[0].length;
33this._yDim=_1.length;
34var _b={UP_ARROW:-this._xDim,DOWN_ARROW:this._xDim,RIGHT_ARROW:this.isLeftToRight()?1:-1,LEFT_ARROW:this.isLeftToRight()?-1:1};
35for(var _c in _b){
36this._connects.push(dijit.typematic.addKeyListener(this.domNode,{charOrCode:dojo.keys[_c],ctrlKey:false,altKey:false,shiftKey:false},this,function(){
37var _d=_b[_c];
38return function(_e){
39this._navigateByKey(_d,_e);
40};
41}(),this.timeoutChangeRate,this.defaultTimeout));
42}
43},postCreate:function(){
44this.inherited(arguments);
45this._setCurrent(this._cells[0].node);
46},focus:function(){
47dijit.focus(this._currentFocus);
48},_onCellClick:function(_f){
49var _10=_f.currentTarget,_11=this._getDye(_10).getValue();
50this._setCurrent(_10);
51setTimeout(dojo.hitch(this,function(){
52dijit.focus(_10);
53this._setValueAttr(_11,true);
54}));
55dojo.removeClass(_10,"dijitPaletteCellHover");
56dojo.stopEvent(_f);
57},_setCurrent:function(_12){
58if("_currentFocus" in this){
59dojo.attr(this._currentFocus,"tabIndex","-1");
60}
61this._currentFocus=_12;
62if(_12){
63dojo.attr(_12,"tabIndex",this.tabIndex);
64}
65},_setValueAttr:function(_13,_14){
66this.value=null;
67if(this._selectedCell>=0){
68dojo.removeClass(this._cells[this._selectedCell].node,"dijitPaletteCellSelected");
69}
70this._selectedCell=-1;
71if(_13){
72for(var i=0;i<this._cells.length;i++){
73if(_13==this._cells[i].dye.getValue()){
74this._selectedCell=i;
75this.value=_13;
76dojo.addClass(this._cells[i].node,"dijitPaletteCellSelected");
77if(_14||_14===undefined){
78this.onChange(_13);
79}
80break;
81}
82}
83}
84},onChange:function(_15){
85},_navigateByKey:function(_16,_17){
86if(_17==-1){
87return;
88}
89var _18=this._currentFocus.index+_16;
90if(_18<this._cells.length&&_18>-1){
91var _19=this._cells[_18].node;
92this._setCurrent(_19);
93setTimeout(dojo.hitch(dijit,"focus",_19),0);
94}
95},_getDye:function(_1a){
96return this._cells[_1a.index].dye;
97}});
98}