<?php 
/**
 */
function create_toolBar( $toolBar, 
                         $toolBar_Icone )
{
  /*  declara as variáveis Globais  */
  $arr = array( 
    $toolBar . '_Hint_lang',
  );
  foreach( $arr as $_i => $ref )
  {  
    global $$ref;
  }

  foreach( $toolBar_Icone as $vButton => $imgName )
  {
    $tmp = $toolBar . '_Hint_lang';
    $arr = $$tmp;
    if ( strpos($vButton, 'button') )
    {
      $hint = $arr[$vButton];
    }else
    {
      $hint = "";
    }
    
    writeTO( '  <div id="' . $toolBar . $vButton.'">' );
    writeTO( '    <img id="' . $toolBar . $vButton . '_img" ' );
    writeTO( '         src="imagens/' . $imgName. '" ' );
    writeTO( '         alt="' . $hint . '" />' );
    writeTO( '  </div>' );
  }
}// End create_toolBar()


function create_toolBar_css( $toolBar,
                             $toolBar_Global,
                             $toolBar_Style,
                             $toolBar_Icone,
                             $toolBar_Conf )
{
  writeTO( '  ' );
  writeTO( '  #' . $toolBar . '{' );
  writeTO( '    position:absolute;' );
  writeTO( '    top:' . $toolBar_Global['top'] . 'px;' );
  writeTO( '    left:' . $toolBar_Global['left'] . 'px;' );
  writeTO( '    ' );    
  writeTO( '    z-index:10;' );
  writeTO( '    ' );    
  writeTO( '    width:' . $toolBar_Global['width'] . ';' );
  writeTO( '    height:' . $toolBar_Global['height']. ';' );
  writeTO( '    ' );    
  writeTO( '    color:' . $toolBar_Global['color'] . ';' );
  writeTO( '    background-color:' . $toolBar_Global['bgcolor'] . ';' );
  writeTO( '    ' );    
  writeTO( '    visibility:inherit;' );
  writeTO( '    ' );    
  writeTO( '    padding-top:0px;' );
  writeTO( '    padding-left:10px;' );
  writeTO( '    ' );    
  writeTO( '    border-top:'    . $toolBar_Style['borderTop']    . ';' );
  writeTO( '    border-bottom:' . $toolBar_Style['borderBottom'] . ';' );
  writeTO( '    border-left:'   . $toolBar_Style['borderLeft']   . ';' );
  writeTO( '    border-right:'  . $toolBar_Style['borderRight']  . ';' );
  writeTO( '  }' );
  writeTO( '  ' );  
  $ix = 0;
  if ( isset($toolBar_Icone) )
  {
    foreach( $toolBar_Icone as $vButton => $imgName )
    {
      $len = ( strpos($vButton, "button") ) ? $toolBar_Conf['b_width'] : 3;
      
      writeTO( '  #' . $toolBar . $vButton . '{  ' );
      writeTO( '    position:absolute;  ' );
      writeTO( '    top:0px;  ' );
      writeTO( '    left:' . $ix . 'px;  ' );
      writeTO( '  ' );    
      writeTO( '    z-index:inherit;  ' );
      writeTO( '    visibility:inherit;  ' );
      writeTO( '  ' );
      writeTO( '    width:' . $len . 'px;  ' );
      writeTO( '    height:'.$toolBar_Conf['b_width'].'px;  ' );
      writeTO( '  '                                           );
      writeTO( '    padding-top:'.$toolBar_Conf['x_padding'].'px;  '                        );
      writeTO( '    padding-left:'.$toolBar_Conf['y_padding'].'px;  '                       );
      writeTO( '  }  '                                        );  
      writeTO( '  '                                           );
      
      $ix += ( $len == $toolBar_Conf['b_width']) ? $toolBar_Conf['b_width'] + 5 : 10;
    }// End 
  }// End
      
}// End function()


function create_toolBar_config( $modo_RAD )
{
  global $componentes_no_Prj;

  $path  = ( $modo_RAD )? _CFG_ : CFG;
  $nDest = $path . "toolBar.config.php";
  
  $fp = @fopen( $nDest, 'wb' );
  foreach( $componentes_no_Prj as $comp_ => $obj_ )
  {
    if( $comp_ == 'toolBar' )
    {
      $nrObj  = 0;
      $arrObj = array();
      foreach( $obj_ as $i_ => $v_ )
      {
        $arrObj[ $nrObj ] = $i_;
        $nrObj ++;
      }// end foreach()
       
      writeTO( "toolBar_obj       = ". $nrObj . ";", $fp );
      writeTO( "toolBar_select    = new Array();"  , $fp );
      writeTO( "toolBar_selected  = new Array();"  , $fp );
      writeTO( "toolBar_nrButtons = new Array();"  , $fp );
      writeTO( "toolBar_status    = new Array();"  , $fp );
      writeTO( "  "       , $fp );

      for( $ix = 0; $ix < $nrObj; $ix ++)
      {
        $tmp = $arrObj[$ix]; 
        include( CFG . $tmp . ".config.button.php" );
        //echo $tmp . ".config.button.php";
        $tmp .= "_Button";
        $arr = $$tmp;
   
        $sel_ = $arrObj[$ix] . '_Select';
        $select = ( $$sel_ ) ? 'true' : 'false' ;
        
        writeTO( "toolBar_select[" . $ix . "]    = " . $select . ";"  , $fp );
        writeTO( "toolBar_selected[" . $ix . "]  = 1;"                , $fp );
        writeTO( "toolBar_nrButtons[" . $ix . "] = ".count($arr) . ";", $fp );
        writeTO( "toolBar_status[" . $ix . "] = new Array();"         , $fp );
        writeTO( "  "                                                 , $fp );
        
        $ind = 0;
        foreach( $arr as $ix_ => $stat_ )
        {
          writeTO( "toolBar_status[" . $ix . "][" . $ind . "] = ".$stat_ . ";", $fp );
          $ind ++;
        }// End foreach()
        writeTO( "  ", $fp );
      }// End for()
      writeTO( "  ", $fp );
      break;
    }// End if()
  }// End foreach() 
  fclose( $fp );
  
  return( $nDest );
}// End if()

?> 
 
