UISelectionPanel.st
author tz
Fri, 30 Jan 1998 14:58:10 +0100
changeset 533 dde823aeca4c
parent 531 ca500f8698eb
child 598 fba415c8cf52
permissions -rw-r--r--
supports loading of subspecs

"
 COPYRIGHT (c) 1997 by Claus Gittinger / 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:#UISelectionPanel
	instanceVariableNames:'userClass userSpecs userLabels majorSelection clipBoardSpec'
	classVariableNames:'UserClass UserSpecs UserLabels'
	poolDictionaries:''
	category:'Interface-UIPainter'
!

Object subclass:#UserDefinedGallery
	instanceVariableNames:''
	classVariableNames:'LabelList SelectorList HolderList NextUniqueNumber'
	poolDictionaries:''
	privateIn:UISelectionPanel
!

!UISelectionPanel class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 by Claus Gittinger / 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
"
    implements a selection panel, keeping widgets which could be placed
    into the UIPainter by drag & drop.

    [start with:]
        UISelectionPanel open

    [author:]
        Claus Gittinger
        Claus Atzkern

    [see also:]
        TabView
        NoteBookView
        UIGalleryView
        UIPainter

"

! !

!UISelectionPanel class methodsFor:'initialization'!

initialize
    super initialize.
    UserClass  := UISelectionPanel::UserDefinedGallery.
    UserSpecs  := #listOfSelectors.
    UserLabels := #listOfLabels.

    "Modified: / 8.12.1997 / 18:53:06 / cg"
! !

!UISelectionPanel class methodsFor:'accessing'!

specifications

    ^ #(
        #( 'Standards'  #( 
                            #('Button & Toggle'         standardButtonToggle)
                            #('Menus'                   standardMenus)
                            #('Panel'                   standardPanels)
                            #('Text'                    standardText)
                            #('Lists'                   standartLists)
                            #('Views'                   standardViews)
                            #('Canvas'                  standardCanvas)
                            #('Sliders'                 standardSliders)
                         )
         )

        #( 'Clip Board'  #(
                            #('Copy & Paste Buffer'     clipBoardSpec)
                          )
         )

        #( 'User Def.'   #userDefined )
     )
!

userClass
    "return the class which provides the user defined gallery specs."

    ^ UserClass

    "Created: / 5.12.1997 / 15:12:50 / cg"
!

userClass:aClass specSelector:aSpecAccessSelector labelSelector:aLabelListAccessSelector
    "change the class which provides the user defined gallery specs."

    UserClass := aClass.
    UserSpecs := aSpecAccessSelector.
    UserLabels := aLabelListAccessSelector.

    "
     UISelectionPanel 
        userClass:UISelectionPanel::VariableUserDefinedGallery
        specSelector:#listOfSelectors
        labelSelector:#listOfLabels
    "

    "Modified: / 5.12.1997 / 13:54:47 / cg"
    "Created: / 5.12.1997 / 13:56:10 / cg"
! !

!UISelectionPanel class methodsFor:'interface specification'!

nameAndSelectorSpec
    "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:UISelectionPanel andSelector:#nameAndSelectorSpec
     UISelectionPanel new openInterface:#nameAndSelectorSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'Painter'
              #'bounds:' #(#Rectangle 0 0 315 216)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'title'
                    #'layout:' #(#Point 5 10)
                    #'label:' 'class & selectors to access user specs:'
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
                 #(#LabelSpec
                    #'name:' 'classLabel'
                    #'layout:' #(#AlignmentOrigin 68 0.11 51 0 1 0.5)
                    #'label:' 'Class:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'classField'
                    #'layout:' #(#LayoutFrame 74 0.11 39 0 -5 1.0 61 0)
                    #'tabable:' true
                    #'model:' #className
                    #'type:' #string
                )
                 #(#LabelSpec
                    #'name:' 'labelsLabel'
                    #'layout:' #(#AlignmentOrigin 68 0.11 74 0 1 0.5)
                    #'label:' 'Labels:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'labelsField'
                    #'layout:' #(#LayoutFrame 74 0.11 64 0 -5 1.0 86 0)
                    #'tabable:' true
                    #'model:' #labelsKey
                    #'type:' #symbolOrNil
                )
                 #(#LabelSpec
                    #'name:' 'specsLabel'
                    #'layout:' #(#AlignmentOrigin 68 0.11 99 0 1 0.5)
                    #'label:' 'Specifications:'
                    #'adjust:' #right
                    #'resizeForLabel:' true
                )
                 #(#InputFieldSpec
                    #'name:' 'specsField'
                    #'layout:' #(#LayoutFrame 74 0.11 89 0 -5 1.0 111 0)
                    #'tabable:' true
                    #'model:' #specsKey
                    #'type:' #symbolOrNil
                )
                 #(#HorizontalPanelViewSpec
                    #'name:' 'commitPanel'
                    #'layout:' #(#LayoutFrame 0 0.0 -23 1.0 0 1.0 0 1.0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#ActionButtonSpec
                              #'name:' 'cancel'
                              #'label:' 'cancel'
                              #'tabable:' true
                              #'model:' #cancel
                              #'extent:' #(#Point 153 23)
                          )
                           #(#ActionButtonSpec
                              #'name:' 'accept'
                              #'label:' 'ok'
                              #'tabable:' true
                              #'isDefault:' true
                              #'model:' #accept
                              #'extent:' #(#Point 153 23)
                          )
                        )
                    )
                    #'horizontalLayout:' #fitSpace
                    #'verticalLayout:' #fit
                    #'horizontalSpace:' 3
                    #'verticalSpace:' 3
                )
                 #(#CheckBoxSpec
                    #'name:' 'updateDefaultResources'
                    #'layout:' #(#Point 5 133)
                    #'model:' #updateDefaultResources
                    #'label:' 'Update Default Resources'
                )
              )
          )
      )
!

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:UISelectionPanel andSelector:#windowSpec
     UISelectionPanel new openInterface:#windowSpec
    "
    "UISelectionPanel open"

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Component Gallery'
              #'layout:' #(#LayoutFrame 78 0 70 0 598 0 352 0)
              #'label:' 'Component Gallery'
              #'min:' #(#Point 100 280)
              #'max:' #(#Point 1160 870)
              #'bounds:' #(#Rectangle 78 70 599 353)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#UIGalleryViewSpec
                    #'name:' 'gallery'
                    #'layout:' #(#LayoutFrame 0 0.0 0 0.0 -40 1.0 0 1.0)
                    #'tabable:' true
                    #'menu:' #galleryList
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'model:' #galleryModel
                    #'useIndex:' true
                    #'minorKeys:' #minorKeys
                    #'clientSpec:' #clientSpec
                    #'raiseMenu:' #raiseMenu
                )
                 #(#TabViewSpec
                    #'name:' 'major'
                    #'layout:' #(#LayoutFrame -40 1.0 30 0.0 0 1.0 0 1.0)
                    #'menu:' #majorList
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'model:' #majorChannel
                    #'direction:' #right
                    #'useIndex:' true
                )
              )
          )
      )
! !

!UISelectionPanel class methodsFor:'menus'!

menuSelected

    <resource: #menu>

    ^ #(#Menu #(
                #(#MenuItem
                        #'label:' 'copy'
                        #'value:' #copy
                 )
                #(#MenuItem
                        #'label:' 'cut'
                        #'value:' #cut
                 )
                )
               nil
               nil
        )

    "Modified: / 29.10.1997 / 03:20:30 / cg"
!

menuUnselected
    <resource: #menu>

    ^ #(#Menu #(
                #(#MenuItem
                        #'label:' 'paste'
                        #'value:' #paste
                 )
                )
               nil
               nil
        )

    "Modified: / 29.10.1997 / 03:20:38 / cg"
! !

!UISelectionPanel class methodsFor:'standard specifications'!

standardButtonToggle
    "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:UISelectionPanel andSelector:#standardButtonToggle
     UISelectionPanel new openInterface:#standardButtonToggle
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Buttons'
              #'layout:' #(#LayoutFrame 74 0 56 0 552 0 255 0)
              #'label:' 'Buttons'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 74 56 553 256)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ArrowButtonSpec
                    #'name:' 'ArrowButton up'
                    #'layout:' #(#LayoutFrame 276 0 15 0 298 0 37 0)
                    #'isTriggerOnDown:' true
                    #'direction:' #up
                )
                 #(#ActionButtonSpec
                    #'name:' 'Button'
                    #'layout:' #(#LayoutFrame 20 0 15 0 119 0 37 0)
                    #'label:' 'Button'
                )
                 #(#RadioButtonSpec
                    #'name:' 'RadioButton'
                    #'layout:' #(#LayoutFrame 135 0.0 15 0 258 0 37 0)
                    #'label:' 'RadioButton'
                    #'isTriggerOnDown:' true
                    #'showLamp:' true
                    #'lampColor:' #(#Color 100.0 100.0 0.0)
                )
                 #(#ArrowButtonSpec
                    #'name:' 'ArrowButton down'
                    #'layout:' #(#LayoutFrame 276 0 46 0 298 0 68 0)
                    #'isTriggerOnDown:' true
                    #'direction:' #down
                )
                 #(#ArrowButtonSpec
                    #'name:' 'ArrowButton left'
                    #'layout:' #(#LayoutFrame 276 0 77 0 298 0 99 0)
                    #'isTriggerOnDown:' true
                    #'direction:' #left
                )
                 #(#ArrowButtonSpec
                    #'name:' 'ArrowButton right'
                    #'layout:' #(#LayoutFrame 276 0 108 0 298 0 130 0)
                    #'isTriggerOnDown:' true
                    #'direction:' #right
                )
                 #(#CheckToggleSpec
                    #'name:' 'CheckToggle'
                    #'layout:' #(#LayoutFrame 317 0 77 0 337 0 97 0)
                    #'isTriggerOnDown:' true
                    #'showLamp:' false
                    #'lampColor:' #(#Color 100.0 100.0 0.0)
                )
                 #(#ToggleSpec
                    #'name:' 'Toggle'
                    #'layout:' #(#LayoutFrame 317 0 15 0 436 0 37 0)
                    #'label:' 'Toggle'
                    #'isTriggerOnDown:' true
                    #'showLamp:' true
                    #'lampColor:' #(#Color 100.0 100.0 0.0)
                )
                 #(#CheckBoxSpec
                    #'name:' 'CheckBox'
                    #'layout:' #(#LayoutFrame 317 0 46 0 436 0 68 0)
                    #'label:' 'CheckBox'
                )
                 #(#ActionButtonSpec
                    #'name:' 'Button - ok'
                    #'layout:' #(#LayoutFrame 20 0 46 0 119 0 68 0)
                    #'label:' 'ok'
                    #'model:' #accept
                )
                 #(#ActionButtonSpec
                    #'name:' 'Button - cancel'
                    #'layout:' #(#LayoutFrame 20 0 77 0 119 0 99 0)
                    #'label:' 'cancel'
                    #'model:' #cancel
                )
                 #(#ActionButtonSpec
                    #'name:' 'Button - help'
                    #'layout:' #(#LayoutFrame 20 0 108 0 119 0 130 0)
                    #'label:' 'help'
                    #'model:' #help
                )
                 #(#ActionButtonSpec
                    #'name:' 'Button - close'
                    #'layout:' #(#LayoutFrame 20 0 139 0 119 0 161 0)
                    #'label:' 'dismiss'
                    #'model:' #closeRequest
                )
                 #(#ButtonSpec
                    #'name:' 'ModelButton'
                    #'layout:' #(#LayoutFrame 135 0 139 0 234 0 161 0)
                    #'label:' 'ModelButton'
                )
              )
          )
      )

    "Modified: / 30.1.1998 / 04:35:59 / cg"
!

standardCanvas
    "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:UISelectionPanel andSelector:#standardCanvas
     UISelectionPanel new openInterface:#standardCanvas
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Canvas'
              #'layout:' #(#LayoutFrame 62 0 64 0 516 0 292 0)
              #'label:' 'Canvas'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1160 870)
              #'bounds:' #(#Rectangle 62 64 517 293)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#UIGalleryViewSpec
                    #'name:' 'Gallery'
                    #'layout:' #(#LayoutFrame 20 0 15 0 197 0 106 0)
                )
                 #(#LabelSpec
                    #'name:' 'GalleryLabel'
                    #'layout:' #(#Point 24 84)
                    #'label:' 'Gallery'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#UISubSpecification
                    #'name:' 'SubSpecification'
                    #'layout:' #(#LayoutFrame 218 0 15 0 395 0 106 0)
                )
                 #(#LabelSpec
                    #'name:' 'SubSpecificationLabel'
                    #'layout:' #(#Point 222 84)
                    #'label:' 'SubSpecification'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#SubCanvasSpec
                    #'name:' 'SubCanvas'
                    #'layout:' #(#LayoutFrame 20 0 126 0 197 0 217 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#LabelSpec
                    #'name:' 'subCanvasLabel'
                    #'layout:' #(#AlignmentOrigin 95 0 197 0 0 0)
                    #'label:' 'SubCanvas'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )
!

standardMenus
    "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:UISelectionPanel andSelector:#standardMenus
     UISelectionPanel new openInterface:#standardMenus
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Menus'
              #'layout:' #(#LayoutFrame 133 0 90 0 619 0 339 0)
              #'label:' 'Menus'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 133 90 620 340)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ComboBoxSpec
                    #'name:' 'ComboBox'
                    #'layout:' #(#LayoutFrame 20 0 15 0 145 0 35 0)
                )
                 #(#LabelSpec
                    #'name:' 'ComboBoxLabel'
                    #'layout:' #(#LayoutFrame 22 0 17 0 94 0 35 0)
                    #'label:' 'ComboBox'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#PopUpListSpec
                    #'name:' 'PopUpList'
                    #'layout:' #(#LayoutFrame 184 0 15 0 287 0 37 0)
                    #'label:' 'PopUpList'
                    #'useIndex:' false
                )
                 #(#TabViewSpec
                    #'name:' 'TabView'
                    #'layout:' #(#LayoutFrame 314 0 15 0 454 0 51 0)
                )
                 #(#ComboListSpec
                    #'name:' 'ComboList'
                    #'layout:' #(#LayoutFrame 20 0 71 0 145 0 91 0)
                    #'useIndex:' false
                )
                 #(#LabelSpec
                    #'name:' 'ComboListLabel'
                    #'layout:' #(#LayoutFrame 22 0 74 0 94 0 92 0)
                    #'label:' 'ComboList'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#MenuPanelSpec
                    #'name:' 'MenuPanel'
                    #'layout:' #(#LayoutFrame 184 0 71 0 285 0 94 0)
                )
                 #(#LabelSpec
                    #'name:' 'MenuPanelLabel'
                    #'layout:' #(#Point 190 74)
                    #'label:' 'MenuPanel'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#NoteBookViewSpec
                    #'name:' 'NoteBookView'
                    #'layout:' #(#LayoutFrame 314 0 71 0 454 0 159 0)
                )
                 #(#LabelSpec
                    #'name:' 'NoteBookLabel'
                    #'layout:' #(#Point 317 139)
                    #'label:' 'NoteBook'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#LabelSpec
                    #'name:' 'TabLabel'
                    #'layout:' #(#Point 326 28)
                    #'label:' 'Tabs'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )
!

standardPanels
    "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:UISelectionPanel andSelector:#standardPanels
     UISelectionPanel new openInterface:#standardPanels
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Panels'
              #'layout:' #(#LayoutFrame 88 0 80 0 596 0 298 0)
              #'label:' 'Panels'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 88 80 597 299)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#HorizontalPanelViewSpec
                    #'name:' 'HorizontalPanelView'
                    #'layout:' #(#LayoutFrame 20 0 15 0 104 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label1'
                              #'label:' 'A'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label2'
                              #'label:' 'B'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label3'
                              #'label:' 'C'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                        )
                    )
                    #'horizontalLayout:' #center
                    #'verticalLayout:' #center
                    #'horizontalSpace:' 3
                    #'verticalSpace:' 3
                )
                 #(#VariableHorizontalPanelSpec
                    #'name:' 'VariableHorizontalPanel'
                    #'layout:' #(#LayoutFrame 264 0 15 0 338 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label4'
                              #'label:' 'A'
                              #'level:' 2
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label5'
                              #'label:' 'B'
                              #'level:' 2
                              #'canUIDrag:' false
                          )
                        )
                    )
                    #'handles:' #(#Any 0.5 1.0)
                )
                 #(#VerticalPanelViewSpec
                    #'name:' 'VerticalPanelView'
                    #'layout:' #(#LayoutFrame 112 0 15 0 170 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label6'
                              #'label:' 'A'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label7'
                              #'label:' 'B'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label8'
                              #'label:' 'C'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                        )
                    )
                    #'horizontalLayout:' #center
                    #'verticalLayout:' #center
                    #'horizontalSpace:' 3
                    #'verticalSpace:' 3
                )
                 #(#VariableVerticalPanelSpec
                    #'name:' 'VariableVerticalPanel'
                    #'layout:' #(#LayoutFrame 347 0 15 0 421 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label9'
                              #'label:' 'A'
                              #'level:' 2
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label10'
                              #'label:' 'B'
                              #'level:' 2
                              #'canUIDrag:' false
                          )
                        )
                    )
                    #'handles:' #(#Any 0.5 1.0)
                )
                 #(#PanelViewSpec
                    #'name:' 'PanelView'
                    #'layout:' #(#LayoutFrame 178 0 15 0 236 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label11'
                              #'label:' 'A'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label12'
                              #'label:' 'B'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label13'
                              #'label:' 'C'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label14'
                              #'label:' 'D'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label15'
                              #'label:' 'E'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                        )
                    )
                    #'horizontalLayout:' #fitSpace
                    #'verticalLayout:' #fitSpace
                    #'horizontalSpace:' 3
                    #'verticalSpace:' 3
                )
                 #(#LabelSpec
                    #'name:' 'PanelLabel'
                    #'layout:' #(#LayoutFrame 22 0 120 0 235 0 143 0)
                    #'label:' 'Panels'
                    #'canUIDrag:' false
                )
                 #(#LabelSpec
                    #'name:' 'VPanelLabel'
                    #'layout:' #(#LayoutFrame 264 0 120 0 421 0 143 0)
                    #'label:' 'Variable Panels'
                    #'canUIDrag:' false
                )
              )
          )
      )
!

standardSliders
    "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:UISelectionPanel andSelector:#standardSliders
     UISelectionPanel new openInterface:#standardSliders
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Sliders'
              #'layout:' #(#LayoutFrame 197 0 175 0 641 0 336 0)
              #'label:' 'Sliders'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 197 175 642 337)
              #'usePreferredExtent:' false
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#SliderSpec
                    #'name:' 'Vertical Slider'
                    #'layout:' #(#LayoutFrame 20 0 15 0 38 0 108 0)
                    #'orientation:' #vertical
                    #'start:' 0
                    #'stop:' 100
                    #'step:' 1
                )
                 #(#ThumbWheelSpec
                    #'name:' 'Vertical ThumbWheel'
                    #'layout:' #(#LayoutFrame 48 0 15 0 63 0 108 0)
                    #'orientation:' #vertical
                    #'start:' 0
                    #'stop:' 360
                    #'step:' 1
                )
                 #(#ThumbWheelSpec
                    #'name:' 'Horizontal ThumbWheel'
                    #'layout:' #(#LayoutFrame 102 0 15 0 191 0 30 0)
                    #'orientation:' #horizontal
                    #'start:' 0
                    #'stop:' 360
                    #'step:' 1
                )
                 #(#SliderSpec
                    #'name:' 'Horizontal Slider'
                    #'layout:' #(#LayoutFrame 102 0 52 0 191 0 70 0)
                    #'orientation:' #horizontal
                    #'start:' 0
                    #'stop:' 100
                    #'step:' 1
                )
                 #(#ProgressIndicatorSpec
                    #'name:' 'Progress Indicator'
                    #'layout:' #(#LayoutFrame 102 0 90 0 191 0 108 0)
                    #'showPercentage:' true
                )
                 #(#ProgressIndicatorSpec
                    #'name:' 'Progress Indicator 2'
                    #'layout:' #(#LayoutFrame 102 0 116 0 191 0 126 0)
                    #'showPercentage:' false
                    #'foregroundColor:' #(#Color 100.0 0.0 0.0)
                )
                 #(#UpDownButtonSpec
                    #'name:' 'UpDownButton'
                    #'layout:' #(#Point 221 15)
                )
                 #(#UpDownButtonSpec
                    #'name:' 'upDownButton1'
                    #'layout:' #(#Point 245 15)
                    #'orientation:' #horizontal
                )
              )
          )
      )
!

standardText
    "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:UISelectionPanel andSelector:#standardText
     UISelectionPanel new openInterface:#standardText
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Text'
              #'layout:' #(#LayoutFrame 139 0 32 0 605 0 238 0)
              #'label:' 'Text'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 139 32 606 239)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#TextEditorSpec
                    #'name:' 'EditText'
                    #'layout:' #(#LayoutFrame 20 0 15 0 215 0 120 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#LabelSpec
                    #'name:' 'EditTextLabel'
                    #'layout:' #(#AlignmentOrigin 93 0 120 0 0 1)
                    #'label:' 'EditText'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#HTMLViewSpec
                    #'name:' 'HTMLView'
                    #'layout:' #(#LayoutFrame 240 0 15 0 436 0 120 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#LabelSpec
                    #'name:' 'HTMLViewLabel'
                    #'layout:' #(#AlignmentOrigin 314 0 120 0 0 1)
                    #'label:' 'HTMLView'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#InputFieldSpec
                    #'name:' 'EditField'
                    #'layout:' #(#LayoutFrame 20 0 142 0 215 0 164 0)
                )
                 #(#LabelSpec
                    #'name:' 'EditFieldLabel'
                    #'layout:' #(#LayoutFrame 55 0 144 0 115 0 162 0)
                    #'label:' 'EditField'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#LabelSpec
                    #'name:' 'Label'
                    #'layout:' #(#LayoutFrame 240 0 142 0 436 0 164 0)
                    #'label:' 'Label'
                )
              )
          )
      )
!

standardUserPanel
    "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:UISelectionPanel andSelector:#standardUserPanel
     UISelectionPanel new openInterface:#standardUserPanel
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'UserPanel'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'UserPanel'
              #'bounds:' #(#Rectangle 0 0 445 162)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'helpText'
                    #'layout:' #(#Point 10 0)
                    #'labelChannel:' #userDefinedHelpText
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )
!

standardViews
    "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:UISelectionPanel andSelector:#standardViews
     UISelectionPanel new openInterface:#standardViews
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Views'
              #'layout:' #(#LayoutFrame 158 0 56 0 637 0 284 0)
              #'label:' 'Views'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 158 56 638 285)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'name:' 'FramedBox'
                    #'layout:' #(#LayoutFrame 20 0 15 0 187 0 95 0)
                    #'label:' 'FramedBox'
                    #'labelPosition:' #topCenter
                )
                 #(#ArbitraryComponentSpec
                    #'name:' 'ArbitraryComponent'
                    #'layout:' #(#LayoutFrame 247 0 15 0 414 0 95 0)
                    #'hasBorder:' false
                )
                 #(#LabelSpec
                    #'name:' 'ArbitraryComponentLabel'
                    #'layout:' #(#AlignmentOrigin 253 0 21 0 0 0)
                    #'label:' 'ArbitraryComponent'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#DividerSpec
                    #'name:' 'Vertical Separator'
                    #'layout:' #(#LayoutFrame 20 0 115 0 24 0 195 0)
                    #'orientation:' #vertical
                )
                 #(#DividerSpec
                    #'name:' 'Horizontal Separator'
                    #'layout:' #(#LayoutFrame 20 0 115 0 126 0 119 0)
                    #'orientation:' #horizontal
                )
                 #(#LabelSpec
                    #'name:' 'SeparatorsLabel'
                    #'layout:' #(#AlignmentOrigin 126 0 135 0 1 0.5)
                    #'label:' 'Separators'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#RegionSpec
                    #'name:' 'Region'
                    #'layout:' #(#LayoutFrame 147 0 115 0 227 0 195 0)
                    #'lineWidth:' 2
                    #'regionType:' #ellipse
                )
                 #(#LabelSpec
                    #'name:' 'RegionLabel'
                    #'layout:' #(#AlignmentOrigin 186 0 155 0 0.5 0.5)
                    #'label:' 'Region'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#ViewSpec
                    #'name:' 'View'
                    #'layout:' #(#LayoutFrame 247 0 115 0 414 0 195 0)
                )
                 #(#LabelSpec
                    #'name:' 'ViewLabel'
                    #'layout:' #(#AlignmentOrigin 253 0 120 0 0 0)
                    #'label:' 'View'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )
!

standartLists
    "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:UISelectionPanel andSelector:#standartLists
     UISelectionPanel new openInterface:#standartLists
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Lists'
              #'layout:' #(#LayoutFrame 197 0 172 0 666 0 414 0)
              #'label:' 'Lists'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 197 172 667 415)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#SequenceViewSpec
                    #'name:' 'SelectionInList'
                    #'layout:' #(#LayoutFrame 247 0 15 0 452 0 109 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                    #'useIndex:' false
                )
                 #(#LabelSpec
                    #'name:' 'SelectionInListLabel'
                    #'layout:' #(#AlignmentOrigin 320 0 108 0 0 1)
                    #'label:' 'SelectionInList'
                    #'style:' #(#FontDescription #helvetica #medium #roman #'10')
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#SelectionInTreeViewSpec
                    #'name:' 'SelectionInTree'
                    #'layout:' #(#LayoutFrame 20 0 15 0 225 0 109 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#LabelSpec
                    #'name:' 'SelectionInTreeLabel'
                    #'layout:' #(#AlignmentOrigin 93 0 108 0 0 1)
                    #'label:' 'SelectionInTree'
                    #'style:' #(#FontDescription #helvetica #medium #roman #'10')
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#FileSelectionTreeSpec
                    #'name:' 'FileSelectionTree'
                    #'layout:' #(#LayoutFrame 20 0 130 0 225 0 224 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#LabelSpec
                    #'name:' 'FileSelectionTreeLabel'
                    #'layout:' #(#AlignmentOrigin 93 0 223 0 0 1)
                    #'label:' 'FileSelectionTree'
                    #'style:' #(#FontDescription #helvetica #medium #roman #'10')
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#DataSetSpec
                    #'name:' 'DataSetSpec'
                    #'layout:' #(#LayoutFrame 247 0 130 0 452 0 224 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#LabelSpec
                    #'name:' 'DataSetSpecLabel'
                    #'layout:' #(#AlignmentOrigin 320 0 223 0 0 1)
                    #'label:' 'DataSetView'
                    #'style:' #(#FontDescription #helvetica #medium #roman #'10')
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )
! !

!UISelectionPanel methodsFor:'actions'!

defineClassAndSelector
    |bd cls sel lbl|

    bd := IdentityDictionary new.
    bd at:#className put:( userClass asValue).
    bd at:#specsKey  put:( (userSpecs  ? '') asValue).
    bd at:#labelsKey put:( (userLabels ? '') asValue).
    bd at:#updateDefaultResources put:(false asValue).

    (self openDialogInterface:#nameAndSelectorSpec withBindings:bd) ifTrue:[
        (      (cls := (bd at:#className) value) notNil
          and:[(sel := (bd at:#specsKey)  value) notNil
          and:[(lbl := (bd at:#labelsKey) value) notNil]]
        ) ifTrue:[
            userClass  := cls.
            userSpecs  := sel.
            userLabels := lbl.

            (bd at:#updateDefaultResources) value ifTrue:[
                UserClass  := userClass.
                UserSpecs  := userSpecs.
                UserLabels := userLabels.
            ]
        ]
    ].
!

paste:something
    "paste something at a point
    "
    |coll specs point device gallery ext spec|

    clipBoardSpec isNil ifTrue:[
        clipBoardSpec := SpecCollection new.
        clipBoardSpec collection:(OrderedCollection new).
    ].
    coll    := clipBoardSpec collection.
    gallery := self builder componentAt:#gallery.
    device  := gallery device.

    point   := device translatePoint:(device pointerPosition)
                                from:(device rootView id)
                                  to:(gallery canvas id).

    point y < 1 ifTrue:[point y:1].
    ext := gallery extent - (10@10).

    (specs := something) isCollection ifFalse:[
        specs := Array with:something
    ].

    specs do:[:aSpec|
        point x > ext x ifTrue:[point x:1].
        point y > ext y ifTrue:[point y:1].

        spec := aSpec copy.
        spec layout:(LayoutOrigin fromPoint:point).
        coll add:spec.
        point := point + (20@20).
    ].
    gallery update.
!

raiseMenu
    "can open menu
    "
    |spec menu value paste|

    spec := self clientSpec value.

    spec notNil ifTrue:[
        menu := self class menuSelected decodeAsLiteralArray.
        self isClipBoard ifFalse:[
            (menu someMenuItemWithValue:#cut) disable.
        ].

        (value := menu startUp) == #cut ifTrue:[
            clipBoardSpec collection remove:spec ifAbsent:nil.
            (self builder componentAt:#gallery) update.
        ] ifFalse:[
            value == #copy ifTrue:[
                self window setSelection:spec
            ]
        ].
      ^ self
    ].

    self isUserBoard ifTrue:[
        ^ self defineClassAndSelector
    ].

    paste := self window getSelection.

    (self canPaste:paste) ifTrue:[
        menu := self class menuUnselected decodeAsLiteralArray.

        (menu startUp) == #paste ifTrue:[
            self paste:paste
        ]
    ].
! !

!UISelectionPanel methodsFor:'aspects'!

clientSpec
    "automatically generated by UIPainter ..."

    |holder|

    (holder := builder bindingAt:#clientSpec) isNil ifTrue:[
        builder aspectAt:#clientSpec put:(holder :=  ValueHolder new).
        holder addDependent:self.
    ].
    ^ holder
!

clipBoardSpec
    ^ clipBoardSpec
!

galleryList
    "automatically generated by UIPainter ..."

    |holder|

    (holder := builder bindingAt:#galleryList) isNil ifTrue:[
        builder aspectAt:#galleryList put:(holder :=  ValueHolder new).
    ].
    ^ holder
!

galleryModel
    "automatically generated by UIPainter ..."

    |holder|

    (holder := builder bindingAt:#galleryModel) isNil ifTrue:[
        builder aspectAt:#galleryModel put:(holder :=  ValueHolder new).
    ].
    ^ holder
!

majorChannel
    "automatically generated by UIPainter ..."

    |holder|

    (holder := builder bindingAt:#majorChannel) isNil ifTrue:[
        holder := AspectAdaptor new subject:self; forAspect:#majorSelection.
        builder aspectAt:#majorChannel put:holder.
    ].
    ^ holder
!

majorList
    "automatically generated by UIPainter ...
    "
  ^ self class specifications collect:[:el| el first]
!

minorKeys
    "automatically generated by UIPainter ..."

    |holder|

    (holder := builder bindingAt:#minorKeys) isNil ifTrue:[
        builder aspectAt:#minorKeys put:(holder :=  ValueHolder new).
    ].
    ^ holder
! !

!UISelectionPanel methodsFor:'change & update'!

update:something with:aParameter from:changedObject
    "one of my models changed its value
    "
    |channel label topView|

    (channel := self clientSpec) == changedObject ifTrue:[
        topView := builder window topView.

        (label := channel value) notNil ifTrue:[
            topView label:label name, ' '.
        ] ifFalse:[
            topView label:'Component Gallery '
        ]
    ].

    super update:something with:aParameter from:changedObject.


! !

!UISelectionPanel methodsFor:'drag & drop'!

canDrop:something in:aComponent
    ^ self canPaste:(something collect:[:el| el theObject ]).
!

drop:something in:aComponent at:aPoint

    |spc top|

    top := DragAndDropManager dragOriginatorQuerySignal raise topView.

    top == aComponent topView ifTrue:[
        spc := self clientSpec value.
        spc isNil ifTrue:[^ self].

        (clipBoardSpec collection remove:spc ifAbsent:nil) isNil ifTrue:[
            ^ self
        ].
    ] ifFalse:[
        spc := something collect:[:el| el theObject].
    ].
    self paste:spc.
! !

!UISelectionPanel methodsFor:'queries'!

canPaste:something
    "returns true if something could be paste
    "
    (self isClipBoard and:[something notNil]) ifTrue:[
        something isCollection ifTrue:[
            something notEmpty ifTrue:[
                ^ (something at:1) isKindOf:UISpecification
            ]
        ] ifFalse:[
            ^ something isKindOf:UISpecification
        ]
    ].
    ^ false

!

isClipBoard
    "returns true if current view is clip board
    "
    majorSelection ~~ 0 ifTrue:[
        ^ (self majorList at:majorSelection) startsWith:'Clip'
    ].
  ^ false
!

isUserBoard
    "returns true if current view is clip board
    "
    majorSelection ~~ 0 ifTrue:[
        ^ (self majorList at:majorSelection) startsWith:'User'
    ].
  ^ false
! !

!UISelectionPanel methodsFor:'selection'!

majorSelection
    ^ majorSelection ? 0
!

majorSelection:aSelection
    |spec channel|

    (majorSelection == aSelection or:[aSelection == 0]) ifTrue:[
        ^ self
    ].
    (self builder componentAt:#gallery) builder:nil.
    majorSelection := aSelection.
    spec := ((self class specifications) at:aSelection) last.

    spec isSymbol ifFalse:[
        self galleryList value:(spec collect:[:a| a first]).
        self minorKeys   value:(spec collect:[:a| a last]).
    ] ifTrue:[
        self perform:spec
    ].
    channel := self galleryModel.

    channel value notNil ifTrue:[
        channel setValue:nil
    ].
    channel value:1.

! !

!UISelectionPanel methodsFor:'startup / release'!

allButOpenInterface:aSpec
    "setup default values
    "
    super allButOpenInterface:aSpec.
    userClass  := UserClass.
    userSpecs  := UserSpecs.
    userLabels := UserLabels.
!

closeRequest
    |sav|

    (sav := masterApplication) notNil ifTrue:[
        masterApplication := nil.
        sav closeRequestFor:(self window).
        masterApplication := sav.
    ] ifFalse:[
        super closeRequest.
    ]

    "Modified: 28.7.1997 / 09:44:40 / cg"
!

initialize
    super initialize.
    majorSelection := 0.
!

openWindow
    "setup default values
    "
    super openWindow.
    "/ self window waitForExpose.
    Delay waitForSeconds:1.
    self majorChannel value:1.
! !

!UISelectionPanel methodsFor:'user defined'!

userDefined
    |cls lbl sel builder|

    cls := self resolveName:userClass.

    (cls notNil and:[(cls respondsTo:userLabels)]) ifTrue:[
        lbl := cls perform:userLabels.
        sel := Array new:(lbl size) withAll:#userDefinedSpec.
        self galleryList value:lbl.
        self minorKeys   value:sel.
    ] ifFalse:[
        builder := UIBuilder new isEditing:true.

        builder application:self.
        (self builder componentAt:#gallery) builder:builder. 
        self galleryList value:#( '???' ).
        self minorKeys   value:#( standardUserPanel ).
    ]
!

userDefinedHelpText

^ '
no user defined specifications are configured yet. To assign
user defined specifications to the gallery press the middle
button of your mouse to open a dialog.
'
!

userDefinedSpec
    |cls spc idx|

    cls := self resolveName:userClass.

    (cls notNil and:[(cls respondsTo:userSpecs)]) ifTrue:[
        spc := cls perform:userSpecs.
        idx := self galleryModel value.

        idx <= spc size ifTrue:[
            spc := spc at:idx.
            (cls respondsTo:spc) ifTrue:[
                ^ cls perform:spc
            ]
        ]
    ].
  ^ nil
! !

!UISelectionPanel::UserDefinedGallery class methodsFor:'class initialization'!

initialize
    "initialize my default user-def from the superclasses specs.
     I.e. provide a clocks entry"

    LabelList := self defaultListOfLabels asOrderedCollection.
    SelectorList := self defaultListOfSelectors asOrderedCollection.
    HolderList := OrderedCollection new grow:(SelectorList size).
    NextUniqueNumber := 1.

    UISelectionPanel 
        userClass:self
        specSelector:#listOfSelectors
        labelSelector:#listOfLabels.

    "
     self initialize
    "

    "Modified: / 5.12.1997 / 14:25:22 / cg"
    "Created: / 8.12.1997 / 18:49:42 / cg"
! !

!UISelectionPanel::UserDefinedGallery class methodsFor:'defaults'!

defaultListOfLabels
    ^ #( 'clocks' )

    "Created: / 8.12.1997 / 18:50:06 / cg"
!

defaultListOfSelectors
    ^ #( clocksSpec )

    "Modified: / 5.12.1997 / 14:03:55 / cg"
    "Created: / 8.12.1997 / 18:50:21 / cg"
! !

!UISelectionPanel::UserDefinedGallery class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1997 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
"
    The standard user-defined selectionPanel entry.
    Here, a single item named 'clocks' is provided, containing
    an analog and digital clock.
    This is a dump example; the actual user-defined panel may be
    extended dynamically.

    Frameworks which provide additional widgets may dynamically
    add more entries, by sending #addUserSpecHolder:label:
    or #removeUserSpecWithLabel:.
    Typically, this is done when a framework is loaded, by one of the
    frameworks class-initialization methods.

    [start with:]
        UISelectionPanel open

    [author:]
        Claus Gittinger
        Claus Atzkern

    [see also:]
        TabView
        NoteBookView
        UIGalleryView
        UIPainter

"


! !

!UISelectionPanel::UserDefinedGallery class methodsFor:'installation / deinstallation'!

addUserSpecHolder:aValueHolder label:aLabelString
    "add a new entry with the given label.
     The specHolder is typically either a spec, a valueHolder or a block.
     In any case, it should return a valid spec from the #value message.
     This spec is installed under that label."

    |syntheticSelector idx|

    syntheticSelector := ('userSpec' , NextUniqueNumber printString) asSymbol.
    NextUniqueNumber := NextUniqueNumber + 1.

    idx := LabelList indexOf:aLabelString.
    idx ~~ 0 ifTrue:[
        SelectorList at:idx put:syntheticSelector.
        HolderList at:idx put:aValueHolder
    ] ifFalse:[
        LabelList addLast:aLabelString.
        SelectorList addLast:syntheticSelector.
        HolderList addLast:aValueHolder
    ]

    "Modified: / 5.12.1997 / 14:13:17 / cg"
    "Created: / 8.12.1997 / 18:50:55 / cg"
!

removeUserSpecWithLabel:aLabelString
    "remove the spec which was previously installed under the given label"

    |idx|

    idx := LabelList indexOf:aLabelString.
    idx ~~ 0 ifTrue:[
        LabelList removeIndex:idx.
        SelectorList removeIndex:idx.
        HolderList removeIndex:idx
    ].

    "Modified: / 5.12.1997 / 14:13:45 / cg"
    "Created: / 8.12.1997 / 18:51:03 / cg"
! !

!UISelectionPanel::UserDefinedGallery class methodsFor:'user defined gallery'!

clocksSpec
    "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:UISelectionPanel::ExampleUserDefinedGallery andSelector:#clocksSpec
     UISelectionPanel::ExampleUserDefinedGallery new openInterface:#clocksSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'Interface Builder'
              #'layout:' #(#LayoutFrame 22 0 236 0 401 0 506 0)
              #'label:' 'Interface Builder'
              #'min:' #(#Point 10 10)
              #'max:' #(#Point 1280 1024)
              #'bounds:' #(#Rectangle 22 236 402 507)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ArbitraryComponentSpec
                    #'name:' 'ClockView'
                    #'layout:' #(#LayoutFrame 11 0 11 0 125 0 123 0)
                    #'component:' #ClockView
                    #'hasBorder:' false
                )
                 #(#ArbitraryComponentSpec
                    #'name:' 'DigitalClockView'
                    #'layout:' #(#LayoutOrigin 136 0 11 0)
                    #'component:' #DigitalClockView
                    #'hasBorder:' false
                )
              )
          )
      )

    "Modified: / 4.10.1997 / 15:12:27 / cg"
    "Created: / 8.12.1997 / 18:40:22 / cg"
!

listOfLabels
    ^ LabelList

    "Created: / 5.12.1997 / 13:43:03 / cg"
    "Modified: / 8.12.1997 / 18:51:20 / cg"
!

listOfSelectors
    ^ SelectorList

    "Created: / 5.12.1997 / 13:43:13 / cg"
    "Modified: / 8.12.1997 / 18:51:28 / cg"
! !

!UISelectionPanel::UserDefinedGallery class methodsFor:'user spec access'!

doesNotUnderstand:aMessage
    "catch queries for a userSpec"

    |sel idx|

    ((sel := aMessage selector) startsWith:'userSpec') ifTrue:[
        idx := SelectorList indexOf:sel.
        idx ~~ 0 ifTrue:[
            ^ (HolderList at:idx) value
        ]
    ].
    ^ super doesNotUnderstand:aMessage

    "Modified: / 5.12.1997 / 14:23:24 / cg"
    "Created: / 8.12.1997 / 18:51:50 / cg"
!

respondsTo:aSelector
    "catch queries for a userSpec"

    |idx|

    (aSelector startsWith:'userSpec') ifTrue:[
        idx := Number fromString:(aSelector copyFrom:9).
        idx := SelectorList indexOf:aSelector.
        idx ~~ 0 ifTrue:[^ true].
    ].
    ^ super respondsTo:aSelector

    "Modified: / 5.12.1997 / 14:19:55 / cg"
    "Created: / 8.12.1997 / 18:51:57 / cg"
! !

!UISelectionPanel class methodsFor:'documentation'!

version
    ^ '$Header$'
! !
UISelectionPanel initialize!