hongji.li
2023-11-03 aefafd2142478d4fb07d6b8b45c3047e247389e0
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
Quintiq file version 2.0
#parent: CustomDrawComponent/CustomDrawDataLayerNode
Response OnDrawObject (
  Node object
) id:Response_CustomDrawComponent_CustomDrawDataLayerNode_OnDrawObject
{
  #keys: '[11660.0.305008485]'
  Body:
  [*
    // Draw node
    img := object.IconName();
    
    if( img = '' )
    {
      if( object.istype( UnitNode ) )
      {
        img := GlobalParameters_MP::GetDefaultUnitIcon();
      }
      else if( object.istype( StockingPointNode ) )
      {
        img := GlobalParameters_MP::GetDefaultStockingPointIcon();
      }
      else if( object.istype( ProductNode ) )
      {
        img := GlobalParameters_MP::GetDefaultProductIcon();
      }
    
    }
    
    minsize := minvalue ( object.Height(), object.Width() );
    surface.Image( region.Left(), region.Top(), minsize, minsize, img + '(32)' );
    
    /*
      If we are dragging an object which are not initially highlighted and some objects are already
      highlighted. We will flush all objects in DataHolderHighlight, then highlight the selected
      object and add it to DataHolderHighlight.
    */
    if( exists( DataHolderHighlight.Data(), Elements, u,u = object ) )
    {
      surface.Pen().Color( ColorScheme.Outline() );
      surface.Pen().Style( PenSpecification::StyleSolid() );
      surface.Pen().Width( 1 );
      surface.Draw( region );
    }
  *]
  DefinitionID: 'Responsedef_CustomDrawDataLayer_OnDrawObject'
  Precondition:
  [*
    return not isnull( DataHolderView.Data() );
  *]
}