MenuView.st
changeset 3752 9c3b292df738
parent 3551 8cca2a43e849
child 3903 e18c6e99186e
equal deleted inserted replaced
3751:8c607457ad94 3752:9c3b292df738
  2517 preferredExtent 
  2517 preferredExtent 
  2518     "compute & return my preferredExtent from labels width's"
  2518     "compute & return my preferredExtent from labels width's"
  2519 
  2519 
  2520     |margin2 w h extra|
  2520     |margin2 w h extra|
  2521 
  2521 
  2522     "/ If I have an explicit preferredExtent ..
  2522     "/ If I have an explicit preferredExtent..
  2523 
  2523     explicitExtent notNil ifTrue:[
       
  2524         ^ explicitExtent
       
  2525     ].
       
  2526 
       
  2527     "/ If I have a cached preferredExtent value..
  2524     preferredExtent notNil ifTrue:[
  2528     preferredExtent notNil ifTrue:[
  2525 	^ preferredExtent
  2529         ^ preferredExtent
  2526     ].
  2530     ].
  2527 
  2531 
  2528     widthOfWidestLine := nil.  "/ i.e. unknown
  2532     widthOfWidestLine := nil.  "/ i.e. unknown
  2529 
  2533 
  2530     margin2 := margin * 2.
  2534     margin2 := margin * 2.
  2531     w := self widthOfContents + leftMargin + leftMargin + margin2.
  2535     w := self widthOfContents + leftMargin + leftMargin + margin2.
  2532     h := (self numberOfLines) * fontHeight - lineSpacing + (2 * topMargin) + margin2.
  2536     h := (self numberOfLines) * fontHeight - lineSpacing + (2 * topMargin) + margin2.
  2533     hilightLevel ~~ 0 ifTrue:[
  2537     hilightLevel ~~ 0 ifTrue:[
  2534 	h := h + (hilightLevel abs)
  2538         h := h + (hilightLevel abs)
  2535     ].
  2539     ].
  2536 
  2540 
  2537     extra := 0.
  2541     extra := 0.
  2538     "if there is a submenu, add some space for the right arrow"
  2542     "if there is a submenu, add some space for the right arrow"
  2539     subMenus notNil ifTrue:[
  2543     subMenus notNil ifTrue:[
  2540 	extra := 16
  2544         extra := 16
  2541     ].
  2545     ].
  2542     ((ShowAcceleratorKeys ~~ false) and:[shortKeys notNil]) ifTrue:[
  2546     ((ShowAcceleratorKeys ~~ false) and:[shortKeys notNil]) ifTrue:[
  2543 	extra := extra max:(self shortKeyInset) + 10 "/ spacing
  2547         extra := extra max:(self shortKeyInset) + 10 "/ spacing
  2544     ].
  2548     ].
  2545     ^ ((w+extra) @ h).
  2549     ^ ((w+extra) @ h).
  2546 
  2550 
  2547     "Modified: 23.1.1997 / 02:36:17 / cg"
  2551     "Modified: 23.1.1997 / 02:36:17 / cg"
  2548 !
  2552 !
  2902 ! !
  2906 ! !
  2903 
  2907 
  2904 !MenuView class methodsFor:'documentation'!
  2908 !MenuView class methodsFor:'documentation'!
  2905 
  2909 
  2906 version
  2910 version
  2907     ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.154 2008-02-05 14:17:20 cg Exp $'
  2911     ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.155 2008-10-26 20:08:36 stefan Exp $'
  2908 ! !
  2912 ! !