UIObjectView.st
changeset 1230 23e5d0c133e8
parent 1222 bcb8b0ec295c
child 1342 75be821d97c3
equal deleted inserted replaced
1229:49777692d309 1230:23e5d0c133e8
  1342     (view := self singleSelection) notNil ifTrue:[
  1342     (view := self singleSelection) notNil ifTrue:[
  1343 	aBlock value:view
  1343 	aBlock value:view
  1344     ]
  1344     ]
  1345 !
  1345 !
  1346 
  1346 
       
  1347 twoElementSelection
       
  1348     "checks whether exactly two elements are selected; 
       
  1349      in this case, return the selection collection.
       
  1350      otherwise return nil
       
  1351     "
       
  1352     |coll|
       
  1353 
       
  1354     (coll := self selection) isCollection ifFalse:[
       
  1355         ^ nil "/ single
       
  1356     ].
       
  1357 
       
  1358     coll size == 2 ifTrue:[ ^ coll].
       
  1359     ^ nil
       
  1360 !
       
  1361 
  1347 unselect
  1362 unselect
  1348     "clear selection
  1363     "clear selection
  1349     "
  1364     "
  1350     self select:nil
  1365     self select:nil
  1351 !
  1366 !
  1515 
  1530 
  1516     object notNil ifTrue:[
  1531     object notNil ifTrue:[
  1517 	copiedLayout := object geometryLayout copy
  1532 	copiedLayout := object geometryLayout copy
  1518     ] ifFalse:[
  1533     ] ifFalse:[
  1519 	self warn:'exactly one element must be selected'.
  1534 	self warn:'exactly one element must be selected'.
       
  1535     ]
       
  1536 
       
  1537 
       
  1538 
       
  1539 !
       
  1540 
       
  1541 exchangeLayouts
       
  1542     "exchange the layout of two elements 
       
  1543      (useful to change the order of radiobuttons or checkBoxes)
       
  1544     "
       
  1545     |objects l1 l2|
       
  1546 
       
  1547     objects := self twoElementSelection.
       
  1548 
       
  1549     objects notNil ifTrue:[
       
  1550         l1 := (objects at:1) geometryLayout copy.
       
  1551         l2 := (objects at:2) geometryLayout copy.
       
  1552         self transaction:#exchangeLayout dimensionDo:[:v|
       
  1553             v == (objects at:1) ifTrue:[
       
  1554                 v geometryLayout:(l2 copy)
       
  1555             ] ifFalse:[
       
  1556                 v geometryLayout:(l1 copy).
       
  1557             ]
       
  1558         ]    
       
  1559     ] ifFalse:[    
       
  1560         self warn:'exactly two elements must be selected'.
  1520     ]
  1561     ]
  1521 
  1562 
  1522 
  1563 
  1523 
  1564 
  1524 !
  1565 !