4
Copyright DHTMLX LTD. http://www.dhtmlx.com
5
You allowed to use this component or parts of it under GPL terms
6
To use it on other terms or get Professional edition of the component please contact us at sales@dhtmlx.com
10
* @desc: protobar object
11
* @param: func - user defined function
15
function dhtmlXProtobarObject(){
20
* @desc: set action hadler on menu showing
21
* @param: func - user defined function
25
dhtmlXProtobarObject.prototype.setOnShowHandler=function(func){
26
if (typeof(func)=="function") this.onShow=func; else this.onShow=eval(func);
30
* @desc: return item index in collection by id
32
* @param: id - item id
35
dhtmlXProtobarObject.prototype._getItemIndex=function(id){
36
for (var i=0; i<this.itemsCount; i++)
38
if (this.items[i].id==id) return i;
43
* @desc: set path to system images
44
* @param: path - relative path to images
48
dhtmlXProtobarObject.prototype.setGfxPath=function(path){
50
if (this._adjustGFXPath) this._adjustGFXPath(path);
54
* @desc: set action hadler on menu hiding
55
* @param: func - user defined function
59
dhtmlXProtobarObject.prototype.setOnHideHandler=function(func){
60
if (typeof(func)=="function") this.onHide=func; else this.onHide=eval(func);
63
* @desc: set item individual action
64
* @param: id - item identificator
65
* @param: action - js function called on item selection
69
dhtmlXProtobarObject.prototype.setItemAction=function(id,action){
70
var z=this._getItemIndex(id);
72
this.items[z].setSecondAction(action);
76
* @desc: return item object by id
78
* @param: itemId - item id
81
dhtmlXProtobarObject.prototype.getItem=function(itemId){
82
var z=this._getItemIndex(itemId);
83
if (z>=0) return this.items[z];
86
* @desc: hide menu buttons
88
* @param: idList - list of items's ids, separated by comma
91
dhtmlXProtobarObject.prototype.hideButtons=function(idList){
93
for (var i=0; i<this.itemsCount; i++){
94
var z=this.items[i].getTopNode();
95
z.style.display="none";
96
if (this.extraMode) z.parentNode.style.display="none";
102
var temp=idList.split(",");
103
for (var i=0; i<temp.length; i++)
105
this.hideItem(temp[i]);
109
* @desc: show menu buttons
111
* @param: idList - list of items's ids, separated by comma
114
dhtmlXProtobarObject.prototype.showButtons=function(idList){
116
for (var i=0; i<this.itemsCount; i++){
117
var w=this.items[i].getTopNode();
119
if (this.extraMode) w.parentNode.style.display="";
120
this.items[i].hide=0;
125
var temp=idList.split(",");
126
for (var i=0; i<temp.length; i++)
128
this.showItem(temp[i]);
132
* @desc: disable menu button
134
* @param: itemId - item id
137
dhtmlXProtobarObject.prototype.disableItem=function(itemId){
138
var z=this.getItem(itemId);
139
if (z) { if (z.disable) z.disable(); }
142
* @desc: enable menu button
144
* @param: itemId - item id
147
dhtmlXProtobarObject.prototype.enableItem=function(itemId){
148
var z=this.getItem(itemId);
149
if (z) { if (z.enable) z.enable(); }
153
* @desc: hide menu button
155
* @param: itemId - item id
158
dhtmlXProtobarObject.prototype.hideItem=function(itemId){
159
var z=this.getItem(itemId);
161
var w=z.getTopNode();
162
w.style.display="none";
163
if (this.extraMode) w.parentNode.style.display="none";
166
this._scrollClear(z.parentPanel);
167
this._scrollCheck(z.parentPanel);
172
* @desc: show menu button
174
* @param: id - item id
177
dhtmlXProtobarObject.prototype.showItem=function(id){
178
var z=this.getItem(id);
180
var w=z.getTopNode();
182
if (this.extraMode) w.parentNode.style.display="";
185
this._scrollClear(z.parentPanel);
186
this._scrollCheck(z.parentPanel);
191
* @desc: set default action
193
* @param: action - set default action
196
dhtmlXProtobarObject.prototype.setOnClickHandler=function(func){
197
if (typeof(func)=="function") this.defaultAction=func; else this.defaultAction=eval(func);
200
* @desc: set menu tittle
202
* @param: name - new tittle, shown on menu
205
dhtmlXProtobarObject.prototype.setTitleText=function(newText){
207
this.nameCell.innerHTML=newText;
208
this.preNameCell.innerHTML=newText;
211
* @desc: set menu size
213
* @param: width - menu width
214
* @param: height - menu height
218
dhtmlXProtobarObject.prototype.setBarSize=function(width,height){
219
if(width) this.topNod.width=width;
220
if(height) this.topNod.height=height;
223
* @desc: hide all items, show only items which ids in list
225
* @param: idList - list of id's, separated by comma
228
dhtmlXProtobarObject.prototype.resetBar=function(idList){
229
for (var i=0; i<this.itemsCount; i++)
230
this.hideItem(this.items[i].id);
231
var temp=idList.split(",");
232
for (var i=0; i<temp.length; i++)
234
this.showItem(temp[i]);
243
* @desc: load XML from file
245
* @param: file - file name
246
* @param: itemId - if of item for which xml requested
247
* @param: afterCall - function which will be called after loading
252
dhtmlXProtobarObject.prototype.loadXMLFor=function(file,itemId,afterCall){
253
var z=this._getItemIndex(itemId);
254
var await=null; var that=this;
255
if (z>=0) await=this.gitems[z];
256
this.xmlLoader=new dtmlXMLLoaderObject(function(){
257
that._awaitXML=await;
258
var z=that.xmlLoader;
259
that.xmlLoader=arguments[4];
260
that._parseXMLTree.apply(this,arguments);
263
this.xmlLoader.waitCall=afterCall||0;
264
this.xmlLoader.loadXML(file);
269
* @desc: load XML from file
271
* @param: file - file name
272
* @param: afterCall - function which will be called after xml loading
277
dhtmlXProtobarObject.prototype.loadXML=function(file,afterCall){
278
this.xmlLoader.waitCall=afterCall||0;
279
this.xmlLoader.loadXML(file); };
282
* @desc: load XML from string
284
* @param: xmlString - string contining XML
285
* @param: afterCall - function which will be called after xml loading
288
dhtmlXProtobarObject.prototype.loadXMLString=function(xmlString,afterCall){
289
this.waitCall=afterCall||0;
290
this.xmlLoader.loadXMLString(xmlString); };
297
dhtmlXProtobarObject.prototype.showBar=function(){
298
this.topNod.style.display="";
299
if ((this.topNod.ieFix)&&(this.topNod.style.position=="absolute")) {
300
this.topNod.ieFix.style.display="";
301
this.topNod.ieFix.style.position="absolute";
302
this.topNod.ieFix.style.top=this.topNod.style.top;
303
this.topNod.ieFix.style.left=this.topNod.style.left;
304
this.topNod.ieFix.style.width=this.topNod.offsetWidth+"px";
305
this.topNod.ieFix.style.height=this.topNod.offsetHeight+"px";
307
if(this.onShow)this.onShow();
316
dhtmlXProtobarObject.prototype.hideBar=function(){
317
this.topNod.style.display="none";
318
if (this.topNod.ieFix) this.topNod.ieFix.style.display="none";
319
if(this.onHide)this.onHide();
323
* @desc: set menu buttons alignment (allowed - 'left','center','right','top','middle','bottom')
324
* @param: align - buttons alignment
328
dhtmlXProtobarObject.prototype.setBarAlign=function(align){
329
if ((align=="left")||(align=="top")) { this.preNameCell.innerHTML="";
330
this.preNameCell.style.display="none";
331
this.nameCell.style.display="";
332
this.nameCell.width="100%";
333
this.nameCell.innerHTML=this.tname;
336
if ((align=="center")||(align=="middle")){
337
this.preNameCell.style.display="";
338
this.preNameCell.width="50%";
339
this.nameCell.style.display="";
340
this.nameCell.width="50%";
341
this.nameCell.innerHTML=this.tname;
342
this.preNameCell.innerHTML=this.tname;
344
if ((align=="right")||(align=="bottom")) {
345
this.nameCell.innerHTML="";
346
this.nameCell.style.display="none";
347
this.preNameCell.style.display="";
348
this.preNameCell.width="100%";
349
this.preNameCell.innerHTML=this.tname;
353
dhtmlXProtobarObject.prototype.dummyFunc=function(){ return true; };
354
dhtmlXProtobarObject.prototype.badDummy=function(){return false; };
359
* @desc: image button prototype
363
function dhtmlXButtonPrototypeObject(){
367
* @desc: set default action, action function take one parametr - item id
369
* @param: func - js function
372
dhtmlXButtonPrototypeObject.prototype.setAction=function(func){
373
if (typeof(func)=="function") this.action=func; else this.action=eval(func);
376
* @desc: set personal onClick action (action must return false for preventing calling default action after personal), action function take one parametr - item id
377
* @param: func - js function
381
dhtmlXButtonPrototypeObject.prototype.setSecondAction=function(func){
382
if (typeof(func)=="function") this.persAction=func; else this.persAction=eval(func);
385
* @desc: enable object
389
dhtmlXButtonPrototypeObject.prototype.enable=function(){
390
if (this.disableImage) this.imageTag.src=this.src;
393
this.topNod.className=this.objectNode.className;
395
this.topNod.className=this.className;
398
this.textTag.className=this.textClassName;
400
this.topNod.onclick=this._onclickX;
401
this.topNod.onmouseover=this._onmouseoverX;
402
this.topNod.onmouseout=this._onmouseoutX;
403
this.topNod.onmousedown=this._onmousedownX;
404
this.topNod.onmouseup=this._onmouseupX;
408
* @desc: disable object
412
dhtmlXButtonPrototypeObject.prototype.disable=function(){
413
if (this.disableImage)
415
this.imageTag.src=this.disableImage;
417
else this.topNod.className="iconGray";
420
this.textTag.className="buttonTextDisabled";
423
this.topNod.onclick=this.dummy;
424
this.topNod.onmouseover=this.dummy;
425
this.topNod.onmouseout=this.dummy;
426
this.topNod.onmousedown=this.dummy;
427
this.topNod.onmouseup=this.dummy;
432
* @desc: inner onclick handler
436
dhtmlXButtonPrototypeObject.prototype._onclickX=function(e,that){
437
if (!that) that=this.objectNode;
438
if (that.topNod.dstatus) return;
439
if ((!that.persAction)||(that.persAction()))
440
if (that.action) { that.action(that.id); }
443
* @desc: set innerHTML of button
444
* @param: htmlText - new text
448
dhtmlXButtonPrototypeObject.prototype.setHTML=function(htmlText){
449
this.topNod.innerHTML=htmlText;
452
* @desc: set alt text of button image
454
* @param: imageText - new alt image text
457
dhtmlXButtonPrototypeObject.prototype.setAltText=function(imageText){
458
this.imageTag.alt=imageText;
461
* @desc: set image href
463
* @param: imageSrc - new image href
464
* @param: disabledImageSrc - new image href
467
dhtmlXButtonPrototypeObject.prototype.setImage=function(imageSrc,disabledImageSrc){
469
if (disabledImageSrc) this.disableImage=disabledImageSrc;
472
{ if (disabledImageSrc) this.imageTag.src=disabledImageSrc; }
474
this.imageTag.src=imageSrc;
477
dhtmlXButtonPrototypeObject.prototype.dummy=function(){};
479
* @desc: return HTML top node
483
dhtmlXButtonPrototypeObject.prototype.getTopNode=function(){ return this.topNod; }
485
* @desc: onmouseover handler
489
dhtmlXButtonPrototypeObject.prototype._onmouseoverY=function() {
491
this.imageTag.src=this._mvImage;
493
this.topNod.className=this.className+'Over';
496
* @desc: onmouseout handler
500
dhtmlXButtonPrototypeObject.prototype._onmouseoutY=function() {
502
this.imageTag.src=this._mnImage;
504
this.topNod.className=this.className;
507
* @desc: onmousedown handler
511
dhtmlXButtonPrototypeObject.prototype._onmousedownX=function() { this.className=this.objectNode.className+'Down'; return true; };
513
* @desc: onmouseup handler
517
dhtmlXButtonPrototypeObject.prototype._onmouseupX=function() { this.className=this.objectNode.className; return true; };
521
dhtmlXButtonPrototypeObject.prototype._onmouseoutX=function(e){
523
//e.cancelBubble=true;
524
if (this.timeoutop) clearTimeout(this.timeoutop);
525
this.timeoutop=setTimeout( this.objectNode._delayedTimerCall(this.objectNode,"_onmouseoutY"),100);
528
dhtmlXButtonPrototypeObject.prototype._onmouseoverX=function(e){
530
//e.cancelBubble=true;
531
if (this.timeoutop) clearTimeout(this.timeoutop);
532
this.timeoutop=setTimeout( this.objectNode._delayedTimerCall(this.objectNode,"_onmouseoverY"),50);
535
dhtmlXButtonPrototypeObject.prototype._delayedTimerCall=function(object,functionName,time){
536
this.callFunc=function(){
537
eval("object."+functionName+"();");
539
return this.callFunc;
541
dhtmlXButtonPrototypeObject.prototype._arg2obj=function(n,list){
542
var nAtr=new Object();
543
for (var i=0; i<n.length; i++)
547
//(c)dhtmlx ltd. www.dhtmlx.com
b'\\ No newline at end of file'