UISelectionPanel.st
author Claus Gittinger <cg@exept.de>
Wed, 07 Jul 1999 21:25:49 +0200
changeset 1168 d297bc428326
parent 1160 9e6aff354459
child 1169 dc563b916897
permissions -rw-r--r--
separated misc into embed & misc; added StepSlider

"
 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:'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
    super 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)
                            #('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:'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 110 0 366 0 424 0 581 0)
              #label: 'Painter'
              #min: #(#Point 10 10)
              #max: #(#Point 1280 1024)
              #bounds: #(#Rectangle 110 366 425 582)
              #usePreferredExtent: false
          )
          #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
                              #model: #accept
                              #isDefault: true
                              #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 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'
          #layout: #(#LayoutFrame 374 0 171 0 867 0 472 0)
          #level: 0
          #min: #(#Point 100 280)
          #max: #(#Point 1160 870)
          #bounds: #(#Rectangle 374 171 868 473)
          #usePreferredExtent: false
          #returnIsOKInDialog: true
          #escapeIsCancelInDialog: true
        )
        #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:'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'
          #layout: #(#LayoutFrame 58 0 164 0 497 0 321 0)
          #level: 0
          #min: #(#Point 10 10)
          #max: #(#Point 1280 1024)
          #bounds: #(#Rectangle 58 164 498 322)
          #usePreferredExtent: false
          #returnIsOKInDialog: true
          #escapeIsCancelInDialog: true
        )
        #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: #accept
            )
           #(#ActionButtonSpec
              #label: 'Cancel'
              #name: 'Button - Cancel'
              #layout: #(#LayoutFrame 2 0 65 0 127 0 87 0)
              #translateLabel: true
              #model: #cancel
            )
           #(#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
              #lampColor: #(#Color 100.0 100.0 0.0)
            )
           #(#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'
          #layout: #(#LayoutFrame 125 0 152 0 566 0 374 0)
          #level: 0
          #min: #(#Point 10 10)
          #max: #(#Point 1280 1024)
          #bounds: #(#Rectangle 125 152 567 375)
          #usePreferredExtent: false
          #returnIsOKInDialog: true
          #escapeIsCancelInDialog: true
        )
        #component: 
       #(#SpecCollection
          #collection: #(
           #(#ArbitraryComponentSpec
              #name: 'Arbitrary Component'
              #layout: #(#LayoutFrame 3 0 3 0 128 0 104 0)
              #hasBorder: false
            )
           #(#LabelSpec
              #label: 'Arbitrary'
              #name: 'ArbitraryComponentLabel1'
              #layout: #(#AlignmentOrigin 7 0 7 0 0 0)
              #style: #(#FontDescription #helvetica #medium #roman 10)
              #resizeForLabel: true
              #adjust: #left
              #canUIDrag: false
            )
           #(#LabelSpec
              #label: 'Component'
              #name: 'ArbitraryComponentLabel2'
              #layout: #(#AlignmentOrigin 7 0 31 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
            )
           )
         
        )
      )
!

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'
          #layout: #(#LayoutFrame 81 0 219 0 519 0 333 0)
          #level: 0
          #min: #(#Point 10 10)
          #max: #(#Point 1280 1024)
          #bounds: #(#Rectangle 81 219 520 334)
          #usePreferredExtent: false
          #returnIsOKInDialog: true
          #escapeIsCancelInDialog: true
        )
        #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'
          #layout: #(#LayoutFrame 92 0 174 0 534 0 395 0)
          #level: 0
          #min: #(#Point 10 10)
          #max: #(#Point 1280 1024)
          #bounds: #(#Rectangle 92 174 535 396)
          #usePreferredExtent: false
          #returnIsOKInDialog: true
          #escapeIsCancelInDialog: true
        )
        #component: 
       #(#SpecCollection
          #collection: #(
           #(#ViewSpec
              #name: 'Box'
              #layout: #(#LayoutFrame 3 0 3 0 208 0 98 0)
            )
           #(#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)
              #handles: #(#Any 0.5 1.0)
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#LabelSpec
                    #label: 'A'
                    #name: 'label4'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'B'
                    #name: 'label5'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #canUIDrag: false
                  )
                 )
               
              )
            )
           #(#VariableVerticalPanelSpec
              #name: 'Variable Vertical Panel'
              #layout: #(#LayoutFrame 113 0 128 0 208 0 218 0)
              #handles: #(#Any 0.5 1.0)
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#LabelSpec
                    #label: 'A'
                    #name: 'label9'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'B'
                    #name: 'label10'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #canUIDrag: false
                  )
                 )
               
              )
            )
           #(#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'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #extent: #(#Point 23 23)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'B'
                    #name: 'label2'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #extent: #(#Point 23 23)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'C'
                    #name: 'label3'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #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'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #extent: #(#Point 23 23)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'B'
                    #name: 'label7'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #extent: #(#Point 23 23)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'C'
                    #name: 'label8'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #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'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #extent: #(#Point 23 23)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'B'
                    #name: 'label12'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #extent: #(#Point 23 23)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'C'
                    #name: 'label13'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #extent: #(#Point 23 23)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'D'
                    #name: 'label14'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #extent: #(#Point 23 23)
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'E'
                    #name: 'label15'
                    #level: 2
                    #style: #(#FontDescription #helvetica #medium #roman 12)
                    #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'
          #layout: #(#LayoutFrame 22 0 99 0 462 0 316 0)
          #level: 0
          #min: #(#Point 10 10)
          #max: #(#Point 1280 1024)
          #bounds: #(#Rectangle 22 99 463 317)
          #usePreferredExtent: false
          #returnIsOKInDialog: true
          #escapeIsCancelInDialog: true
        )
        #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
              #has3Dsepartors: false
            )
           #(#SelectionInTreeViewSpec
              #name: 'Tree List'
              #layout: #(#LayoutFrame 4 0 114 0 209 0 212 0)
              #hasHorizontalScrollBar: true
              #hasVerticalScrollBar: true
              #highlightMode: #line
            )
           #(#FileSelectionTreeSpec
              #name: 'File Tree List'
              #layout: #(#LayoutFrame 229 0 114 0 434 0 212 0)
              #hasHorizontalScrollBar: true
              #hasVerticalScrollBar: true
              #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'
          #layout: #(#LayoutFrame 162 0 182 0 638 0 404 0)
          #min: #(#Point 10 10)
          #max: #(#Point 1280 1024)
          #bounds: #(#Rectangle 162 182 639 405)
        )
        #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)
              #useIndex: false
            )
           #(#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)
            )
           )
         
        )
      )
!

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: 'Misc'
          #name: 'Misc'
          #layout: #(#LayoutFrame 53 0 156 0 494 0 378 0)
          #min: #(#Point 10 10)
          #max: #(#Point 1280 1024)
          #bounds: #(#Rectangle 53 156 495 379)
        )
        #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
            )
           #(#SteppingSliderSpec
              #name: 'StepSlider'
              #layout: #(#LayoutFrame 88 0 7 0 203 0 25 0)
              #orientation: #horizontal
              #step: 1
            )
           #(#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
              #step: 1
            )
           #(#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
              #step: 1
            )
           #(#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
            )
           #(#ScrollBarSpec
              #name: 'ScrollBar'
              #layout: #(#LayoutFrame 88 0 100 0 203 0 118 0)
              #initiallyInvisible: true
              #orientation: #horizontal
              #step: 1
            )
           #(#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
              #step: 1
            )
           #(#SteppingSliderSpec
              #name: 'VStepSlider'
              #layout: #(#LayoutFrame 226 0 6 0 244 0 106 0)
              #step: 1
            )
           #(#SliderSpec
              #name: 'VSlider'
              #layout: #(#LayoutFrame 254 0 6 0 272 0 106 0)
              #step: 1
            )
           #(#ThumbWheelSpec
              #name: 'VThumbWheel'
              #layout: #(#LayoutFrame 280 0 6 0 298 0 106 0)
              #step: 1
            )
           #(#ScrollBarSpec
              #name: 'VScrollBar'
              #layout: #(#LayoutFrame 317 0 6 0 335 0 106 0)
              #initiallyInvisible: true
              #step: 1
            )
           #(#ScrollerSpec
              #name: 'VScroller'
              #layout: #(#LayoutFrame 345 0 6 0 363 0 106 0)
              #initiallyInvisible: true
              #step: 1
            )
           #(#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
            )
           )
         
        )
      )
!

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'
          #layout: #(#LayoutFrame 164 0 305 0 602 0 447 0)
          #level: 0
          #min: #(#Point 10 10)
          #max: #(#Point 1280 1024)
          #bounds: #(#Rectangle 164 305 603 448)
          #usePreferredExtent: false
          #returnIsOKInDialog: true
          #escapeIsCancelInDialog: true
        )
        #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)
            )
           #(#LabelSpec
              #label: 'Label'
              #name: 'Label'
              #layout: #(#LayoutFrame 228 0 113 0 433 0 135 0)
              #translateLabel: true
            )
           )
         
        )
      )
!

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)
                               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.
            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
    ^ 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 topView|

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

        (label := channel value) notNil ifTrue:[
            topView label:label name, ' '.
        ] ifFalse:[
            topView label:'Widget 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 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 := something 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
     UISelectionPanel::UserDefinedGallery new openInterface:#businessGraphicsSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #window: 
           #(#WindowSpec
              #name: 'Interface Builder'
              #layout: #(#LayoutFrame 6 0 582 0 385 0 852 0)
              #label: 'Interface Builder'
              #min: #(#Point 10 10)
              #max: #(#Point 1280 1024)
              #bounds: #(#Rectangle 6 582 386 853)
              #usePreferredExtent: false
          )
          #component: 
           #(#SpecCollection
              #collection: 
               #(
                 #(#LabelSpec
                    #name: 'Label2'
                    #layout: #(#LayoutFrame 5 0 5 0 70 0 20 0)
                    #label: 'PieChart'
                    #translateLabel: true
                    #canUIDrag: false
                )
                 #(#PieChartWidgetSpec
                    #name: 'PIE Chart'
                    #layout: #(#LayoutFrame 15 0 21 0 103 0 141 0)
                )
                 #(#LabelSpec
                    #name: 'Label1'
                    #layout: #(#LayoutFrame 16 0.0 146 0 131 0 161 0)
                    #label: 'ChartDescription'
                    #translateLabel: true
                    #adjust: #left
                    #canUIDrag: false
                )
                 #(#ChartDescriptionSpec
                    #name: 'Chart Legend'
                    #layout: #(#LayoutFrame 14 0.0 -4 0.656827 14 0.323684 -4 1.0)
                )
                 #(#LabelSpec
                    #name: 'Label3'
                    #layout: #(#LayoutFrame 115 0 5 0 180 0 20 0)
                    #label: 'BarChart'
                    #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
     UISelectionPanel::UserDefinedGallery new openInterface:#clocksSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #window: 
           #(#WindowSpec
              #name: 'Interface Builder'
              #layout: #(#LayoutFrame 402 0 59 0 781 0 329 0)
              #label: 'Interface Builder'
              #min: #(#Point 10 10)
              #max: #(#Point 1280 1024)
              #bounds: #(#Rectangle 402 59 782 330)
              #usePreferredExtent: false
          )
          #component: 
           #(#SpecCollection
              #collection: 
               #(
                 #(#ArbitraryComponentSpec
                    #name: 'Analog Clock'
                    #layout: #(#LayoutFrame 15 0 39 0 129 0 151 0)
                    #component: #ClockView
                    #hasBorder: false
                )
                 #(#ArbitraryComponentSpec
                    #name: 'Digital Clock'
                    #layout: #(#LayoutOrigin 15 0 176 0)
                    #component: #DigitalClockView
                    #hasBorder: false
                )
                 #(#ArbitraryComponentSpec
                    #name: 'Digital Number display'
                    #layout: #(#LayoutOrigin 142 0 39 0)
                    #component: #DigitalLedDisplay
                    #hasBorder: false
                )
                 #(#LabelSpec
                    #name: 'Label1'
                    #layout: #(#LayoutFrame 15 0 16 0 128 0 38 0)
                    #label: 'Analog Clock'
                    #translateLabel: true
                    #adjust: #left
                    #canUIDrag: false
                )
                 #(#LabelSpec
                    #name: 'Label2'
                    #layout: #(#LayoutFrame 142 0 16 0 270 0 38 0)
                    #label: 'Number Display'
                    #translateLabel: true
                    #adjust: #left
                    #canUIDrag: false
                )
                 #(#LabelSpec
                    #name: 'Label3'
                    #layout: #(#LayoutFrame 15 0 155 0 128 0 177 0)
                    #label: 'Digital Clock'
                    #translateLabel: true
                    #adjust: #left
                    #canUIDrag: false
                )
                 #(#MeterWidgetSpec
                    #name: 'Meter Widget'
                    #layout: #(#Rectangle 143 101 248 216)
                    #model: #meterValue
                )
                 #(#LabelSpec
                    #name: 'Label4'
                    #layout: #(#LayoutFrame 142 0 74 0 269 0 96 0)
                    #label: 'Meter Widget'
                    #translateLabel: true
                    #adjust: #left
                    #canUIDrag: false
                )
                 #(#MeterClackCounterSpec
                    #name: 'Meter Clack Counter'
                    #layout: #(#Rectangle 291 40 387 72)
                    #model: #model
                )
                 #(#LabelSpec
                    #name: 'Label5'
                    #layout: #(#LayoutFrame 290 0 16 0 417 0 38 0)
                    #label: 'Meter Clack Counter'
                    #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!