# HG changeset patch # User ca # Date 866827568 -7200 # Node ID 1bc26edd0d3e63b54664a4c7b1bfb2cf57a8149a # Parent dff48b7ca574b9658c5bd5187459a95b08db493a intitial checkin diff -r dff48b7ca574 -r 1bc26edd0d3e UISpecificationTool.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UISpecificationTool.st Fri Jun 20 19:26:08 1997 +0200 @@ -0,0 +1,210 @@ +" + COPYRIGHT (c) 1995 by eXept Software AG + All Rights Reserved + + This software is furnished under a license and may be used + only in accordance with the terms of that license and with the + inclusion of the above copyright notice. This software may not + be provided or otherwise made available to, or used by, any + other person. No title to or ownership of the software is + hereby transferred. +" + + + + +ApplicationModel subclass:#UISpecificationTool + instanceVariableNames:'modifiedHolder aspects specClass specEdited specChannel' + classVariableNames:'' + poolDictionaries:'' + category:'Interface-UIPainter' +! + +!UISpecificationTool class methodsFor:'documentation'! + +copyright +" + COPYRIGHT (c) 1995 by eXept Software AG + All Rights Reserved + + This software is furnished under a license and may be used + only in accordance with the terms of that license and with the + inclusion of the above copyright notice. This software may not + be provided or otherwise made available to, or used by, any + other person. No title to or ownership of the software is + hereby transferred. +" + + + +! + +documentation +" + used by the UIPainter to manipulate the specifications of the selected component + + [author:] + Claus Atzkern + + [see also:] + UIPainter + UILayoutTool + UIHelpTool +" +! ! + +!UISpecificationTool class methodsFor:'interface specs'! + +windowSpec + "this window spec was automatically generated by the ST/X UIPainter" + + "do not manually edit this - the painter/builder may not be able to + handle the specification if its corrupted." + + " + UIPainter new openOnClass:UISpecificationTool andSelector:#windowSpec + UISpecificationTool new openInterface:#windowSpec + " + "UISpecificationTool open" + + + + ^ + + #(#FullSpec + #'window:' + #(#WindowSpec + #'name:' 'uIPainterView' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + #'label:' 'unnamed canvas' + #'bounds:' #(#Rectangle 0 0 300 300) + ) + #'component:' + #(#SpecCollection + #'collection:' + #( + #(#ViewSpec + #'name:' 'Frame' + #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) + ) + ) + ) + ) +! ! + +!UISpecificationTool methodsFor:'accessing'! + +modifiedHolder:aValueHolder + "set the value holder set to true in case of modifying attributes + " + modifiedHolder notNil ifTrue:[ + modifiedHolder removeDependent:self. + ]. + + (modifiedHolder := aValueHolder) notNil ifTrue:[ + modifiedHolder addDependent:self. + ]. + +! + +update + "reload specification + " + specChannel notNil ifTrue:[ + specChannel value:specEdited. + ] + + +! ! + +!UISpecificationTool methodsFor:'bindings'! + +aspectFor:aKey + "returns aspect for a key or nil + " + aspects notNil ifTrue:[ + ^ aspects at:aKey ifAbsent:nil + ]. + ^ super aspectFor:aKey + +! + +specEdited + "gets current edit specification + " + ^ specEdited + + +! + +specEdited:aSpec + "sets current edit specification + " + aSpec isNil ifTrue:[ + specChannel := nil. + specEdited := nil. + aspects := nil. + ] ifFalse:[ + specEdited class == aSpec class ifTrue:[ + specEdited := aSpec. + ^ specChannel value:specEdited. + ]. + specEdited := aSpec. + aspects := IdentityDictionary new. + specChannel := specEdited asValue. + specEdited class addBindingsTo:aspects for:specEdited channel:specChannel. + aspects do:[:el| el addDependent:self ]. + ]. + + specClass notNil ifTrue:[ + (builder componentAt:#Frame) destroySubViews. + specClass := nil. + ]. +! ! + +!UISpecificationTool methodsFor:'change & update'! + +update:something with:someArgument from:someone + "any attribute changed its state in the current specification + " + someone ~~ modifiedHolder ifTrue:[ + modifiedHolder value ~~ true ifTrue:[ + modifiedHolder value:true + ] + ] + + +! ! + +!UISpecificationTool methodsFor:'selection'! + +selection:something + |slices idx spec frame| + + specEdited notNil ifTrue:[ + slices := specEdited class slices. + idx:= slices findFirst:[:aSlice| aSlice first = something ]. + + idx ~~ 0 ifTrue:[ + spec := specEdited class perform:((slices at:idx) last). + ]. + ]. + + spec ~= specClass ifTrue:[ + frame := builder componentAt:#Frame. + frame destroySubViews. + + spec notNil ifTrue:[ + builder buildFromSpec:spec in:frame. + frame allViewBackground:(frame viewBackground). + frame realizeAllSubViews. + ] + ]. + specClass := spec. +! ! + +!UISpecificationTool class methodsFor:'documentation'! + +version + ^ '$Header$' +! !