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 ! |