<?php 
function create_colorPicker( $colorPicker,
                          $colorPicker_Conf)
{
  global $modo_RAD, $_desenv_;

  if( $colorPicker_Conf['enabled'] == 'true' )
  {
    $enabled = "";
  }else
  {
    $enabled = "disabled";
  }// End if( $colorPicker_Conf['enabled'] == 'true' )
  if( $colorPicker_Conf['tab_index'] == 'auto' )
  {
    $tab_index = '';
  }else
  {
    $tab_index = $colorPicker_Conf['tab_index'];
  }//End if( $colorPicker_Conf['tab_index'] == 'auto' )
  
  writeTO( '  <label id="'.$colorPicker.'_Caption" '                      );
  writeTO( '         for="'.$colorPicker.'_Input" '                       );
  writeTO( '         ' .$enabled. '>'                                     );
  writeTO( '         ' . $colorPicker_Conf['caption'] . '</label>'        );
  writeTO( '  <input id="' . $colorPicker . '_Input"  '                   );
  writeTO( '         type="text" '                                        );
  writeTO( '         tipoCampo="'.$colorPicker_Conf['tipo_campo'].'" '    );
  writeTO( '         tipoDado="'.$colorPicker_Conf['tipo_dado'].'" '      );
  writeTO( '         value="'.$colorPicker_Conf['valor'].'" '             );
  writeTO( '         class="colorPicker_Input" '                          );
  writeTO( '         tab_index="'.$tab_index.'" '                         );
  writeTO( '         maxlength="'. $colorPicker_Conf['max_len'].'"'       );
  writeTO( '         ' .$enabled. '/>'                                    );
  writeTO( '  <img id="' . $colorPicker . '_Icone" src="imagens/button_color.gif" />' );
  writeTO( '  <div id="' .$colorPicker . '_Box"></div>'  );



  create_file_of_evento( "colorPicker", "onClick" );
  
  create_afterLoad_colorPicker( $colorPicker );
  //create_method_comboBox(    $comboBox ); <= *********************
}// End create_colorPicker()
   

/**
 *
 */
function create_colorPicker_css( $colorPicker,
                             	 $colorPicker_Global,
                              	 $colorPicker_Style,
			     	 $colorPicker_Conf)
{
  global $projeto, 
  		 $esquema;
  
 
  $visible = ( $colorPicker_Global['visibility'] == 'true' ) ? 'inherit':'hidden';
  $lenLabel    = $colorPicker_Conf['label_len'];
  $lenInput    = $colorPicker_Conf['input_len'];
  $initInput   = ( $lenLabel +12 );
  $colorBorder = '#808080';
  $topIcone  = 0;
  $leftIcone = $colorPicker_Global['width']-24;
  $lenDiv = $colorPicker_Global['width'] - $lenLabel - $lenInput + 61;
   if( $colorPicker_Conf['font_size'] == 'auto' )
  {
    $fontSize = $colorPicker_Global['fontSize'];
  }else
  {
    $fontSize = $colorPicker_Conf['font_size'];
  }// End if( $colorPicker_Conf['font_size'] == 'auto' )

  writeTO('  #' . $colorPicker . '{'                                       );
  writeTO('    position:absolute;'                                      );
  writeTO('    top:' . $colorPicker_Global['top'] . 'px;'                  );
  writeTO('    left:' . $colorPicker_Global['left'] .'px;'                 );
  writeTO('    '                                                        );    
  writeTO('    z-index:10;'                                             );
  writeTO('    '                                                        );    
  writeTO('    width:' . $colorPicker_Global['width']              . 'px;' );
  writeTO('    height:' . $colorPicker_Global['height']            . 'px;' );
  writeTO('    '                                                        );    
  writeTO( '    '                                                        );
  writeTO( '    color:' . $colorPicker_Conf['font_color']                 . ';' );
  writeTO('    '                                                        );
  writeTO('    visibility: ' .$visible. ';'                             );
  writeTO('    '                                                        );    
  writeTO('  }'                                                         );
  writeTO('  '                                                          );

  writeTO( '  #' . $colorPicker . '_Input{ '                                    );
  writeTO( '    position:absolute'                                 . ';' );
  writeTO( '    top:0px'                                           . ';' );
  writeTO( '    left:'.$initInput.'px'                             . ';' );
  writeTO( '    border-top:'    . $colorPicker_Style['borderTopInput']         . ';' );
  writeTO( '    border-bottom:' . $colorPicker_Style['borderBottomInput']      . ';' );
  writeTO( '    border-left:'   . $colorPicker_Style['borderLeftInput']        . ';' );
  writeTO( '    border-right:'  . $colorPicker_Style['borderRightInput']       . ';' );
  writeTO( '    '                                                        );
  writeTO( '    width:'.$lenInput . 'px'                           . ';' );
  writeTO( '  }'                                                         );
  writeTO( '  .' . $colorPicker . '_Input{ '                                    );
  writeTO( '    font-size:' . $fontSize . 'px'                     . ';' );
//  writeTO( '    width:'.$lenInput . 'px'                           . ';' );
//  writeTO( '    height:' . $colorPicker_Global['height']-2 . 'px'           . ';' );
  writeTO( '  }'                                                         );
  
  writeTO('  #' . $colorPicker . '_Icone{'                                 );
  writeTO('    position:absolute;'                                      );
  writeTO('    top:' .  $topIcone . 'px;'                               );
  writeTO('    left:' . $leftIcone .'px;'                               );
  writeTO('    '                                                          );    
  writeTO('    z-index:10;'                                             );
  writeTO('    width:24px'              . ';'                           );
  writeTO('    height:22px'            . ';'                            );
  writeTO('    visibility: inherit ;'                                   );
  writeTO('  }'                                                         );
  writeTO('  '                                                          );
  writeTO( '  #' . $colorPicker . '_Caption{ '                                  );
  writeTO( '    position:absolute;'                                      );
  writeTO( '    top:4px'                                           . ';' );
  writeTO( '    left:0px'                                          . ';' );
  writeTO( '    '                                                        );
  writeTO( '    font-size:' . $fontSize . 'px'   . ';' );
  writeTO( '    width:'.$lenLabel . 'px'                           . ';' );
  writeTO( '    height:' . $colorPicker_Global['height'] . 'px'           . ';' );
  writeTO( '  }'                                                         );
  
  writeTO('  #' . $colorPicker . '_Box{'                                 );
  writeTO('    position: absolute;'                                       );
  writeTO('    top: 1px;'                );
  writeTO('    left:' . $lenDiv .'px;'                 					);
  writeTO('    '                                                        );    
  writeTO('    z-index:10;'                                             );
  writeTO('    '                                                        );    
  writeTO('    width: 20px;' 											);
  writeTO('    height: 18px'           . ';');   
  writeTO('    '                                                        );
  writeTO('    backGround-color:#000000; '           . ';');
  writeTO('    visibility: inherit ;'                             );
  writeTO('    '                                                        );    
  writeTO('  }'                                                         );
  writeTO('  ');
}// End create_colorPicker() 


function create_colorPicker_control( $modo_RAD )
{
  global $componentes_no_Prj,
  		 $projeto,
		 $esquema;

  
  $path  = ( $modo_RAD )? _CFG_ : _CFG_;
  
  $nDest = $path . "colorPicker.control.js.php";
  $comp  = $componentes_no_Prj;

  $fp = @fopen( $nDest, 'wb' );
  foreach( $comp as $comp_ => $obj_ )
  {
    if( $comp_ == 'colorPicker' )
    {
      $nrObj  = 0;
      $arrObj = array();
      $arrConf= array();
      foreach( $obj_ as $i_ => $v_ )
      {
        $arrObj[ $nrObj ] = $i_;
        include($path . $i_ . ".config.def.php");
        $nConf = $i_ ."_Conf";
        $arrConf[$i_] = $$nConf;
		$nrObj ++;
      }// end foreach()
      writeTO( "colorPicker_obj      = ". $nrObj .";", $fp );
      writeTO( "colorPicker_selected = 0;"           , $fp );

    }// End if()
  }// End foreach()
  fclose( $fp );
  
  return( $nDest );    
}// End function()

function create_afterLoad_colorPicker( $nObj )
{
  $nFile = _INC_  . $nObj . "_afterLoad.js.php";

  if( !file_exists( $nFile ) )
  {
    $_fp_ = @fopen( $nFile, 'wb');
    @fwrite($_fp_, '<script language="javascript">' . NEWLINE );
    @fwrite($_fp_, '  '                             . NEWLINE );
    @fwrite($_fp_, '</script>'                      . NEWLINE );
    @fclose( $_fp_ );
  }// End if( !file_exists( $nFile ) )
}// End function create_afterLoad_comboBox( $nObj )

?> 
