PopUpList.st
changeset 5819 ef8ff5a9d801
parent 5781 df53f4aa2dc7
child 5946 109da6018257
equal deleted inserted replaced
5818:303a3073eb68 5819:ef8ff5a9d801
  1008 !
  1008 !
  1009 
  1009 
  1010 rawLabelSizeOf:aLogo
  1010 rawLabelSizeOf:aLogo
  1011     "compute the extent needed to hold the label plus the mark"
  1011     "compute the extent needed to hold the label plus the mark"
  1012 
  1012 
  1013     |ext mmH mmV longest longestWidth labels currentDeviceFont|
  1013     |ext mmH mmV longest longestWidth labels deviceFont|
  1014 
  1014 
  1015     ext := super rawLabelSizeOf:aLogo.
  1015     ext := super rawLabelSizeOf:aLogo.
  1016 
  1016 
  1017     (menu notNil 
  1017     (menu notNil 
  1018     and:[adjust ~~ #right
  1018     and:[adjust ~~ #right
  1019     and:[adjust ~~ #center]]) ifTrue:[
  1019     and:[adjust ~~ #center]]) ifTrue:[
  1020         "compute length of longest menu entry"
  1020         "compute length of longest menu entry"
  1021 
  1021 
  1022         currentDeviceFont := gc createFontOnDevice.
  1022         deviceFont := gc deviceFont.
  1023         longest := logo.
  1023         longest := logo.
  1024         logo isNil ifTrue:[
  1024         logo isNil ifTrue:[
  1025             longestWidth := 0
  1025             longestWidth := 0
  1026         ] ifFalse:[
  1026         ] ifFalse:[
  1027             longestWidth := currentDeviceFont widthOf:logo.
  1027             longestWidth := deviceFont widthOf:logo.
  1028         ].
  1028         ].
  1029         labels := menu value labels.
  1029         labels := menu value labels.
  1030         labels notNil ifTrue:[
  1030         labels notNil ifTrue:[
  1031             labels do:[:entry |
  1031             labels do:[:entry |
  1032                 |this|
  1032                 |this|
  1033 
  1033 
  1034                 this := currentDeviceFont widthOf:entry printString.
  1034                 this := deviceFont widthOf:entry printString.
  1035                 this > longestWidth ifTrue:[
  1035                 this > longestWidth ifTrue:[
  1036                     longest := entry.
  1036                     longest := entry.
  1037                     longestWidth := this
  1037                     longestWidth := this
  1038                 ].
  1038                 ].
  1039             ].
  1039             ].