UISpecificationTool.st
changeset 1573 bf9c5ca8e48a
parent 1505 1577ee65ddc7
child 1578 c6fdfa52906d
equal deleted inserted replaced
1572:03046a9c70b1 1573:bf9c5ca8e48a
    22 	poolDictionaries:''
    22 	poolDictionaries:''
    23 	category:'Interface-UIPainter'
    23 	category:'Interface-UIPainter'
    24 !
    24 !
    25 
    25 
    26 ViewScroller subclass:#BuildInView
    26 ViewScroller subclass:#BuildInView
    27 	instanceVariableNames:'outerFrame'
    27 	instanceVariableNames:''
    28 	classVariableNames:''
    28 	classVariableNames:''
    29 	poolDictionaries:''
    29 	poolDictionaries:''
    30 	privateIn:UISpecificationTool
    30 	privateIn:UISpecificationTool
    31 !
    31 !
    32 
    32 
   792 
   792 
   793     "/ release resources
   793     "/ release resources
   794     specChannel release.
   794     specChannel release.
   795     aspects     release.
   795     aspects     release.
   796     selection := listOfSpecViews := nil.
   796     selection := listOfSpecViews := nil.
   797     buildInView destroyAllSubSpecs.
   797     buildInView destroyAllClientViews.
   798 
   798 
   799     (specification := aSpec) isNil ifTrue:[
   799     (specification := aSpec) isNil ifTrue:[
   800         aspects := specChannel := nil.
   800         aspects := specChannel := nil.
   801       ^ self
   801       ^ self
   802     ].
   802     ].
   813     specChannel := specification asValue.
   813     specChannel := specification asValue.
   814     specification class addBindingsTo:aspects for:specification channel:specChannel.
   814     specification class addBindingsTo:aspects for:specification channel:specChannel.
   815 
   815 
   816     "/ arrange for being notified, if any aspect changes
   816     "/ arrange for being notified, if any aspect changes
   817     aspects do:[:el| el addDependent:self ].
   817     aspects do:[:el| el addDependent:self ].
   818 
       
   819 ! !
   818 ! !
   820 
   819 
   821 !UISpecificationTool methodsFor:'actions'!
   820 !UISpecificationTool methodsFor:'actions'!
   822 
   821 
   823 setMaxExtent
   822 setMaxExtent
   908 !UISpecificationTool methodsFor:'initialization'!
   907 !UISpecificationTool methodsFor:'initialization'!
   909 
   908 
   910 initialize
   909 initialize
   911     super initialize.
   910     super initialize.
   912     buildInView := BuildInView new.
   911     buildInView := BuildInView new.
       
   912     buildInView keepViews:true.
   913 ! !
   913 ! !
   914 
   914 
   915 !UISpecificationTool methodsFor:'selection'!
   915 !UISpecificationTool methodsFor:'selection'!
   916 
   916 
   917 selection:something
   917 selection:something
   944     ].
   944     ].
   945 ! !
   945 ! !
   946 
   946 
   947 !UISpecificationTool::BuildInView methodsFor:'accessing'!
   947 !UISpecificationTool::BuildInView methodsFor:'accessing'!
   948 
   948 
   949 destroyAllSubSpecs
       
   950     "destroy all subViews which represents a specification
       
   951     "
       
   952     outerFrame destroySubViews.
       
   953 
       
   954     scrolledView notNil ifTrue:[
       
   955         scrolledView := nil.
       
   956         self sizeChanged:nil.
       
   957     ]
       
   958 
       
   959 
       
   960 !
       
   961 
       
   962 scrolledView:aView
   949 scrolledView:aView
   963     "set the view to be scrolled"
   950     "set the view to be scrolled"
   964     |scr theOneComponent y|
   951     |wrapper y|
   965 
   952 
   966     scrolledView == aView ifTrue:[^ self].
   953     scrolledView == aView ifTrue:[^ self].
   967 
   954 
   968     scrolledView notNil ifTrue:[scrolledView unmap].
   955     scrolledView notNil ifTrue:[scrolledView beInvisible].
   969 
   956 
   970     (scrolledView := aView) isNil ifTrue:[
   957     scrolledView := aView.
   971         ^ self
   958 
   972     ].
   959     (scrolledView notNil and:[scrolledView superView ~~ frame]) ifTrue:[
   973 
       
   974     scrolledView superView == outerFrame ifFalse:[
       
   975         scrolledView borderWidth:0; level:0.
   960         scrolledView borderWidth:0; level:0.
   976 
   961 
   977         outerFrame addSubView:scrolledView.
   962         frame addSubView:scrolledView.
       
   963 
   978         scrolledView subViews size == 1 ifTrue:[
   964         scrolledView subViews size == 1 ifTrue:[
   979             theOneComponent := scrolledView subViews first.
   965             wrapper := scrolledView subViews first.
   980             theOneComponent isScrollWrapper ifTrue:[
   966             wrapper isScrollWrapper ifTrue:[
   981                 "/ give it a full-relative size, and let it do
   967                 "/ give it a full-relative size, and let it do
   982                 "/ the scrolling itself.
   968                 "/ the scrolling itself.
   983                 y := 1.0
   969                 y := 1.0
   984             ]
   970             ]
   985         ].
   971         ].
   986         y isNil ifTrue:[
   972         y isNil ifTrue:[
   987             y := scrolledView preferredExtent y
   973             y := scrolledView preferredExtent y
   988         ].
   974         ].
   989         scrolledView origin:0@0 corner:1.0 @ y.
   975         scrolledView origin:0@0 corner:1.0 @ y.
   990         scrolledView := scrolledView.
       
   991         scrolledView allViewBackground:(self viewBackground).
   976         scrolledView allViewBackground:(self viewBackground).
   992     ].
   977     ].
   993 
   978 
   994     realized ifTrue:[
   979     realized ifTrue:[
   995         scrolledView realize.
   980         scrolledView ifNotNil:[scrolledView beVisible].
   996         self sizeChanged:nil.
   981         self sizeChanged:nil.
   997     ].
   982     ].
   998 
   983     model value:scrolledView.
   999 
       
  1000 
       
  1001 
       
  1002 
       
  1003 ! !
   984 ! !
  1004 
   985 
  1005 !UISpecificationTool::BuildInView methodsFor:'initialization'!
   986 !UISpecificationTool::BuildInView methodsFor:'initialization'!
  1006 
       
  1007 initialize
       
  1008     super initialize.
       
  1009     outerFrame := SimpleView origin:0.0@0.0 corner:1.0@1.0 in:self.
       
  1010     outerFrame borderWidth:0; level:0.
       
  1011 
       
  1012 
       
  1013 !
       
  1014 
   987 
  1015 level:aLevel
   988 level:aLevel
  1016     super level:0
   989     super level:0
  1017 !
   990 !
  1018 
   991