GraphColumnView2DSpec.st
author Claus Gittinger <cg@exept.de>
Thu, 26 Feb 1998 02:36:13 +0100
changeset 789 c2401c3c9e29
parent 753 0b6aaced2915
child 904 cdcb742f2038
permissions -rw-r--r--
added copyright & documentation

"
 COPYRIGHT (c) 1998 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.
"


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

!GraphColumnView2DSpec class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1998 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
"
    Not normally used by applications.

    [author:]
        Claus Atzkern

    [see also:]
        UIBuilder
        UIPainter
"
! !

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Graph 2D Detail'
              #'layout:' #(#LayoutFrame 62 0 143 0 435 0 446 0)
              #'label:' 'Graph 2D Detail'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1160 870)
              #'bounds:' #(#Rectangle 62 143 436 447)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#UISubSpecification
                    #'name:' 'subDetailsSpec'
                    #'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 186 0)
                    #'majorKey:' #GraphColumnViewSpec
                    #'minorKey:' #subDetailsEditSpec
                )
                 #(#CheckBoxSpec
                    #'name:' 'showGrid'
                    #'layout:' #(#Point 27 235)
                    #'tabable:' true
                    #'model:' #showGrid
                    #'label:' 'Show Grid'
                )
                 #(#InputFieldSpec
                    #'name:' 'extentXfield'
                    #'layout:' #(#LayoutFrame 161 0 197 0 190 0 219 0)
                    #'model:' #gridX
                )
                 #(#InputFieldSpec
                    #'name:' 'extentYfield'
                    #'layout:' #(#LayoutFrame 217 0 197 0 246 0 219 0)
                    #'model:' #gridY
                )
                 #(#LabelSpec
                    #'name:' 'extentYlabel'
                    #'layout:' #(#AlignmentOrigin 214 0 207 0 1 0.5)
                    #'label:' 'Y:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#LabelSpec
                    #'name:' 'extentXlabel'
                    #'layout:' #(#AlignmentOrigin 157 0 207 0 1 0.5)
                    #'label:' 'Grid Extent X:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
              )
          )
      )
! !

!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.

    aBuilder isEditing ifFalse:[
        aView gridExtent:(self gridX @ self gridY).

        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].

  ^ 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.5 1998-02-26 01:35:52 cg Exp $'
! !