UISelectionPanel.st
author Claus Gittinger <cg@exept.de>
Tue, 10 Jan 2006 14:32:38 +0100
changeset 1953 3b5022bccca4
parent 1943 ecc231b19955
child 2009 b919406a99f8
permissions -rw-r--r--
drag and drop cleanup

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



"{ Package: 'stx:libtool2' }"

ApplicationModel subclass:#UISelectionPanel
	instanceVariableNames:'gallery 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
    UserClass  := UISelectionPanel::UserDefinedGallery.
    UserSpecs  := #listOfSelectors.
    UserLabels := #listOfLabels.

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

!UISelectionPanel class methodsFor:'accessing'!

specifications

    ^ #(
        #( 'Standard'  #( 
                            #('Buttons' standardButtons)
                            #('Menus'   standardMenus)
                            #('Text'    standardTexts)
                            #('Lists'   standardLists)
                            #('Trees'   standardTrees)
                            #('Groups'  standardGroups)
                            #('Embed'   standardEmbed)
                            #('Misc'    standardMisc)
                         )
         )

        #( 'Clipboard'  #(
                            #('Copy & Paste Buffer'     clipBoardSpec)
                          )
         )

        #( 'User Def.'   #userDefined )
     )

    "Modified: / 21.4.1998 / 12:04:22 / cg"
!

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:'classAccess'!

galleryClass

    ^ UserDefinedGallery
! !

!UISelectionPanel class methodsFor:'interface specs'!

nameAndSelectorSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#nameAndSelectorSpec
     UISelectionPanel new openInterface:#nameAndSelectorSpec
    "

    <resource: #canvas>

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

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#windowSpec
     UISelectionPanel new openInterface:#windowSpec
     UISelectionPanel open
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: windowSpec
        window: 
       (WindowSpec
          label: 'Widget Gallery'
          name: 'Widget Gallery'
          min: (Point 100 280)
          bounds: (Rectangle 14 46 508 348)
        )
        component: 
       (SpecCollection
          collection: (
           (NoteBookViewSpec
              name: 'NoteBook1'
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              model: majorChannel
              menu: majorList
              direction: right
              useIndex: true
              canvas: gallery
            )
           )
         
        )
      )
! !

!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:'resources'!

classResources
    "my translations are found in the UIPainter classes resources"

    ^ UIPainter classResources 
! !

!UISelectionPanel class methodsFor:'standard specifications'!

standardButtons
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#standardButtons
     UISelectionPanel new openInterface:#standardButtons
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: standardButtons
        window: 
       (WindowSpec
          label: 'Buttons'
          name: 'Buttons'
          min: (Point 10 10)
          bounds: (Rectangle 16 52 456 210)
        )
        component: 
       (SpecCollection
          collection: (
           (ActionButtonSpec
              label: 'Button'
              name: 'Button'
              layout: (LayoutFrame 2 0 1 0 127 0 23 0)
              translateLabel: true
            )
           (ActionButtonSpec
              label: 'OK'
              name: 'Button - OK'
              layout: (LayoutFrame 2 0 33 0 127 0 55 0)
              translateLabel: true
              model: doAccept
            )
           (ActionButtonSpec
              label: 'Cancel'
              name: 'Button - Cancel'
              layout: (LayoutFrame 2 0 65 0 127 0 87 0)
              translateLabel: true
              model: doCancel
            )
           (ActionButtonSpec
              label: 'Help'
              name: 'Button - Help'
              layout: (LayoutFrame 2 0 97 0 127 0 119 0)
              translateLabel: true
              model: help
            )
           (ActionButtonSpec
              label: 'Close'
              name: 'Button - Close'
              layout: (LayoutFrame 2 0 129 0 127 0 151 0)
              translateLabel: true
              model: closeRequest
            )
           (ToggleSpec
              label: 'Toggle'
              name: 'Toggle'
              layout: (LayoutFrame 144 0 1 0 280 0 23 0)
              translateLabel: true
              isTriggerOnDown: true
              lampColor: (Color 100.0 100.0 0.0)
            )
           (RadioButtonSpec
              label: 'Radio Button'
              name: 'Radio Button'
              layout: (LayoutFrame 144 0.0 33 0 280 0 55 0)
              translateLabel: true
              isTriggerOnDown: true
            )
           (CheckBoxSpec
              label: 'Check Box'
              name: 'Check Box'
              layout: (LayoutFrame 144 0 65 0 280 0 87 0)
              translateLabel: true
            )
           (CheckToggleSpec
              name: 'Check Toggle'
              layout: (LayoutOrigin 144 0 99 0)
              isTriggerOnDown: true
              showLamp: false
              lampColor: (Color 100.0 100.0 0.0)
            )
           (LabelSpec
              label: 'Check Toggle'
              name: 'CheckToggleLabel'
              layout: (AlignmentOrigin 170 0 98 0 0 0)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (ButtonSpec
              label: 'Model Button'
              name: 'Model Button'
              layout: (LayoutFrame 296 0 1 0 432 0 23 0)
              translateLabel: true
            )
           (LabelSpec
              label: 'Spin Button'
              name: 'UpDownButtonLabel'
              layout: (AlignmentOrigin 348 0 35 0 0 0)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (UpDownButtonSpec
              name: 'UpDown Button'
              layout: (LayoutFrame 296 0 33 0 341 0 55 0)
              orientation: horizontal
            )
           (LabelSpec
              label: 'Arrow Button'
              name: 'ArrowButtonsLabel'
              layout: (AlignmentOrigin 348 0 69 0 0 0)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (ArrowButtonSpec
              name: 'Arrow Button'
              layout: (LayoutFrame 296 0 65 0 318 0 87 0)
              isTriggerOnDown: true
              direction: right
            )
           )
         
        )
      )
!

standardEmbed
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#standardEmbed
     UISelectionPanel new openInterface:#standardEmbed
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: standardEmbed
        window: 
       (WindowSpec
          label: 'Misc'
          name: 'Misc'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 456 269)
        )
        component: 
       (SpecCollection
          collection: (
           (ArbitraryComponentSpec
              name: 'Arbitrary Component'
              layout: (LayoutFrame 3 0 3 0 128 0 104 0)
              hasBorder: false
            )
           (LabelSpec
              label: 'Scrollable'
              name: 'ScrollableArbitraryLabel1'
              layout: (AlignmentOrigin 7 0 7 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (LabelSpec
              label: 'Arbitrary-'
              name: 'ScrollableArbitraryLabel2'
              layout: (AlignmentOrigin 7 0 23 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (LabelSpec
              label: 'Component'
              name: 'ScrollableArbitraryLabel3'
              layout: (AlignmentOrigin 7 0 39 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (UISubSpecification
              name: 'SubSpecification'
              layout: (LayoutFrame 145 0 3 0 280 0 104 0)
            )
           (LabelSpec
              label: 'SubSpecification'
              name: 'SubSpecificationLabel'
              layout: (Point 149 7)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              canUIDrag: false
            )
           (SubCanvasSpec
              name: 'SubCanvas'
              layout: (LayoutFrame 297 0 3 0 433 0 104 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
            )
           (LabelSpec
              label: 'SubCanvas'
              name: 'SubCanvasLabel'
              layout: (AlignmentOrigin 324 0 7 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (NonScrollableArbitraryComponentSpec
              name: 'NonSrollable Arbitrary Component'
              layout: (LayoutFrame 3 0 120 0 128 0 221 0)
            )
           (LabelSpec
              label: 'NonScrollable'
              name: 'NonScrollableArbitraryLabel1'
              layout: (AlignmentOrigin 7 0 124 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (LabelSpec
              label: 'Arbitrary-'
              name: 'NonScrollableArbitraryLabel2'
              layout: (AlignmentOrigin 7 0 140 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (LabelSpec
              label: 'Component'
              name: 'NonScrollableArbitraryLabel3'
              layout: (AlignmentOrigin 7 0 156 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           )
         
        )
      )
!

standardGraphs
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#standardGraphs
     UISelectionPanel new openInterface:#standardGraphs
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: standardGraphs
        window: 
       (WindowSpec
          label: 'Graphs'
          name: 'Graphs'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 453 161)
        )
        component: 
       (SpecCollection
          collection: (
           (GraphColumnView2DSpec
              name: 'GraphColumnView2D'
              layout: (LayoutFrame 3 0 3 0 208 0 98 0)
              gridX: 0
              gridY: 0
            )
           (LabelSpec
              label: 'GraphColumnViewView2D'
              name: 'GraphColumnView2DLabel'
              layout: (AlignmentOrigin 7 0 7 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (GraphColumnView3DSpec
              name: 'GraphColumnView3D'
              layout: (LayoutFrame 228 0 3 0 433 0 98 0)
            )
           (LabelSpec
              label: 'GraphColumnViewView3D'
              name: 'GraphColumnView3DLabel'
              layout: (AlignmentOrigin 232 0 7 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           )
         
        )
      )
!

standardGroups
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#standardGroups
     UISelectionPanel new openInterface:#standardGroups
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: standardGroups
        window: 
       (WindowSpec
          label: 'Groups'
          name: 'Groups'
          min: (Point 10 10)
          bounds: (Rectangle 0 0 443 222)
        )
        component: 
       (SpecCollection
          collection: (
           (ViewSpec
              name: 'Box'
              layout: (LayoutFrame 3 0 3 0 95 0 95 0)
            )
           (TransparentBoxSpec
              name: 'TBox1'
              layout: (LayoutFrame 113 0 3 0 204 0 95 0)
            )
           (LabelSpec
              label: 'TransparentBox'
              name: 'Label1'
              layout: (AlignmentOrigin 106 0 5 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (LabelSpec
              label: 'Box'
              name: 'ViewLabel'
              layout: (AlignmentOrigin 6 0 5 0 0 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (LabelSpec
              label: 'Variable Panels'
              name: 'VPanelLabel'
              layout: (LayoutFrame 3 0 104 0 208 0 127 0)
              style: (FontDescription helvetica medium roman 10)
              adjust: left
              canUIDrag: false
            )
           (VariableHorizontalPanelSpec
              name: 'Variable Horizontal Panel'
              layout: (LayoutFrame 3 0 128 0 98 0 218 0)
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'A'
                    name: 'label4'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'B'
                    name: 'label5'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    canUIDrag: false
                  )
                 )
               
              )
              handles: (Any 0.5 1.0)
            )
           (VariableVerticalPanelSpec
              name: 'Variable Vertical Panel'
              layout: (LayoutFrame 113 0 128 0 208 0 218 0)
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'A'
                    name: 'label9'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'B'
                    name: 'label10'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    canUIDrag: false
                  )
                 )
               
              )
              handles: (Any 0.5 1.0)
            )
           (FramedBoxSpec
              label: 'Framed Box'
              name: 'Framed Box'
              layout: (LayoutFrame 228 0 3 0 433 0 98 0)
              labelPosition: topLeft
              translateLabel: true
            )
           (LabelSpec
              label: 'Panels'
              name: 'PanelLabel'
              layout: (LayoutFrame 228 0 104 0 433 0 127 0)
              style: (FontDescription helvetica medium roman 10)
              adjust: left
              canUIDrag: false
            )
           (HorizontalPanelViewSpec
              name: 'Horizontal Panel'
              layout: (LayoutFrame 228 0 128 0 312 0 218 0)
              horizontalLayout: center
              verticalLayout: center
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'A'
                    name: 'label1'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'B'
                    name: 'label2'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'C'
                    name: 'label3'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 )
               
              )
            )
           (VerticalPanelViewSpec
              name: 'Vertical Panel'
              layout: (LayoutFrame 320 0 128 0 367 0 218 0)
              horizontalLayout: center
              verticalLayout: center
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'A'
                    name: 'label6'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'B'
                    name: 'label7'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'C'
                    name: 'label8'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 )
               
              )
            )
           (PanelViewSpec
              name: 'Panel'
              layout: (LayoutFrame 375 0 128 0 433 0 218 0)
              horizontalLayout: fitSpace
              verticalLayout: fitSpace
              horizontalSpace: 3
              verticalSpace: 3
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'A'
                    name: 'label11'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'B'
                    name: 'label12'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'C'
                    name: 'label13'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'D'
                    name: 'label14'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 (LabelSpec
                    label: 'E'
                    name: 'label15'
                    style: (FontDescription helvetica medium roman 12)
                    level: 2
                    extent: (Point 23 23)
                    canUIDrag: false
                  )
                 )
               
              )
            )
           )
         
        )
      )
!

standardLists
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#standardLists
     UISelectionPanel new openInterface:#standardLists
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: standardLists
        window: 
       (WindowSpec
          label: 'Lists'
          name: 'Lists'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 455 264)
        )
        component: 
       (SpecCollection
          collection: (
           (SequenceViewSpec
              name: 'List'
              layout: (LayoutFrame 3 0 3 0 208 0 101 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              useIndex: false
            )
           (DataSetSpec
              name: 'Table'
              layout: (LayoutFrame 228 0 3 0 433 0 101 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              has3Dseparators: false
            )
           (SelectionInListModelViewSpec
              name: 'New SelectionInListView'
              layout: (LayoutFrame 3 0 110 0 208 0 208 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              useIndex: false
              highlightMode: line
            )
           )
         
        )
      )
!

standardMenus
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#standardMenus
     UISelectionPanel new openInterface:#standardMenus
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: standardMenus
        window: 
       (WindowSpec
          label: 'Menus'
          name: 'Menus'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 491 269)
        )
        component: 
       (SpecCollection
          collection: (
           (MenuPanelSpec
              name: 'Tool Bar'
              layout: (LayoutFrame 4 0 134 0 129 0 166 0)
              textDefault: true
            )
           (LabelSpec
              label: 'Tool Bar'
              name: 'ToolBarLabel'
              layout: (AlignmentOrigin 4 0 134 0 0 1)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (MenuPanelSpec
              name: 'Menu Bar'
              layout: (LayoutFrame 4 0 188 0 129 0 210 0)
            )
           (LabelSpec
              label: 'Menu Bar'
              name: 'MenuBarLabel'
              layout: (AlignmentOrigin 4 0 187 0 0 1)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (PopUpListSpec
              label: 'PopUp List'
              name: 'PopUp List'
              layout: (LayoutFrame 4 0 3 0 129 0 25 0)
              tabable: true
            )
           (ComboListSpec
              name: 'Combo List'
              layout: (LayoutFrame 4 0 33 0 129 0 53 0)
              useIndex: false
            )
           (ComboBoxSpec
              name: 'Combo Box'
              layout: (LayoutFrame 4 0 61 0 129 0 81 0)
              acceptOnPointerLeave: false
            )
           (ExtendedComboBoxSpec
              name: 'Extended Combo Box'
              layout: (LayoutFrame 4 0 88 0 129 0 108 0)
              miniScrollerHorizontal: true
            )
           (TabViewSpec
              name: 'Tab Header'
              layout: (LayoutFrame 146 0 3 0 281 0 39 0)
            )
           (NoteBookViewSpec
              name: 'Note Book'
              layout: (LayoutFrame 146 0 46 0 281 0 138 0)
            )
           (UIGalleryViewSpec
              name: 'Gallery'
              layout: (LayoutFrame 298 0 3 0 434 0 138 0)
            )
           (ColorMenuSpec
              name: 'ColorMenu'
              layout: (LayoutFrame 143 0 188 0 -46 1.0 210 0)
              labelsAreColored: true
            )
           (LabelSpec
              label: 'Color Menu'
              name: 'Label1'
              layout: (AlignmentOrigin 142 0 187 0 0 1)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           )
         
        )
      )
!

standardMisc
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#standardMisc
     UISelectionPanel new openInterface:#standardMisc
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: standardMisc
        window: 
       (WindowSpec
          label: 'NewApplication'
          name: 'NewApplication'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 453 289)
        )
        component: 
       (SpecCollection
          collection: (
           (LabelSpec
              label: 'StepSlider'
              name: 'StepSliderLabel'
              layout: (AlignmentOrigin 87 0 9 0 1 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              canUIDrag: false
            )
           (LabelSpec
              label: 'Slider'
              name: 'SliderLabel'
              layout: (AlignmentOrigin 87 0 35 0 1 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              canUIDrag: false
            )
           (SliderSpec
              name: 'Slider'
              layout: (LayoutFrame 88 0 34 0 203 0 52 0)
              orientation: horizontal
            )
           (LabelSpec
              label: 'ThumbWheel'
              name: 'ThumbWheelLabel'
              layout: (AlignmentOrigin 88 0 62 0 1 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              canUIDrag: false
            )
           (ThumbWheelSpec
              name: 'Thumb Wheel'
              layout: (LayoutFrame 88 0 60 0 203 0 80 0)
              orientation: horizontal
            )
           (LabelSpec
              label: 'ScrollBar'
              name: 'ScrollBarLabel'
              layout: (AlignmentOrigin 87 0 103 0 1 0)
              initiallyInvisible: true
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              canUIDrag: false
            )
           (LabelSpec
              label: 'Scroller'
              name: 'ScrollerLabel'
              layout: (AlignmentOrigin 87 0 130 0 1 0)
              initiallyInvisible: true
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              canUIDrag: false
            )
           (ScrollerSpec
              name: 'Scroller'
              layout: (LayoutFrame 88 0 127 0 203 0 145 0)
              initiallyInvisible: true
              orientation: horizontal
            )
           (SteppingSliderSpec
              name: 'VStepSlider'
              layout: (LayoutFrame 226 0 6 0 244 0 106 0)
            )
           (SliderSpec
              name: 'VSlider'
              layout: (LayoutFrame 254 0 6 0 272 0 106 0)
            )
           (ThumbWheelSpec
              name: 'VThumbWheel'
              layout: (LayoutFrame 280 0 6 0 298 0 106 0)
            )
           (ScrollerSpec
              name: 'VScroller'
              layout: (LayoutFrame 345 0 6 0 363 0 106 0)
              initiallyInvisible: true
            )
           (LabelSpec
              label: 'Region'
              name: 'RegionLabel'
              layout: (AlignmentOrigin 83 0 177 0 1 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (RegionSpec
              name: 'Region'
              layout: (LayoutFrame 88 0 171 0 203 0 200 0)
              lineWidth: 2
              regionType: ellipse
            )
           (LabelSpec
              label: 'Separator'
              name: 'SeparatorLabel'
              layout: (AlignmentOrigin 83 0 207 0 1 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (DividerSpec
              name: 'Separator'
              layout: (LayoutFrame 88 0 213 0 203 0 217 0)
            )
           (LabelSpec
              label: 'Progress Indicator'
              name: 'ProgressIndicatorsLabel'
              layout: (AlignmentOrigin 333 0 117 0 1 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (ProgressIndicatorSpec
              name: 'Progress Indicator'
              layout: (LayoutFrame 338 0 114 0 433 0 132 0)
            )
           (LabelSpec
              label: 'Round
Progress Indicator'
              name: 'RoundProgressIndicatorsLabel'
              layout: (AlignmentOrigin 333 0 167 0 1 0)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (RoundProgressIndicatorSpec
              name: 'Round Progress Indicator'
              layout: (LayoutFrame 338 0 136 0 425 0 219 0)
              level: 0
              borderWidth: 1
            )
           (ScrollBarSpec
              name: 'ScrollBar'
              layout: (LayoutFrame 88 0 100 0 203 0 118 0)
              initiallyInvisible: true
              orientation: horizontal
            )
           (ScrollBarSpec
              name: 'VScrollBar'
              layout: (LayoutFrame 317 0 6 0 335 0 106 0)
              initiallyInvisible: true
            )
           )
         
        )
      )
!

standardTexts
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#standardTexts
     UISelectionPanel new openInterface:#standardTexts
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: standardTexts
        window: 
       (WindowSpec
          label: 'Texts'
          name: 'Texts'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 453 226)
        )
        component: 
       (SpecCollection
          collection: (
           (TextEditorSpec
              name: 'Text Editor'
              layout: (LayoutFrame 3 0 3 0 208 0 98 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
            )
           (HTMLViewSpec
              name: 'HTML Browser'
              layout: (LayoutFrame 228 0 3 0 433 0 98 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
            )
           (InputFieldSpec
              name: 'Entry Field'
              layout: (LayoutFrame 3 0 113 0 208 0 135 0)
              acceptOnReturn: true
              acceptOnTab: true
              acceptOnLostFocus: true
              acceptOnPointerLeave: false
            )
           (FilenameInputFieldSpec
              name: 'Filename Entry Field'
              layout: (LayoutFrame 3 0 141 0 208 0 163 0)
              acceptOnPointerLeave: false
            )
           (LabelSpec
              label: 'Label'
              name: 'Label'
              layout: (LayoutFrame 228 0 113 0 433 0 135 0)
              translateLabel: true
            )
           )
         
        )
      )
!

standardTrees
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel andSelector:#standardTrees
     UISelectionPanel new openInterface:#standardTrees
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: standardTrees
        window: 
       (WindowSpec
          label: 'Trees'
          name: 'Trees'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 455 264)
        )
        component: 
       (SpecCollection
          collection: (
           (SelectionInTreeViewSpec
              name: 'Tree List'
              layout: (LayoutFrame 4 0 3 0 209 0 101 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              highlightMode: line
            )
           (FileSelectionTreeSpec
              name: 'File Tree List'
              layout: (LayoutFrame 229 0 3 0 434 0 101 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              highlightMode: line
            )
           (HierarchicalListViewSpec
              name: 'New ModelTree List'
              layout: (LayoutFrame 4 0 110 0 209 0 208 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              highlightMode: line
            )
           )
         
        )
      )
!

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

!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 ext spec|

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

    point  := device translatePoint:(device pointerPosition)
                           fromView:nil
                             toView:(gallery canvas).

    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.

    "Modified: / 10.10.2001 / 14:14:36 / cg"
!

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.
            gallery update.
        ] ifFalse:[
            value == #copy ifTrue:[
                self window setClipboardObject:spec
            ]
        ].
      ^ self
    ].

    self isUserBoard ifTrue:[
        ^ self defineClassAndSelector
    ].

    paste := self window getClipboardObject.

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

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

!UISelectionPanel methodsFor:'aspects'!

clientSpec
    ^ gallery clientSpecHolder
!

clipBoardSpec
    ^ clipBoardSpec
!

gallery
    ^ gallery
!

galleryList
    ^ gallery listHolder
!

galleryModel
    ^ gallery model

!

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
    ^ gallery minorKeysHolder
! !

!UISelectionPanel methodsFor:'change & update'!

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

    (channel := self clientSpec) == changedObject ifTrue:[
        (label := channel value) notNil ifTrue:[
            label := label name.
        ] ifFalse:[
            label := 'Widget Gallery'
        ].
        builder window topView label:(label , ' ')
    ].

    super update:something with:aParameter from:changedObject.
! !

!UISelectionPanel methodsFor:'drag & drop'!

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

drop:aCollectionOfDropObjects in:aComponent at:aPoint

    |spc top|

    top := DragAndDropManager dragOriginatorQuerySignal query topView.

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

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

    "Modified: / 18.3.1999 / 18:29:19 / stefan"
! !

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

    (majorSelection == aSelection or:[aSelection == 0]) ifTrue:[
        ^ self
    ].

    gallery builder:nil.
    majorSelection := aSelection.
    spec := ((self class specifications) at:majorSelection) last.

    model := self galleryModel.
    model value:0.
    self minorKeys value:nil.

    spec isSymbol ifFalse:[
        self galleryList  value:(spec collect:[:a| a first]).
        self minorKeys setValue:(spec collect:[:a| a last]).
    ] ifTrue:[
        self perform:spec.
    ].
    model value:1.

    "Modified: / 21.4.1998 / 11:59:08 / cg"
! !

!UISelectionPanel methodsFor:'startup & release'!

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
    |holder|

    super initialize.

    userClass  := UserClass.
    userSpecs  := UserSpecs.
    userLabels := UserLabels.

    gallery := UIGalleryView new.

    gallery           model:(ValueHolder new).
    gallery      listHolder:(ValueHolder new).
    gallery minorKeysHolder:(ValueHolder new).
    gallery    menuSelector:#raiseMenu.

    gallery clientSpecHolder:(holder := ValueHolder new).
    holder  addDependent:self.

    majorSelection := 0.
!

postOpenWith:aBuilder
    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.
        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 etc.' 'Business Graphics' )

    "Created: / 8.12.1997 / 18:50:06 / cg"
    "Modified: / 16.6.1998 / 10:20:12 / cg"
!

defaultListOfSelectors
    ^ #( clocksSpec businessGraphicsSpec)

    "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'!

businessGraphicsSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel::UserDefinedGallery andSelector:#businessGraphicsSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: businessGraphicsSpec
        window: 
       (WindowSpec
          label: 'Interface Builder'
          name: 'Interface Builder'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 394 317)
        )
        component: 
       (SpecCollection
          collection: (
           (LabelSpec
              label: 'PieChart'
              name: 'Label2'
              layout: (LayoutFrame 5 0 5 0 126 0 20 0)
              translateLabel: true
              canUIDrag: false
            )
           (PieChartWidgetSpec
              name: 'PIE Chart'
              layout: (LayoutFrame 15 0 21 0 103 0 141 0)
            )
           (LabelSpec
              label: 'ChartDescription'
              name: 'Label1'
              layout: (LayoutFrame 8 0.0 153 0 131 0 168 0)
              translateLabel: true
              canUIDrag: false
            )
           (ChartDescriptionSpec
              name: 'Chart Legend'
              layout: (LayoutFrame 14 0.0 -9 0.656827 14 0.323684 -9 1.0)
            )
           (LabelSpec
              label: 'BarChart'
              name: 'Label3'
              layout: (LayoutFrame 115 0 5 0 237 0 20 0)
              translateLabel: true
              canUIDrag: false
            )
           (BarChartWidgetSpec
              name: 'Bar Chart'
              layout: (LayoutFrame 121 0 21 0 232 0 141 0)
            )
           )
         
        )
      )
!

clocksSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:UISelectionPanel::UserDefinedGallery andSelector:#clocksSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: clocksSpec
        window: 
       (WindowSpec
          label: 'Interface Builder'
          name: 'Interface Builder'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 439 319)
        )
        component: 
       (SpecCollection
          collection: (
           (NonScrollableArbitraryComponentSpec
              name: 'Analog Clock'
              layout: (LayoutFrame 15 0 39 0 129 0 151 0)
              hasBorder: false
              component: ClockView
            )
           (NonScrollableArbitraryComponentSpec
              name: 'Digital Clock'
              layout: (LayoutOrigin 15 0 176 0)
              hasBorder: false
              component: DigitalClockView
            )
           (NonScrollableArbitraryComponentSpec
              name: 'Digital Number display'
              layout: (LayoutOrigin 142 0 39 0)
              hasBorder: false
              component: DigitalLedDisplay
            )
           (LabelSpec
              label: 'Analog Clock'
              name: 'Label1'
              layout: (LayoutFrame 15 0 16 0 128 0 38 0)
              translateLabel: true
              adjust: left
              canUIDrag: false
            )
           (LabelSpec
              label: 'Number Display'
              name: 'Label2'
              layout: (LayoutFrame 142 0 16 0 270 0 38 0)
              translateLabel: true
              adjust: left
              canUIDrag: false
            )
           (LabelSpec
              label: 'Digital Clock'
              name: 'Label3'
              layout: (LayoutFrame 15 0 155 0 128 0 177 0)
              translateLabel: true
              adjust: left
              canUIDrag: false
            )
           (MeterWidgetSpec
              name: 'Meter Widget'
              layout: (Rectangle 143 99 259 216)
              model: meterValue
            )
           (LabelSpec
              label: 'Meter Widget'
              name: 'Label4'
              layout: (LayoutFrame 142 0 77 0 269 0 99 0)
              translateLabel: true
              canUIDrag: false
            )
           (MeterClackCounterSpec
              name: 'Meter Clack Counter'
              layout: (Rectangle 291 40 387 72)
              model: model
            )
           (LabelSpec
              label: 'Meter Clack Counter'
              name: 'Label5'
              layout: (LayoutFrame 290 0 16 0 417 0 38 0)
              translateLabel: true
              adjust: left
              canUIDrag: false
            )
           )
         
        )
      )
!

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!
UISelectionPanel::UserDefinedGallery initialize!