DialogBox.st
changeset 132 596439fe4efd
parent 131 208fa92f434d
child 133 e58c7c979f33
equal deleted inserted replaced
131:208fa92f434d 132:596439fe4efd
    23 
    23 
    24 !DialogBox class methodsFor:'documentation'!
    24 !DialogBox class methodsFor:'documentation'!
    25 
    25 
    26 version
    26 version
    27 "
    27 "
    28 $Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.16 1995-06-27 02:22:28 claus Exp $
    28 $Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.17 1995-07-03 02:32:30 claus Exp $
    29 "
    29 "
    30 !
    30 !
    31 
    31 
    32 documentation
    32 documentation
    33 "
    33 "
  1136 
  1136 
  1137 addComponent:aComponent withExtent:ext 
  1137 addComponent:aComponent withExtent:ext 
  1138     "add a component with some given extent.
  1138     "add a component with some given extent.
  1139      Returns the component."
  1139      Returns the component."
  1140 
  1140 
       
  1141     |fullSize|
       
  1142 
  1141     self basicAddComponent:aComponent.
  1143     self basicAddComponent:aComponent.
  1142     aComponent extent:ext.
  1144     fullSize := ext + (leftIndent + rightIndent @ 0).
       
  1145     aComponent extent:fullSize.
  1143     aComponent origin:0.0@yPosition; 
  1146     aComponent origin:0.0@yPosition; 
  1144 	       leftInset:leftIndent; 
  1147 	       leftInset:leftIndent; 
  1145 	       rightInset:rightIndent.
  1148 	       rightInset:rightIndent.
  1146     yPosition := yPosition + aComponent height + ViewSpacing.
  1149     yPosition := yPosition + aComponent height + ViewSpacing.
       
  1150     width := fullSize x max:width.
  1147     ^ aComponent
  1151     ^ aComponent
  1148 !
  1152 !
  1149 
  1153 
  1150 addComponent:aComponent tabable:tabable
  1154 addComponent:aComponent tabable:tabable
  1151     "add a component with its preferred height and full width.
  1155     "add a component with its preferred height and full width.
  1464     buttonPanel setChildPositionsIfChanged.
  1468     buttonPanel setChildPositionsIfChanged.
  1465     ^ (okButton originRelativeTo:self) + (okButton extent // 2)
  1469     ^ (okButton originRelativeTo:self) + (okButton extent // 2)
  1466 !
  1470 !
  1467 
  1471 
  1468 preferredExtent 
  1472 preferredExtent 
  1469     "return my preferred extent"
  1473     "return my preferred extent.
       
  1474      That is the max component width, or my current width (default);
       
  1475      whichever is larger, by the sum of the components heights."
  1470 
  1476 
  1471     |w h p|
  1477     |w h p|
  1472 
  1478 
  1473     addedComponents notNil ifTrue:[
  1479     addedComponents notNil ifTrue:[
  1474 	w := addedComponents 
  1480 	w := addedComponents 
  1479 			eExt := element preferredExtent x. "/ max:element extent x.
  1485 			eExt := element preferredExtent x. "/ max:element extent x.
  1480 			max max:(eExt + element leftInset)].
  1486 			max max:(eExt + element leftInset)].
  1481     ] ifFalse:[
  1487     ] ifFalse:[
  1482 	w := super preferredExtent x.
  1488 	w := super preferredExtent x.
  1483     ].
  1489     ].
       
  1490     w := w max:width.
  1484     h := yPosition
  1491     h := yPosition
  1485 	 + ViewSpacing.
  1492 	 + ViewSpacing.
  1486 
  1493 
  1487     buttonPanel subViews size ~~ 0 ifTrue:[
  1494     buttonPanel subViews size ~~ 0 ifTrue:[
  1488 	p := buttonPanel preferredExtent.
  1495 	p := buttonPanel preferredExtent.