UIPainterView.st
changeset 82 99dc76d66eab
parent 80 3316c52ef2b7
child 86 06bdbae8bd8e
equal deleted inserted replaced
81:7493e2437af5 82:99dc76d66eab
   828     props view:anObject.
   828     props view:anObject.
   829     props spec:spec.
   829     props spec:spec.
   830     props name:(self uniqueNameFor:cls).
   830     props name:(self uniqueNameFor:cls).
   831     viewProperties add:props.
   831     viewProperties add:props.
   832 
   832 
   833     ((anObject respondsTo:#label:) and:[(spec respondsTo:#label:)]) ifTrue:[
   833     ((spec respondsTo:#label:) and:[self supportsLabel:anObject]) ifTrue:[
   834         anObject label:(props name).
   834         anObject label:(props name).
   835         spec label:(props name)
   835         spec label:(props name)
   836     ].
   836     ].
   837 
   837 
   838     undoHistory transaction:#create text:(props name) do:[
   838     undoHistory transaction:#create text:(props name) do:[
  1361     self singleSelection notNil ifTrue:[
  1361     self singleSelection notNil ifTrue:[
  1362         self withSelectionHiddenDo:[
  1362         self withSelectionHiddenDo:[
  1363             self transaction:#specification selectionDo:[:aView|
  1363             self transaction:#specification selectionDo:[:aView|
  1364                 builder := UIBuilder new.
  1364                 builder := UIBuilder new.
  1365                 props   := self propertyOfView:aView.
  1365                 props   := self propertyOfView:aView.
  1366                 name    := aSpec name.
  1366                 name    := (aSpec name) withoutSeparators.
  1367 
  1367 
  1368                 self undoSpecModify:(props identifier).
  1368                 name = props name ifFalse:[
  1369 
  1369                     (self propertyOfName:name) notNil ifTrue:[
  1370                 name = (aView name) ifFalse:[
  1370                         name := props name
  1371                     name notNil ifTrue:[
       
  1372                         name := name withoutSeparators.
       
  1373 
       
  1374                         (name isEmpty or:[(self propertyOfName:name) notNil]) ifTrue:[
       
  1375                             name := nil
       
  1376                         ]
       
  1377                     ].
       
  1378                     name isNil ifTrue:[
       
  1379                         aSpec name:(aView name).
       
  1380                     ]
  1371                     ]
  1381                 ].
  1372                 ].
       
  1373                 aSpec name:name.
       
  1374                 self undoSpecModify:(props identifier).
  1382 
  1375 
  1383                 aSpec needsRebuildForAttributes ifTrue:[
  1376                 aSpec needsRebuildForAttributes ifTrue:[
  1384                     v := aSpec buildViewWithLayoutFor:builder in:aView superView.
  1377                     v := aSpec buildViewWithLayoutFor:builder in:aView superView.
  1385                     v realize.    
  1378                     v realize.    
  1386                     aView destroy.
  1379                     aView destroy.
  1394 
  1387 
  1395                 props spec:(aSpec copy).
  1388                 props spec:(aSpec copy).
  1396             ]
  1389             ]
  1397         ].
  1390         ].
  1398         self changed:#tree
  1391         self changed:#tree
  1399     ].
  1392     ]
  1400 
       
  1401     "Modified: 1.3.1997 / 01:39:53 / cg"
       
  1402 ! !
  1393 ! !
  1403 
  1394 
  1404 !UIPainterView methodsFor:'testing'!
  1395 !UIPainterView methodsFor:'testing'!
  1405 
  1396 
  1406 isHorizontalResizable:aComponent
  1397 isHorizontalResizable:aComponent
  1442         ^ aComponent orientation == #vertical
  1433         ^ aComponent orientation == #vertical
  1443     ].
  1434     ].
  1444     ^ true
  1435     ^ true
  1445 
  1436 
  1446 
  1437 
       
  1438 !
       
  1439 
       
  1440 supportsLabel:aComponent
       
  1441     "returns true if component supports label
       
  1442     "
       
  1443     (aComponent respondsTo:#label:) ifTrue:[
       
  1444         (    (aComponent isKindOf:ArrowButton) 
       
  1445           or:[aComponent isKindOf:CheckToggle]
       
  1446         ) ifFalse:[
       
  1447             ^ true
       
  1448         ]
       
  1449     ].
       
  1450     ^ false
  1447 ! !
  1451 ! !
  1448 
  1452 
  1449 !UIPainterView methodsFor:'transaction'!
  1453 !UIPainterView methodsFor:'transaction'!
  1450 
  1454 
  1451 transaction:aType objects:something do:aOneArgBlock
  1455 transaction:aType objects:something do:aOneArgBlock