SubCanvas.st
changeset 2083 d7b305aea776
parent 1927 4cb8e4ecc425
child 2091 7f936283ea75
equal deleted inserted replaced
2082:fcb8b7ab1664 2083:d7b305aea776
   226 !SubCanvas methodsFor:'building'!
   226 !SubCanvas methodsFor:'building'!
   227 
   227 
   228 XXrebuild
   228 XXrebuild
   229     "rebuild
   229     "rebuild
   230     "
   230     "
   231     |v subSpec savedView builderClass boundsOrLayout|
   231 "/    | subSpec savedView builderClass boundsOrLayout|
   232 
   232 "/
   233     superView isNil ifTrue:[
   233 "/    superView isNil ifTrue:[
   234         lateBuild := true.
   234 "/        lateBuild := true.
   235         ^ self
   235 "/        ^ self
   236     ].
   236 "/    ].
   237 
   237 "/
   238     clientView notNil ifTrue:[
   238 "/    clientView notNil ifTrue:[
   239         clientView destroySubViews
   239 "/        clientView destroySubViews
   240     ].
   240 "/    ].
   241 
   241 "/
   242     spec notNil ifTrue:[
   242 "/    spec notNil ifTrue:[
   243         (subSpec := spec) isSymbol ifTrue:[
   243 "/        (subSpec := spec) isSymbol ifTrue:[
   244             client isNil ifTrue:[
   244 "/            client isNil ifTrue:[
   245                 'SubCanvas [warning]: no client - cannot build spec' infoPrintCR.
   245 "/                'SubCanvas [warning]: no client - cannot build spec' infoPrintCR.
   246                 ^ self
   246 "/                ^ self
   247             ].
   247 "/            ].
   248             (subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[
   248 "/            (subSpec := client class interfaceSpecFor:spec) isNil ifTrue:[
   249                 "/ Transcript showCR:'SubCanvas: nil spec'.
   249 "/                "/ Transcript showCR:'SubCanvas: nil spec'.
   250                 ^ self
   250 "/                ^ self
   251             ]
   251 "/            ]
   252         ].
   252 "/        ].
   253 
   253 "/
   254         builder isNil ifTrue:[
   254 "/        builder isNil ifTrue:[
   255             client isNil ifTrue:[
   255 "/            client isNil ifTrue:[
   256                 builderClass := UIBuilder
   256 "/                builderClass := UIBuilder
   257             ] ifFalse:[
   257 "/            ] ifFalse:[
   258                 builderClass := client builderClass
   258 "/                builderClass := client builderClass
   259             ].
   259 "/            ].
   260             builder := builderClass new.
   260 "/            builder := builderClass new.
   261         ].
   261 "/        ].
   262 
   262 "/
   263         "/ old:
   263 "/        "/ old:
   264 "/         builder buildFromSpec:subSpec in:clientView.
   264 "/"/         builder buildFromSpec:subSpec in:clientView.
   265 
   265 "/
   266         "/ new (let app know (somehow) that this is a build
   266 "/        "/ new (let app know (somehow) that this is a build
   267         "/ for a subcanvas (i.e. it can redefine the buildSubCanvase-method
   267 "/        "/ for a subcanvas (i.e. it can redefine the buildSubCanvase-method
   268         "/:
   268 "/        "/:
   269         savedView := builder window.
   269 "/        savedView := builder window.
   270         builder window:clientView.
   270 "/        builder window:clientView.
   271         [
   271 "/        [
   272             client buildSubCanvas:subSpec withBuilder:builder.
   272 "/            client buildSubCanvas:subSpec withBuilder:builder.
   273         ] valueNowOrOnUnwindDo:[
   273 "/        ] ensure:[
   274             builder window:savedView.
   274 "/            builder window:savedView.
   275         ].
   275 "/        ].
   276         clientViewIsScrolled ifTrue:[
   276 "/        clientViewIsScrolled ifTrue:[
   277             boundsOrLayout := builder spec window layout.
   277 "/            boundsOrLayout := builder spec window layout.
   278             boundsOrLayout isNil ifTrue:[
   278 "/            boundsOrLayout isNil ifTrue:[
   279                  boundsOrLayout := builder spec window bounds
   279 "/                 boundsOrLayout := builder spec window bounds
   280             ].
   280 "/            ].
   281             clientView
   281 "/            clientView
   282                 extent:(boundsOrLayout rectangleRelativeTo:self bounds preferred:nil) extent.
   282 "/                extent:(boundsOrLayout rectangleRelativeTo:self bounds preferred:nil) extent.
   283         ].
   283 "/        ].
   284 
   284 "/
   285         self realized ifTrue:[
   285 "/        self realized ifTrue:[
   286             clientView realizeAllSubViews
   286 "/            clientView realizeAllSubViews
   287         ]
   287 "/        ]
   288     ]
   288 "/    ]
   289 
   289 "/
   290     "Modified: / 20.6.1998 / 14:29:00 / cg"
   290 "/    "Modified: / 20.6.1998 / 14:29:00 / cg"
   291 !
   291 !
   292 
   292 
   293 container:aView
   293 container:aView
   294     super container:aView.
   294     super container:aView.
   295 
   295 
   304 !
   304 !
   305 
   305 
   306 rebuild
   306 rebuild
   307     "rebuild
   307     "rebuild
   308     "
   308     "
   309     |v subSpec savedView savedBuilder builderClass|
   309     | subSpec savedView savedBuilder builderClass|
   310 
   310 
   311     "/ if the superView is not yet created,
   311     "/ if the superView is not yet created,
   312     "/ we MUST delay building... (sigh)
   312     "/ we MUST delay building... (sigh)
   313     superView isNil ifTrue:[          
   313     superView isNil ifTrue:[          
   314         lateBuild := true.
   314         lateBuild := true.
   393             ] ifTrue:[
   393             ] ifTrue:[
   394                 (clientView isComponentOf:self) ifFalse:[
   394                 (clientView isComponentOf:self) ifFalse:[
   395                     self scrolledView:clientView.
   395                     self scrolledView:clientView.
   396                 ]
   396                 ]
   397             ]
   397             ]
   398         ] valueNowOrOnUnwindDo:[
   398         ] ensure:[
   399             savedView notNil ifTrue:[
   399             savedView notNil ifTrue:[
   400                 builder window:savedView.
   400                 builder window:savedView.
   401             ].
   401             ].
   402             useOwnBuilder ifTrue:[
   402             useOwnBuilder ifTrue:[
   403                 savedBuilder notNil ifTrue:[
   403                 savedBuilder notNil ifTrue:[
   545 ! !
   545 ! !
   546 
   546 
   547 !SubCanvas class methodsFor:'documentation'!
   547 !SubCanvas class methodsFor:'documentation'!
   548 
   548 
   549 version
   549 version
   550     ^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.41 2001-02-08 21:53:52 cg Exp $'
   550     ^ '$Header: /cvs/stx/stx/libwidg2/SubCanvas.st,v 1.42 2002-02-26 13:00:07 cg Exp $'
   551 ! !
   551 ! !