GraphColumnView2DSpec.st
author ca
Sat, 07 Feb 1998 16:13:55 +0100
changeset 740 9f14842f602e
child 742 287f20104462
permissions -rw-r--r--
initial checkin

GraphColumnViewSpec subclass:#GraphColumnView2DSpec
	instanceVariableNames:'gridX gridY actionBlock doubleClickBlock buttonReleaseBlock
		menuAccessBlock'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Support-UI-Specs'
!


!GraphColumnView2DSpec class methodsFor:'interface - painter'!

addBindingsTo:env for:inst channel:aChannel 

    super addBindingsTo:env for:inst channel:aChannel.

    self 
        adaptApects:
                    #(  
                        actionBlock
                        doubleClickBlock
                        buttonReleaseBlock
                        menuAccessBlock
                     )
        to:env 
        for:inst 
        channel:aChannel
        converter:#symbolOrNil.

    self 
        adaptApects:
                    #(  
                        gridX
                        gridY
                     )
        to:env 
        for:inst 
        channel:aChannel
        converter:#numberOrNil.

!

slices
    ^ #(
            (Basics    basicsEditSpec)
            (Details   detailsEditSpec)
            (Misc      basicsMiscSpec)
       )

! !

!GraphColumnView2DSpec class methodsFor:'interface specs'!

basicsMiscSpec
    "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:self andSelector:#basicsMiscSpec
     self new openInterface:#basicsMiscSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Graph 2D Misc'
              #'layout:' #(#LayoutFrame 219 0 193 0 559 0 417 0)
              #'label:' 'Graph 2D Misc'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1160 870)
              #'bounds:' #(#Rectangle 219 193 560 418)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'buttonCallbacks'
                    #'layout:' #(#LayoutOrigin 20 0 29 0)
                    #'label:' 'Button Event Callbacks:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#LabelSpec
                    #'name:' 'singleClickLabel'
                    #'layout:' #(#AlignmentOrigin 135 0 67 0 1 0.5)
                    #'label:' 'Single Click:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'singleClickField'
                    #'layout:' #(#LayoutFrame 139 0 55 0 -2 1 80 0)
                    #'model:' #actionBlock
                )
                 #(#LabelSpec
                    #'name:' 'doubleClickLabel'
                    #'layout:' #(#AlignmentOrigin 135 0 95 0 1 0.5)
                    #'label:' 'Double Click:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'doubleClickField'
                    #'layout:' #(#LayoutFrame 139 0 83 0 -2 1 108 0)
                    #'model:' #doubleClickBlock
                )
                 #(#LabelSpec
                    #'name:' 'releaseButtonLabel'
                    #'layout:' #(#AlignmentOrigin 135 0 124 0 1 0.5)
                    #'label:' 'Release Button:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'releaseButtonField'
                    #'layout:' #(#LayoutFrame 139 0 112 0 -2 1 137 0)
                    #'model:' #buttonReleaseBlock
                )
                 #(#LabelSpec
                    #'name:' 'menuAccessLabel'
                    #'layout:' #(#AlignmentOrigin 135 0 202 0 1 0.5)
                    #'label:' 'Menu Access:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'menuAccessField'
                    #'layout:' #(#LayoutFrame 139 0 190 0 -2 1 215 0)
                    #'model:' #menuAccessBlock
                )
                 #(#LabelSpec
                    #'name:' 'menuCallbacks'
                    #'layout:' #(#LayoutOrigin 20 0 165 0)
                    #'label:' 'Menu Callbacks:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
              )
          )
      )
!

detailsEditSpec
    "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:self andSelector:#detailsEditSpec
     self new openInterface:#detailsEditSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Graph 2D Detail'
              #'layout:' #(#LayoutFrame 219 0 193 0 561 0 434 0)
              #'label:' 'Graph 2D Detail'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1160 870)
              #'bounds:' #(#Rectangle 219 193 562 435)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'borderWidthLabel'
                    #'layout:' #(#AlignmentOrigin 157 0 35 0 1 0.5)
                    #'label:' 'Border Width:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'borderWidthField'
                    #'layout:' #(#LayoutFrame 161 0 24 0 197 0 46 0)
                    #'activeHelpKey:' #borderWidth
                    #'tabable:' true
                    #'model:' #borderWidth
                )
                 #(#LabelSpec
                    #'name:' 'levelLabel'
                    #'layout:' #(#AlignmentOrigin 157 0 60 0 1 0.5)
                    #'label:' 'Level:'
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'levelField'
                    #'layout:' #(#LayoutFrame 161 0 50 0 197 0 72 0)
                    #'activeHelpKey:' #level
                    #'tabable:' true
                    #'model:' #level
                )
                 #(#FramedBoxSpec
                    #'name:' 'gridFrame'
                    #'layout:' #(#LayoutFrame 0 0.0 165 0 0 1.0 226 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#CheckBoxSpec
                              #'name:' 'showGrid'
                              #'layout:' #(#Point 18 19)
                              #'tabable:' true
                              #'model:' #showGrid
                              #'label:' 'Show'
                          )
                           #(#LabelSpec
                              #'name:' 'extentXlabel'
                              #'layout:' #(#AlignmentOrigin 171 0 30 0 1 0.5)
                              #'label:' 'Extent x:'
                              #'adjust:' #left
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'extentXfield'
                              #'layout:' #(#LayoutFrame 172 0 20 0 215 0 42 0)
                              #'model:' #gridX
                          )
                           #(#LabelSpec
                              #'name:' 'extentYlabel'
                              #'layout:' #(#AlignmentOrigin 242 0 30 0 1 0.5)
                              #'label:' 'y:'
                              #'adjust:' #left
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'extentYfield'
                              #'layout:' #(#LayoutFrame 245 0 20 0 288 0 42 0)
                              #'model:' #gridY
                          )
                        )
                    )
                    #'label:' 'Grid'
                    #'labelPosition:' #topLeft
                )
                 #(#FramedBoxSpec
                    #'name:' 'aspectsFrame'
                    #'layout:' #(#LayoutFrame 0 0.0 81 0 0 1.0 161 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'windowSizeLabel'
                              #'layout:' #(#AlignmentOrigin 140 0 25 0 1 0.5)
                              #'label:' 'Window Size:'
                              #'adjust:' #left
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'windowSizeField'
                              #'layout:' #(#LayoutFrame 142 0 15 0 15 1.0 37 0)
                              #'model:' #windowSize
                          )
                           #(#LabelSpec
                              #'name:' 'zoomYLabel'
                              #'layout:' #(#AlignmentOrigin 140 0 53 0 1 0.5)
                              #'label:' 'Zoom-Y Factor:'
                              #'adjust:' #left
                              #'resizeForLabel:' true
                          )
                           #(#InputFieldSpec
                              #'name:' 'zoomYField'
                              #'layout:' #(#LayoutFrame 142 0 43 0 15 1.0 65 0)
                              #'model:' #zoomY
                          )
                        )
                    )
                    #'label:' 'Aspects'
                    #'labelPosition:' #topLeft
                )
              )
          )
      )
! !

!GraphColumnView2DSpec methodsFor:'accessing'!

actionBlock
    "return the value of the instance variable 'actionBlock' (automatically generated)"

    ^ actionBlock!

actionBlock:something
    "set the value of the instance variable 'actionBlock' (automatically generated)"

    actionBlock := something.!

buttonReleaseBlock
    "return the value of the instance variable 'buttonReleaseBlock' (automatically generated)"

    ^ buttonReleaseBlock!

buttonReleaseBlock:something
    "set the value of the instance variable 'buttonReleaseBlock' (automatically generated)"

    buttonReleaseBlock := something.!

doubleClickBlock
    "return the value of the instance variable 'doubleClickBlock' (automatically generated)"

    ^ doubleClickBlock!

doubleClickBlock:something
    "set the value of the instance variable 'doubleClickBlock' (automatically generated)"

    doubleClickBlock := something.!

gridX
    "return the value of the instance variable 'gridX' (automatically generated)"

    ^ gridX ? 0
!

gridX:something
    "set the value of the instance variable 'gridX' (automatically generated)"

    gridX := something.!

gridY
    "return the value of the instance variable 'gridY' (automatically generated)"

    ^ gridY ? 0
!

gridY:something
    "set the value of the instance variable 'gridY' (automatically generated)"

    gridY := something.!

menuAccessBlock
    "return the value of the instance variable 'menuAccessBlock' (automatically generated)"

    ^ menuAccessBlock!

menuAccessBlock:something
    "set the value of the instance variable 'menuAccessBlock' (automatically generated)"

    menuAccessBlock := something.! !

!GraphColumnView2DSpec methodsFor:'building'!

actionSelectors
    "add more action selectors
    "
    |more|

    more := super actionSelectors.

    actionBlock        notNil ifTrue:[more add:actionBlock].
    doubleClickBlock   notNil ifTrue:[more add:doubleClickBlock].
    buttonReleaseBlock notNil ifTrue:[more add:buttonReleaseBlock].
    menuAccessBlock    notNil ifTrue:[more add:menuAccessBlock].

  ^ more
!

defineCallBackActionFor:aSelector with:aBuilder

    |appl args|

    (     aSelector isNil
      or:[aBuilder isEditing
      or:[(appl := aBuilder application) isNil]]
    ) ifTrue:[
        ^ nil
    ].

    args := aSelector numArgs.

    args == 0 ifTrue:[ ^ [                 appl perform:aSelector] ].
    args == 1 ifTrue:[ ^ [:a1|             appl perform:aSelector with:a1] ].
    args == 2 ifTrue:[ ^ [:a1 :a2|         appl perform:aSelector with:a1 with:a2] ].
    args == 3 ifTrue:[ ^ [:a1 :a2 :a3|     appl perform:aSelector with:a1 with:a2 with:a3] ].
    args == 4 ifTrue:[ ^ [:a1 :a2 :a3 :a4| appl perform:aSelector with:a1 with:a2 with:a3 with:a4] ].

    ^ nil
!

setAttributesIn:aView with:aBuilder

    super setAttributesIn:aView with:aBuilder.

    aView gridExtent:(self gridX @ self gridY).

    aBuilder isEditing ifFalse:[
        aView             action:(self defineCallBackActionFor:actionBlock with:aBuilder).
        aView  doubleClickAction:(self defineCallBackActionFor:doubleClickBlock with:aBuilder).
        aView buttonReleaseBlock:(self defineCallBackActionFor:buttonReleaseBlock with:aBuilder).
        aView    menuAccessBlock:(self defineCallBackActionFor:menuAccessBlock with:aBuilder).
    ]
! !

!GraphColumnView2DSpec methodsFor:'converting'!

skippedInLiteralEncoding
    "define the inst-slots which are skiped when generating a literalArrayEncoding"

    |l|

    l := super skippedInLiteralEncoding asOrderedCollection.

    actionBlock        isNil ifTrue:[l add:actionBlock].
    doubleClickBlock   isNil ifTrue:[l add:doubleClickBlock].
    buttonReleaseBlock isNil ifTrue:[l add:buttonReleaseBlock].
    menuAccessBlock    isNil ifTrue:[l add:menuAccessBlock].

    self showGrid ifFalse:[
        l add:gridX.
        l add:gridY.
    ].
  ^ l




! !

!GraphColumnView2DSpec methodsFor:'parsing a view'!

fromView:aView callBack:aBlock

    gridX := aView gridX.
    gridY := aView gridY.

    super fromView:aView callBack:aBlock


! !

!GraphColumnView2DSpec class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libwidg2/GraphColumnView2DSpec.st,v 1.1 1998-02-07 15:13:15 ca Exp $'
! !