classe_barradebotoes.js
22.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
/*
Title: Barra de botões
Arquivo:
i3geo/classesjs/classe_barradebotoes.js
Licenca:
GPL2
I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil
Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br
Este programa é software livre; você pode redistribuí-lo
e/ou modificá-lo sob os termos da Licença Pública Geral
GNU conforme publicada pela Free Software Foundation;
tanto a versão 2 da Licença.
Este programa é distribuído na expectativa de que seja útil,
porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita
de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA.
Consulte a Licença Pública Geral do GNU para mais detalhes.
Você deve ter recebido uma cópia da Licença Pública Geral do
GNU junto com este programa; se não, escreva para a
Free Software Foundation, Inc., no endereço
59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
*/
if(typeof(i3GEO) == 'undefined'){
i3GEO = new Array();
}
/*
Classe: i3GEO.barradebotoes
Constrói a barra de botões flutuante
Veja também classe_interface.js (i3GEO.interface) que possuí parâmetros que permitem ajustar a posição das barras no mapa
*/
i3GEO.barraDeBotoes = {
/*
Propriedade: AUTOALTURA
Ajusta automaticamente a altura das barras conforme a altura do mapa.
Esta opção não tem efeito se a barra contiver a barra de zoom (isso ocorre em função de um bug do YIU, que causa erro na barra nessas condições)
Tipo:
{boolean}
*/
AUTOALTURA: false,
/*
Propriedade: TRANSICAOSUAVE
Altera a transparência das barras quando o mouse sobrepõe a barra e quando sai da barra
Tipo:
{boolean}
Default:
{true}
*/
TRANSICAOSUAVE: true,
/*
Propriedade: OPACIDADE
Valor da opacidade miníma utilizada quando TRANSICAOSUAVE for igual a true.
Varia de 0 a 100
Tipo:
{numeric}
Default:
{65}
*/
OPACIDADE: 65,
/*
Propriedade: PERMITEFECHAR
Mostra o botão para fechar as barras ou não.
Tipo:
{boolean}
*/
PERMITEFECHAR: true,
/*
Propriedade: PERMITEDESLOCAR
Permite deslocar as barras ou não.
Tipo:
{boolean}
*/
PERMITEDESLOCAR: true,
/*
Propriedade: ATIVAMENUCONTEXTO
Indica se o menu de contexto deve ser ativado
Tipo:
{Boolean}
Default:
{true}
*/
ATIVAMENUCONTEXTO: false,
/*
Propriedade: LISTABOTOES
Objeto com a lista de botões.
Por default utiliza os botoes definidos em i3GEO.configura.funcoesBotoes.botoes
Tipo:
{JSON}
*/
LISTABOTOES: i3GEO.configura.funcoesBotoes.botoes,
/*
Propriedade: BOTAOPADRAO
Botão que será ativado ao inicializar os botões com ativaBotoes.
Correpsonde ao item iddiv de LISTABOTOES
Tipo:
{String}
*/
BOTAOPADRAO: "pan",
/*
Propriedade: COMPORTAMENTO
Define o comportamento dos botões quando é pressionado
Tipo:
{String}
Valores:
"padrao" - comportamento padrão, com bordas da esquerda e inferiores ativadas
"destacado" - destaca apenas o botão atualmente pressionado
"vermelho" - destaca com fundo vermelho
"laranja" - destaca com fundo laranja
"cinza" - destaca com fundo cinza
*/
COMPORTAMENTO: "padrao",
/*
Variavel: BARRAS
Array com os objetos YAHOO.janelaBotoes.xp.panel criados
*/
BARRAS: new Array(),
/*
Variavel: BOTAOCLICADO
Último icone que foi clicado
Tipo:
{String}
*/
BOTAOCLICADO: "",
/*
Function: ativaIcone
Altera as bordas de um ícone aplicando um efeito de ícone realçado.
Todos os demais ícones definidos em LISTABOTOES e que tiverem o tipo = "dinamico"
serão processados para alterar as bordas dando o efeito de não ativo.
Parametro:
icone {String} - id do icone que será ativado. Esse id é o mesmo definido em LISTABOTOES
*/
ativaIcone: function(icone){
i3GEO.barraDeBotoes.BOTAOCLICADO = icone;
var ko = i3GEO.barraDeBotoes.LISTABOTOES.length-1;
if(i3GEO.barraDeBotoes.COMPORTAMENTO == "padrao"){
if(ko >= 0){do{
var temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
if (i3GEO.barraDeBotoes.LISTABOTOES[ko].tipo=="dinamico" && temp)
{
var ist = temp.style;
ist.borderWidth="1px";
ist.borderColor='white';
ist.borderLeftColor='rgb(50,50,50)';
ist.borderBottomColor='rgb(50,50,50)';
}
}while(ko--)}
//ativa o icone
if($i(icone))
{with ($i(icone).style){
borderColor='white';
borderWidth="1px";
}}
}
if(i3GEO.barraDeBotoes.COMPORTAMENTO == "destacado"){
if(ko >= 0){do{
var temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
if (temp)
{
var ist = temp.style;
ist.borderWidth="1px";
ist.borderColor='white';
}
}while(ko--)}
//ativa o icone
if($i(icone))
{with ($i(icone).style){
borderColor='black';
borderWidth="1px";
}}
}
if(i3GEO.barraDeBotoes.COMPORTAMENTO == "laranja" || i3GEO.barraDeBotoes.COMPORTAMENTO == "vermelho" || i3GEO.barraDeBotoes.COMPORTAMENTO == "cinza"){
if(ko >= 0){do{
var temp = $i(i3GEO.barraDeBotoes.LISTABOTOES[ko].iddiv);
if (temp)
{
var ist = temp.style;
ist.borderWidth="1px";
ist.borderColor='white';
ist.backgroundColor='white';
}
}while(ko--)}
if(i3GEO.barraDeBotoes.COMPORTAMENTO == "laranja"){var cor = "orange";}
if(i3GEO.barraDeBotoes.COMPORTAMENTO == "vermelho"){var cor = "red";}
if(i3GEO.barraDeBotoes.COMPORTAMENTO == "cinza"){var cor = "gray";}
//ativa o icone
if($i(icone))
{with ($i(icone).style){
borderColor='black';
borderWidth="1px";
backgroundColor=cor;
}}
}
},
/*
Function: ativaBotoes
Ativa os botoes definidos em LISTABOTOES
Os botoes são construídos e as funções definidas são embutidas no evento onclick
Parametro:
padrao (String} - botao que será mostrado como ativo (opcional).
Se não for definido, será utilizado o botão especificado em BOTAOPADRAO.
O nome do botao deve estar em LISTABOTOES na propriedade iddiv
*/
ativaBotoes:function(padrao){
if(arguments.length == 0)
{var padrao = i3GEO.barraDeBotoes.BOTAOPADRAO;}
i3GEO.barraDeBotoes.BOTAOCLICADO = padrao;
var l = i3GEO.barraDeBotoes.LISTABOTOES;
var b = l.length-1;
if (b >= 0){
do{
if ($i(l[b].iddiv)){
if(l[b].conteudo)
{eval('$i(l[b].iddiv).innerHTML = "'+l[b].conteudo+'"');}
if(l[b].dica){
eval('$i("'+l[b].iddiv+'").onmouseover = function(){i3GEO.ajuda.mostraJanela("'+l[b].dica+'","");}');
eval('$i("'+l[b].iddiv+'").onmouseout = function(){i3GEO.ajuda.mostraJanela("");};');
}
if(l[b].funcaoonclick){
$i(l[b].iddiv).onclick = l[b].funcaoonclick;
if(l[b].iddiv == padrao)
{l[b].funcaoonclick();}
}
if(l[b].constroiconteudo)
{eval(l[b].constroiconteudo);}
}
}
while (b--);
}
},
/*
Function: ativaBarraDeZoom
Ativa a barra de zoom deslizante
*/
ativaBarraDeZoom: function(){
$i("vertMaisZoom").onmouseover = function(){
i3GEO.ajuda.mostraJanela('Amplia o mapa mantendo o centro atual.');
};
$i("vertMaisZoom").onclick = function(){
$i("vertHandleDivZoom").onmousedown.call();
g_fatordezoom = 0;
$i("vertHandleDivZoom").onmousemove.call();
g_fatordezoom = -1;
$i("vertHandleDivZoom").onmousemove.call();
i3GEO.barraDeBotoes.BOTAOCLICADO = 'zoomin';
i3GEO.navega.zoomin();
g_fatordezoom = 0;
};
$i("vertMenosZoom").onmouseover = function(){
i3GEO.ajuda.mostraJanela('Reduz o mapa mantendo o centro atual.');
};
$i("vertMenosZoom").onclick = function(){
$i("vertHandleDivZoom").onmousedown.call();
g_fatordezoom = 0;
$i("vertHandleDivZoom").onmousemove.call();
g_fatordezoom = 1;
$i("vertHandleDivZoom").onmousemove.call();
i3GEO.barraDeBotoes.BOTAOCLICADO = 'zoomout';
i3GEO.navega.zoomout();
g_fatordezoom = 0;
};
},
/*
Function: inicializaBarra
Inicializa a barra de botões
Exemplo:
if ($i("barraDeBotoes1"))
i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes1","i3geo_barra1",true,x1,y1);
if ($i("barraDeBotoes2"))
i3GEO.barraDeBotoes.inicializaBarra("barraDeBotoes2","i3geo_barra2",false,x2,y2);
Os objetos criados são armazenados no array BARRAS, dessa forma, para acessar uma barra utilize
por exemplo:
i3GEO.barraDeBotoes.BARRAS[1].show();
Parametros:
idconteudo {String} - id do elemento existente no HTML e que contém as definições dos botões
idconteudonovo {String} - id do elemento que será criado para adicionar os botoões
barraZoom {boolean} - indica se a barra de zoom será incluída
x {Numeric} - posição x (pixels) da barra em relação ao mapa
y {Numeric} - posição y (pixels) da barra em relação ao mapa
*/
inicializaBarra:function(idconteudo,idconteudonovo,barraZoom,x,y){
var wj = "36px";
var recuo = "0px";
var novoel = document.createElement("div");
novoel.id = idconteudonovo;
novoel.style.display="block";
novoel.style.border="1px solid gray";
novoel.style.background="white";
if(i3GEO.barraDeBotoes.TRANSICAOSUAVE){
if (navm){
novoel.style.filter='alpha(opacity='+i3GEO.barraDeBotoes.OPACIDADE+')';
}
else{
novoel.style.opacity= i3GEO.barraDeBotoes.OPACIDADE / 100;
}
}
else{
if (navm)
{novoel.style.filter='alpha(opacity=90)';}
else
{novoel.style.opacity= .85;}
}
var temp = "";
if (barraZoom == true)
{
if (navn){temp += '<div style="text-align:center;position:relative;left:9px" >';}
var estilo = "top:4px;";
if(navm){var estilo = "top:4px;left:-2px;";}
temp += '<div id="vertMaisZoom" style="'+estilo+'"></div><div id="vertBGDiv" name="vertBGDiv" tabindex="0" x2:role="role:slider" state:valuenow="0" state:valuemin="0" state:valuemax="200" title="Zoom" >';
temp += '<div id="vertHandleDivZoom" ><img alt="" class="slider" src="'+i3GEO.util.$im("branco.gif")+'" /></div></div>';
if(navm)
temp += '<div id=vertMenosZoom style="left:-1px;" ></div>';
else
temp += '<div id=vertMenosZoom ></div>';
if (navn){temp += '</div>';}
}
temp += '<div id="'+idconteudonovo+'_" style="left:'+recuo+';top:-6px;" ></div>';
novoel.innerHTML = temp;
novoel.onmouseover = function(){
//objposicaocursor.imgx = 0;
if($i("i3geo_rosa"))
{$i("i3geo_rosa").style.display="none";}
if(i3GEO.barraDeBotoes.OPACIDADE){
if (navm)
{novoel.style.filter='alpha(opacity=90)';}
else
{novoel.style.opacity= .85;}
}
};
novoel.onmouseout = function(){
if(i3GEO.barraDeBotoes.TRANSICAOSUAVE){
if (navm)
{novoel.style.filter='alpha(opacity='+i3GEO.barraDeBotoes.OPACIDADE+')';}
else
{novoel.style.opacity= i3GEO.barraDeBotoes.OPACIDADE / 100;}
}
};
document.body.appendChild(novoel);
if(i3GEO.barraDeBotoes.ATIVAMENUCONTEXTO)
i3GEO.util.mudaCursor(i3GEO.configura.cursores,"contexto",idconteudonovo,i3GEO.configura.locaplic);
//copia os botoes do HTML para a janela
if ($i(idconteudo))
{
$i(idconteudonovo+"_").innerHTML = $i(idconteudo).innerHTML;
$i(idconteudo).innerHTML = "";
//faz o cálculo do número de botões que devem ficar visíveis em função do tamanho da barra
if(i3GEO.barraDeBotoes.AUTOALTURA){
var elementos = $i(idconteudonovo+"_").getElementsByTagName("img");
if(elementos[0].id == "sobeferramentas"){
try{
var elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
var alturadisponivel = i3GEO.parametros.h - 4;
var numerobotoes = parseInt(alturadisponivel / 30);
var nelementos = elementos.length;
var i = 0;
do{
elementos[i].style.display = "none";
var i = i + 1;
}
while(i < nelementos)
var i = 0;
do{
elementos[i].style.display = "inline";
var i = i + 1;
}
while(i < numerobotoes)
}catch(e){}
//alert(i+" "+numerobotoes)
if(i <= numerobotoes){
if($i("sobeferramentas")){$i("sobeferramentas").style.display="none";}
if($i("desceferramentas")){$i("desceferramentas").style.display="none";}
}
}
}
}
YAHOO.namespace("janelaBotoes.xp");
if(i3GEO.barraDeBotoes.AUTOALTURA == false || barraZoom == true )
YAHOO.janelaBotoes.xp.panel = new YAHOO.widget.Panel(idconteudonovo, {width:wj, fixedcenter: false, constraintoviewport: false, underlay:"none", close:i3GEO.barraDeBotoes.PERMITEFECHAR, visible:true, draggable:i3GEO.barraDeBotoes.PERMITEDESLOCAR, modal:false,iframe:false } );
else
YAHOO.janelaBotoes.xp.panel = new YAHOO.widget.Panel(idconteudonovo, {height:i3GEO.parametros.h - 4,width:wj, fixedcenter: false, constraintoviewport: false, underlay:"none", close:i3GEO.barraDeBotoes.PERMITEFECHAR, visible:true, draggable:i3GEO.barraDeBotoes.PERMITEDESLOCAR, modal:false,iframe:false } );
if((barraZoom == true) && $i("img")){
i3GEO.barraDeBotoes.ativaBarraDeZoom();
verticalSlider = YAHOO.widget.Slider.getVertSlider("vertBGDiv","vertHandleDivZoom", 0, 70);
verticalSlider.onChange = function(offsetFromStart)
{g_fatordezoom = (offsetFromStart - 35) / 5;};
verticalSlider.setValue(35,true);
if ($i("vertBGDiv")){
$i("vertBGDiv").onmouseup = function(){
i3GEO.navega.aplicaEscala(i3GEO.configura.locaplic,i3GEO.configura.sid,i3geo_ns);
g_fatordezoom = 0;
verticalSlider.setValue(35,true);
};
}
if($i("vertHandleDivZoom")){
$i("vertHandleDivZoom").onmousedown = function(){
i3GEO.barraDeBotoes.BOTAOCLICADO='slidezoom';
if (!$i("imgtemp")){
iclone=document.createElement('IMG');
iclone.style.position = "absolute";
iclone.id = "imgtemp";
iclone.style.border="1px solid blue";
$i("img").parentNode.appendChild(iclone);
}
var iclone = $i("imgtemp");
var corpo = $i("img");
if(!corpo){return;}
iclone.src = corpo.src;
iclone.style.width = i3GEO.parametros.w;
iclone.style.heigth = i3GEO.parametros.h;
iclone.style.top = corpo.style.top;
iclone.style.left = corpo.style.left;
$i("img").style.display = "none";
iclone.style.display = "block";
};
}
if($i("vertHandleDivZoom")){
$i("vertHandleDivZoom").onmousemove = function(){
var iclone = $i("imgtemp");
var corpo = $i("img");
if(!corpo){return;}
var nw = i3GEO.parametros.w;
var nh = i3GEO.parametros.h;
var nt = 0;
var nl = 0;
i3geo_ns = parseInt(i3GEO.parametros.mapscale);
if ((g_fatordezoom > 0) && (g_fatordezoom < 7)){
g_fatordezoom = g_fatordezoom + 1;
var velhoh = parseInt(iclone.style.height);
var velhow = parseInt(iclone.style.width);
var nh = i3GEO.parametros.h / g_fatordezoom;
var nw = i3GEO.parametros.w / g_fatordezoom;
var t = parseInt(iclone.style.top);
var l = parseInt(iclone.style.left);
var nt = t + ((velhoh - nh)*.5);
var nl = l + ((velhow - nw)*.5);
var fatorEscala = nh/i3GEO.parametros.h;
i3geo_ns=parseInt(i3GEO.parametros.mapscale / fatorEscala);
}
if ((g_fatordezoom < 0) && (g_fatordezoom > -7)){
g_fatordezoom = g_fatordezoom - 1;
var velhoh = parseInt(iclone.style.height);
var velhow = parseInt(iclone.style.width);
var nh = i3GEO.parametros.h * g_fatordezoom * -1;
var nw = i3GEO.parametros.w * g_fatordezoom * -1;
var t = parseInt(iclone.style.top);
var l = parseInt(iclone.style.left);
var nt = t - ((nh - velhoh)*.5);
var nl = l - ((nw - velhow)*.5);
var fatorEscala = nh/i3GEO.parametros.h;
i3geo_ns=parseInt(i3GEO.parametros.mapscale / fatorEscala);
}
if(iclone){
iclone.style.width = nw;
iclone.style.height = nh;
if (iclone.style.pixelTop)
{iclone.style.pixelTop=nt;}
else
{iclone.style.top=nt+"px";}
if (iclone.style.pixelLeft)
{iclone.style.pixelLeft=nl;}
else
{iclone.style.left=nl+"px";}
}
if ($i("i3geo_escalanum"))
{$i("i3geo_escalanum").value=i3geo_ns;}
};
}
}
YAHOO.janelaBotoes.xp.panel.render();
if(i3GEO.barraDeBotoes.AUTOALTURA == true){
var y = y - i3GEO.interface.BARRABOTOESTOP + 2;
var x = x - 3;
}
YAHOO.janelaBotoes.xp.panel.moveTo(x,y);
if($i("sobeferramentas")){
$i("sobeferramentas").onclick = function(){
var elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
var nelementos = elementos.length;
if(elementos[0].style.display == "inline" && elementos[0].id == "")
{return;}
if(elementos[1].style.display == "inline" && elementos[1].id == "")
{return;}
if(nelementos > 0){
var mostra = elementos[0];
var i = 0;
do{
if(elementos[i].style){
if(elementos[i].style.display == "inline" && elementos[i].id == "")
{break;}
if(elementos[i].style.display == "none" && elementos[i].id == "")
{var mostra = elementos[i];}
}
var i = i + 1;
}
while(i < nelementos)
mostra.style.display="inline";
//esconde o último botao
var i = nelementos - 1;
var mostra = elementos[i];
do{
if(elementos[i].style){
if(elementos[i].style.display == "inline")
{var mostra = elementos[i];break;}
}
var i = i - 1;
}
while(i >= 0)
mostra.style.display="none";
}
};
}
if($i("desceferramentas")){
$i("desceferramentas").onclick = function(){
var tipo = "inline";
if($i(idconteudonovo+"_")){
var elementos = $i(idconteudonovo+"_").getElementsByTagName("div");
if(elementos[elementos.length - 1].style.display == tipo)
{return;}
var nelementos = elementos.length;
if(nelementos > 0){
//esconde o primeiro botao
var i = 0;
do{
var e = elementos[i];
if(e.style){
if((e.style.display == "block") || (e.style.display == "inline") || (e.style.display == "")){
if(e.id == "")
{e.style.display="none";break;}
}
}
var i = i + 1;
}
while(i < nelementos)
//mostra o último botao
var i = nelementos-1;
var mostra = elementos[i];
do{
var e = elementos[i];
if(e.style){
if(e.style.display == tipo)
{break;}
if(e.style.display == "none")
{var mostra = e;}
}
var i = i - 1;
}
while(i >= 0)
mostra.style.display=tipo;
}
}
};
}
i3GEO.barraDeBotoes.BARRAS.push(YAHOO.janelaBotoes.xp.panel);
YAHOO.janelaBotoes.xp.panel.show();
//
//menu de contexto
//
if(i3GEO.barraDeBotoes.ATIVAMENUCONTEXTO){
i3GEO.barraDeBotoes.ativaMenuContexto(idconteudonovo);
}
if($i(idconteudonovo+"_h"))
$i(idconteudonovo+"_h").className = "hd2";
},
/*
Function: ativaMenuContexto
Ativa o menu de contexto acionado com o botão direito do mouse
Parametro:
idbarra - {string} id da barra de botões onde o evento será ativado
*/
ativaMenuContexto: function(idbarra){
function executar(a,b,c){
eval(c)
};
var oFieldContextMenuItemData = [
{ text: " <span class='container-close'></span>"},
{ text: "Fechar barra", onclick: { fn: executar, obj: "i3GEO.barraDeBotoes.fecha('"+idbarra+"')" } },
{ text: "Barra normal", onclick: { fn: executar, obj:"i3GEO.barraDeBotoes.AUTOALTURA=false;i3GEO.barraDeBotoes.PERMITEFECHAR=true;i3GEO.barraDeBotoes.PERMITEDESLOCAR=true;i3GEO.barraDeBotoes.recria('"+idbarra+"')" } },
{ text: "Barra fixa", onclick: { fn: executar, obj:"i3GEO.barraDeBotoes.AUTOALTURA=true;i3GEO.barraDeBotoes.PERMITEFECHAR=false;i3GEO.barraDeBotoes.PERMITEDESLOCAR=false;i3GEO.barraDeBotoes.recria('"+idbarra+"')" } },
{ text: "Remove transição", onclick: { fn: executar, obj:"i3GEO.barraDeBotoes.TRANSICAOSUAVE=false;" } },
{ text: "Ativa transição", onclick: { fn: executar, obj:"i3GEO.barraDeBotoes.TRANSICAOSUAVE=true;" } }
];
var oFieldContextMenu = new YAHOO.widget.ContextMenu(
"contexto_"+idbarra,{
trigger: idbarra,
itemdata: oFieldContextMenuItemData,
lazyload: true
}
);
var onFieldMenuRender = function(){
eval("var id = 'contexto_"+idbarra+"'");
$i(id).style.zIndex = 50000;
};
oFieldContextMenu.subscribe("render", onFieldMenuRender);
},
/*
Function: reativa
Reativa as barras de ferramentas já criadas
Essa opção apenas aplica o método "show" aos objetos armazenados em i3GEO.barraDeBotoes.BARRAS
Se a barra não existir previamente, nada irá contecer
Parametro:
indice {Integer} - índice do array BARRAS que guarda os objetos YAHOO com
as barras Se não for definido, todas as barras serão reativadas
*/
reativa: function(indice){
if(arguments.length == 1)
i3GEO.barraDeBotoes.BARRAS[indice].show();
else{
var n = i3GEO.barraDeBotoes.BARRAS.length;
for(i=0;i<n;i++){
i3GEO.barraDeBotoes.BARRAS[i].show();
}
}
},
/*
Function: recria
Recria uma barra de ferramentas já aberta aplicando os parâmetros de configuração definidos (variáveis)
Parametro:
id {String} - id da barra
*/
recria: function(id){
var n = i3GEO.barraDeBotoes.BARRAS.length;
for(i=0;i<n;i++){
if(i3GEO.barraDeBotoes.BARRAS[i].id == id){
//remove o menu de contexto
var temp = $i("contexto_"+id);
if(temp){
temp.parentNode.removeChild(temp);
}
var novoel = document.createElement("div");
novoel.id = "barraTemporaria"+i;
novoel.innerHTML = $i(i3GEO.barraDeBotoes.BARRAS[i].id+"_").innerHTML;
document.body.appendChild(novoel);
//verifica se tem o slide de zoom
var barraZoom = false;
var temp = $i("vertMaisZoom");
if(temp){
if(navm)
var temp = temp.parentNode;
else
var temp = temp.parentNode.parentNode;
if(temp.id == id){var barraZoom = true;}
}
var x = parseInt($i(i3GEO.barraDeBotoes.BARRAS[i].id+"_c").style.left);
var y = parseInt($i(i3GEO.interface.IDCORPO).style.top)+10;//parseInt($i(i3GEO.barraDeBotoes.BARRAS[i].id+"_c").style.top);
i3GEO.barraDeBotoes.BARRAS[i].destroy();
i3GEO.barraDeBotoes.inicializaBarra(novoel.id,i3GEO.barraDeBotoes.BARRAS[i].id+"x",barraZoom,x,y);
}
}
i3GEO.barraDeBotoes.ativaBotoes();
},
/*
Function: fecha
Fecha uma barra de ferramentas
Parametro:
id {String} - id que identifica a barra. Corresponde ao parâmetro idconteudonovo da função de inicialização das barras
*/
fecha: function(id){
var n = i3GEO.barraDeBotoes.BARRAS.length;
for(i=0;i<n;i++){
if(i3GEO.barraDeBotoes.BARRAS[i].id == id){
$i(id+"_c").style.visibility = "hidden";
}
}
}
};
//YAHOO.log("carregou classe barradebotoes", "Classes i3geo");