Quintiq file version 2.0
#parent: CustomDrawComponentRoutingConfigurator/CustomDrawDataLayerOperationInput
Response OnDrawObject (
  OperationInput object
) id:Response_CustomDrawComponentRoutingConfigurator_CustomDrawDataLayerOperationInput_OnDrawObject
{
  #keys: '[110994.0.1918845886]'
  Body:
  [*
    // Draw operation input                                                                              
    
    //Initialize borders
    surface.Pen().Style( PenSpecification::StyleSolid() );
    surface.Pen().Width( 1 )
    surface.Pen().Color( ColorScheme.Outline() );
    
    // Using if-else stmt as splitting it into 2 responses with the same object type binding doesn't work
    if( object.IsElementOfInputGroup() )
    {
      color := ColorScheme.RoutingConfigurator_ElementOfInputGroup();
    
      if( object.IsFloating() )
      {
        color := ColorScheme.RoutingConfigurator_FloatingProduct();
      }
    
      diameter := minvalue( region.Width(), region.Height() );
      left := [Number]( region.Width()/2 ) - [Number]( diameter/2 );
    
      circle := Shape::Circle( left, region.Top(), diameter )
      surface.Fill( circle, color );
      surface.Circle( left, region.Top(), diameter, surface.Pen().Color() );
    }
    else
    {   
      colorstart := ColorScheme.RoutingConfigurator_OperationInputOutput1();
      colorend := ColorScheme.RoutingConfigurator_OperationInputOutput2();
    
      // Set color to black if operation is being disabled
      if( not object.Operation().IsEnabled() )
      {
        colorstart := ColorScheme.RoutingConfiguratorDisabled_InputOutput();
        colorend := ColorScheme.RoutingConfiguratorDisabled_InputOutput();
      }
      else if( object.IsFloating() )
      {
        colorstart := ColorScheme.RoutingConfigurator_FloatingProduct();
        colorend := ColorScheme.RoutingConfigurator_FloatingProduct();
      }
    
      surface.Brush().LinearGradient( region, colorstart, colorend, 0.0 )
      surface.Fill( region );
      surface.Rect( region.Left(), region.Top(), region.Width(), region.Height(), Color::Black() );  
      
      //Initialize text
      rcv := DataHolderRCView.Data();
      surface.Font().Name( rcv.FontName() );
      surface.Font().Size( rcv.FontSize() );
      surface.TextColor( Color::Black() );
      
      textformat := TextFormat::Construct( TextFormat::AlignCenter(), TextFormat::AlignMiddle() );
      surface.Text( region, text, textformat );
    }
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_CustomDrawDataLayer_OnDrawObject'
  Precondition:
  [*
    return not isnull( DataHolderRCView.Data() );
  *]
}
