UISelectionPanel.st
author ca
Thu, 17 Jul 1997 11:52:41 +0200
changeset 216 2bfcf491429e
parent 207 a31cc933368a
child 244 b70597d2a39b
permissions -rw-r--r--
hasCharacterOrientedLabel removed

"
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"



ApplicationModel subclass:#UISelectionPanel
	instanceVariableNames:'userClass userSpecs userLabels majorSelection clipBoardSpec'
	classVariableNames:'UserClass UserSpecs UserLabels'
	poolDictionaries:''
	category:'Interface-UIPainter'
!

Object subclass:#ExampleUserDefinedGallery
	instanceVariableNames:''
	classVariableNames:''
	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::ExampleUserDefinedGallery.
    UserSpecs  := #listOfSelectors.
    UserLabels := #listOfLabels.
! !

!UISelectionPanel class methodsFor:'accessing'!

specifications

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

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

        #( 'User Defined' #userDefined )
     )
! !

!UISelectionPanel class methodsFor:'interface specification'!

nameAndSelectorSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

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

windowSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'Component Gallery'
              #'bounds:' #(#Rectangle 0 0 471 223)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#UIGalleryViewSpec
                    #'name:' 'gallery'
                    #'layout:' #(#LayoutFrame 0 0.0 0 0.0 -40 1.0 0 1.0)
                    #'tabable:' true
                    #'menu:' #galleryList
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'model:' #galleryModel
                    #'tabWidget:' #Window
                    #'minorKeys:' #minorKeys
                    #'clientSpec:' #clientSpec
                    #'raiseMenu:' #raiseMenu
                    #'useIndex:' true
                )
                 #(#TabViewSpec
                    #'name:' 'major'
                    #'layout:' #(#LayoutFrame -40 1.0 30 0.0 0 1.0 0 1.0)
                    #'menu:' #majorList
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'model:' #majorChannel
                    #'tabWidget:' #Window
                    #'direction:' #right
                    #'useIndex:' true
                )
                 #(#LabelSpec
                    #'name:' 'clientSpecLabel'
                    #'layout:' #(#AlignmentOrigin 0 0.0 0 1.0 0 1)
                    #'label:' ''
                    #'adjust:' #left
                    #'resizeForLabel:' true
                )
              )
          )
      )
! !

!UISelectionPanel class methodsFor:'menus'!

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



!

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



! !

!UISelectionPanel class methodsFor:'standard specifications'!

standardButtonToggle
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 439 193)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ArrowButtonSpec
                    #'name:' 'ArrowButton up'
                    #'layout:' #(#LayoutFrame 237 0 20 0 259 0 42 0)
                    #'isTriggerOnDown:' true
                    #'direction:' #up
                )
                 #(#ActionButtonSpec
                    #'name:' 'Button'
                    #'layout:' #(#LayoutFrame 20 0 20 0 119 0 42 0)
                    #'label:' 'Button'
                )
                 #(#RadioButtonSpec
                    #'name:' 'RadioButton'
                    #'layout:' #(#LayoutFrame 127 0.0 20 0 226 0 42 0)
                    #'label:' 'RadioButton'
                    #'isTriggerOnDown:' true
                    #'showLamp:' true
                    #'lampColor:' #(#Color 100.0 100.0 0.0)
                )
                 #(#ArrowButtonSpec
                    #'name:' 'ArrowButton down'
                    #'layout:' #(#LayoutFrame 237 0 51 0 259 0 73 0)
                    #'isTriggerOnDown:' true
                    #'direction:' #down
                )
                 #(#ArrowButtonSpec
                    #'name:' 'ArrowButton left'
                    #'layout:' #(#LayoutFrame 237 0 82 0 259 0 104 0)
                    #'isTriggerOnDown:' true
                    #'direction:' #left
                )
                 #(#ArrowButtonSpec
                    #'name:' 'ArrowButton right'
                    #'layout:' #(#LayoutFrame 237 0 113 0 259 0 135 0)
                    #'isTriggerOnDown:' true
                    #'direction:' #right
                )
                 #(#CheckToggleSpec
                    #'name:' 'CheckToggle'
                    #'layout:' #(#LayoutFrame 297 0 82 0 317 0 102 0)
                    #'isTriggerOnDown:' true
                    #'showLamp:' false
                    #'lampColor:' #(#Color 100.0 100.0 0.0)
                )
                 #(#ToggleSpec
                    #'name:' 'Toggle'
                    #'layout:' #(#LayoutFrame 297 0 20 0 396 0 42 0)
                    #'label:' 'Toggle'
                    #'isTriggerOnDown:' true
                    #'showLamp:' true
                    #'lampColor:' #(#Color 100.0 100.0 0.0)
                )
                 #(#CheckBoxSpec
                    #'name:' 'CheckBox'
                    #'layout:' #(#LayoutFrame 297 0 51 0 396 0 73 0)
                    #'label:' 'CheckBox'
                )
                 #(#ActionButtonSpec
                    #'name:' 'ok'
                    #'layout:' #(#LayoutFrame 20 0 51 0 119 0 73 0)
                    #'label:' 'ok'
                    #'model:' #accept
                )
                 #(#ActionButtonSpec
                    #'name:' 'cancel'
                    #'layout:' #(#LayoutFrame 20 0 82 0 119 0 104 0)
                    #'label:' 'cancel'
                    #'model:' #cancel
                )
                 #(#ActionButtonSpec
                    #'name:' 'help'
                    #'layout:' #(#LayoutFrame 20 0 113 0 119 0 135 0)
                    #'label:' 'help'
                    #'model:' #help
                )
              )
          )
      )
!

standardCanvas
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 370 203)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#UIGalleryViewSpec
                    #'name:' 'Gallery'
                    #'layout:' #(#LayoutFrame 16 0 19 0 168 0 92 0)
                    #'tabWidget:' #Window
                )
                 #(#LabelSpec
                    #'name:' 'GalleryLabel'
                    #'layout:' #(#AlignmentOrigin 20 0 88 0 0 1)
                    #'label:' 'Gallery'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#UISubSpecification
                    #'name:' 'SubSpecification'
                    #'layout:' #(#LayoutFrame 182 0 19 0 334 0 92 0)
                )
                 #(#LabelSpec
                    #'name:' 'SubSpecificationLabel'
                    #'layout:' #(#AlignmentOrigin 186 0 88 0 0 1)
                    #'label:' 'SubSpecification'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#SubCanvasSpec
                    #'name:' 'SubCanvas'
                    #'layout:' #(#LayoutFrame 182 0 104 0 334 0 177 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#LabelSpec
                    #'name:' 'subCanvasLabel'
                    #'layout:' #(#AlignmentOrigin 255 0 158 0 0 0)
                    #'label:' 'SubCanvas'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )
!

standardMenus
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^

       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 464 253)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ComboBoxSpec
                    #'name:' 'ComboBox'
                    #'layout:' #(#LayoutFrame 20 0 14 0 123 0 34 0)
                )
                 #(#ComboListSpec
                    #'name:' 'ComboList'
                    #'layout:' #(#LayoutFrame 20 0 71 0 123 0 91 0)
                    #'useIndex:' false
                )
                 #(#PopUpListSpec
                    #'name:' 'PopUpList'
                    #'layout:' #(#LayoutFrame 147 0 14 0 250 0 36 0)
                    #'label:' 'PopUpList'
                    #'useIndex:' false
                )
                 #(#MenuPanelSpec
                    #'name:' 'MenuPanel'
                    #'layout:' #(#LayoutFrame 147 0 71 0 250 0 91 0)
                )
                 #(#TabViewSpec
                    #'name:' 'TabView'
                    #'layout:' #(#LayoutFrame 269 0 14 0 409 0 50 0)
                    #'tabWidget:' #Window
                )
                 #(#NoteBookViewSpec
                    #'name:' 'NoteBookView'
                    #'layout:' #(#LayoutFrame 269 0 71 0 409 0 159 0)
                    #'tabWidget:' #Window
                )
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#LayoutFrame 150 0 73 0 236 0 89 0)
                    #'label:' 'MenuPanel'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'canUIDrag:' false
                )
              )
          )
      )


!

standardPanels
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 411 131)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#HorizontalPanelViewSpec
                    #'name:' 'HorizontalPanelView'
                    #'layout:' #(#LayoutFrame 20 0 20 0 104 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label1'
                              #'label:' 'A'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label2'
                              #'label:' 'B'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label3'
                              #'label:' 'C'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                        )
                    )
                    #'horizontalLayout:' #center
                    #'verticalLayout:' #center
                    #'horizontalSpace:' 3
                    #'verticalSpace:' 3
                )
                 #(#VariableHorizontalPanelSpec
                    #'name:' 'VariableHorizontalPanel'
                    #'layout:' #(#LayoutFrame 249 0 20 0 323 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label4'
                              #'label:' 'A'
                              #'level:' 2
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label5'
                              #'label:' 'B'
                              #'level:' 2
                              #'canUIDrag:' false
                          )
                        )
                    )
                )
                 #(#VerticalPanelViewSpec
                    #'name:' 'VerticalPanelView'
                    #'layout:' #(#LayoutFrame 110 0 20 0 168 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label6'
                              #'label:' 'A'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label7'
                              #'label:' 'B'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label8'
                              #'label:' 'C'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                        )
                    )
                    #'horizontalLayout:' #center
                    #'verticalLayout:' #center
                    #'horizontalSpace:' 3
                    #'verticalSpace:' 3
                )
                 #(#VariableVerticalPanelSpec
                    #'name:' 'VariableVerticalPanel'
                    #'layout:' #(#LayoutFrame 328 0 20 0 402 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label9'
                              #'label:' 'A'
                              #'level:' 2
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label10'
                              #'label:' 'B'
                              #'level:' 2
                              #'canUIDrag:' false
                          )
                        )
                    )
                )
                 #(#PanelViewSpec
                    #'name:' 'PanelView'
                    #'layout:' #(#LayoutFrame 174 0 20 0 232 0 105 0)
                    #'component:' 
                     #(#SpecCollection
                        #'collection:' 
                         #(
                           #(#LabelSpec
                              #'name:' 'label11'
                              #'label:' 'A'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label12'
                              #'label:' 'B'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label13'
                              #'label:' 'C'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label14'
                              #'label:' 'D'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                           #(#LabelSpec
                              #'name:' 'label15'
                              #'label:' 'E'
                              #'level:' 2
                              #'extent:' #(#Point 23 23)
                              #'canUIDrag:' false
                          )
                        )
                    )
                    #'horizontalLayout:' #fitSpace
                    #'verticalLayout:' #fitSpace
                    #'horizontalSpace:' 3
                    #'verticalSpace:' 3
                )
              )
          )
      )
!

standardSliders
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:self andSelector:#standardSliders
     self new openInterface:#standardSliders
    "

    <resource: #canvas>

    ^

       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 445 162)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#SliderSpec
                    #'name:' 'Vertical Slider'
                    #'layout:' #(#LayoutFrame 20 0 20 0 38 0 108 0)
                    #'orientation:' #vertical
                )
                 #(#ThumbWheelSpec
                    #'name:' 'Vertical ThumbWheel'
                    #'layout:' #(#LayoutFrame 48 0 20 0 63 0 108 0)
                    #'orientation:' #vertical
                    #'start:' 0
                    #'stop:' 360
                )
                 #(#ThumbWheelSpec
                    #'name:' 'Horizontal ThumbWheel'
                    #'layout:' #(#LayoutFrame 102 0 20 0 191 0 35 0)
                    #'orientation:' #horizontal
                    #'start:' 0
                    #'stop:' 360
                )
                 #(#SliderSpec
                    #'name:' 'Horizontal Slider'
                    #'layout:' #(#LayoutFrame 102 0 53 0 191 0 71 0)
                    #'orientation:' #horizontal
                    #'start:' 0
                    #'stop:' 100
                )
                 #(#ProgressIndicatorSpec
                    #'name:' 'Progress Indicator'
                    #'layout:' #(#LayoutFrame 102 0 90 0 191 0 108 0)
                    #'showPercentage:' true
                )
              )
          )
      )

!

standardText
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 467 207)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#InputFieldSpec
                    #'name:' 'EditField'
                    #'layout:' #(#LayoutFrame 20 0 100 0 199 0 122 0)
                )
                 #(#LabelSpec
                    #'name:' 'Text Label'
                    #'layout:' #(#LayoutFrame 20 0 128 0 199 0 150 0)
                    #'label:' 'Label'
                )
                 #(#TextEditorSpec
                    #'name:' 'EditTextView'
                    #'layout:' #(#LayoutFrame 20 0 13 0 199 0 94 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#SequenceViewSpec
                    #'name:' 'SelectionInListView'
                    #'layout:' #(#LayoutFrame 222 0 13 0 401 0 94 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#HTMLViewSpec
                    #'name:' 'HTMLView'
                    #'layout:' #(#LayoutFrame 222 0 100 0 401 0 181 0)
                    #'hasHorizontalScrollBar:' true
                    #'hasVerticalScrollBar:' true
                )
                 #(#LabelSpec
                    #'name:' 'HTMLViewLabel'
                    #'layout:' #(#AlignmentOrigin 295 0 178 0 0 1)
                    #'label:' 'HTMLView'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#LabelSpec
                    #'name:' 'label1'
                    #'layout:' #(#AlignmentOrigin 93 0 91 0 0 1)
                    #'label:' 'EditText'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#LabelSpec
                    #'name:' 'label2'
                    #'layout:' #(#AlignmentOrigin 295 0 91 0 0 1)
                    #'label:' 'SelectionInList'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )
!

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:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 445 162)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#LabelSpec
                    #'name:' 'helpText'
                    #'layout:' #(#Point 10 0)
                    #'labelChannel:' #userDefinedHelpText
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )
!

standardViews
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

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

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'unnamed'
              #'bounds:' #(#Rectangle 0 0 431 200)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#FramedBoxSpec
                    #'name:' 'FramedBox'
                    #'layout:' #(#LayoutFrame 16 0 14 0 136 0 94 0)
                    #'label:' 'FramedBox'
                    #'labelPosition:' #topCenter
                )
                 #(#ViewSpec
                    #'name:' 'View'
                    #'layout:' #(#LayoutFrame 152 0 14 0 266 0 94 0)
                )
                 #(#DividerSpec
                    #'name:' 'Horizontal Separator'
                    #'layout:' #(#LayoutFrame 16 0 107 0 137 0 111 0)
                    #'orientation:' #horizontal
                )
                 #(#DividerSpec
                    #'name:' 'Vertical Separator'
                    #'layout:' #(#LayoutFrame 16 0 107 0 20 0 159 0)
                    #'orientation:' #vertical
                )
                 #(#LabelSpec
                    #'name:' 'viewLabel'
                    #'layout:' #(#AlignmentOrigin 158 0 20 0 0 0)
                    #'label:' 'View'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#LabelSpec
                    #'name:' 'Separators'
                    #'layout:' #(#AlignmentOrigin 136 0 117 0 1 0)
                    #'label:' 'Separators'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#ArbitraryComponentSpec
                    #'name:' 'ArbitraryComponent'
                    #'layout:' #(#LayoutFrame 278 0 14 0 392 0 94 0)
                    #'hasHorizontalScrollBar:' false
                    #'hasVerticalScrollBar:' false
                    #'hasBorder:' false
                )
                 #(#RegionSpec
                    #'name:' 'Region'
                    #'layout:' #(#LayoutFrame 146 0 107 0 211 0 172 0)
                    #'lineWidth:' 2
                    #'regionType:' #ellipse
                )
                 #(#LabelSpec
                    #'name:' 'RegionLabel'
                    #'layout:' #(#AlignmentOrigin 181 0 140 0 0.5 0.5)
                    #'label:' 'Region'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
                 #(#LabelSpec
                    #'name:' 'ArbitraryComponentLabel'
                    #'layout:' #(#AlignmentOrigin 284 0 20 0 0 0)
                    #'label:' 'ArbitraryComponent'
                    #'style:' 
                     #(#FontDescription
                        #helvetica #medium
                        #roman #'10'
                    )
                    #'adjust:' #left
                    #'resizeForLabel:' true
                    #'canUIDrag:' false
                )
              )
          )
      )
! !

!UISelectionPanel methodsFor:'actions'!

defineClassAndSelector
    |bd cls sel lbl|

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

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

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

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

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

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

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

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

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

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

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

    spec := self clientSpec value.

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

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

    self isUserBoard ifTrue:[
        ^ self defineClassAndSelector
    ].

    paste := self window getSelection.

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

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

!UISelectionPanel methodsFor:'aspects'!

clientSpec
    "automatically generated by UIPainter ..."

    |holder|

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

clipBoardSpec
    ^ clipBoardSpec
!

galleryList
    "automatically generated by UIPainter ..."

    |holder|

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

galleryModel
    "automatically generated by UIPainter ..."

    |holder|

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

majorChannel
    "automatically generated by UIPainter ..."

    |holder|

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

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

minorKeys
    "automatically generated by UIPainter ..."

    |holder|

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

!UISelectionPanel methodsFor:'change & update'!

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

    (channel := self clientSpec) == changedObject ifTrue:[
        label := self builder componentAt:#clientSpecLabel.

        channel value notNil ifTrue:[
            label label:('   ', channel value name, '    ').
            label level:1.
        ] ifFalse:[
            label label:nil.
            label level:0.
        ]
    ].

    super update:something with:aParameter from:changedObject.


! !

!UISelectionPanel methodsFor:'drag & drop'!

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

drop:something in:aComponent at:aPoint

    |spc top|

    top := DragAndDropManager dragOriginatorQuerySignal raise topView.

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

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

!UISelectionPanel methodsFor:'queries'!

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

!

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

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

!UISelectionPanel methodsFor:'selection'!

majorSelection
    ^ majorSelection
!

majorSelection:aSelection
    |spec channel|

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

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

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

! !

!UISelectionPanel methodsFor:'startup / release'!

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

closeRequest
    |sav|

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

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

!UISelectionPanel methodsFor:'user defined'!

userDefined
    |cls lbl sel builder|
    (cls := userClass) notNil ifTrue:[
        cls isBehavior ifFalse:[
            cls := Smalltalk at:cls asSymbol
        ].
        (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.
          ^ self
        ]
    ].
    builder := UIBuilder new.
    builder application:self.
    (self builder componentAt:#gallery) builder:builder. 
    self galleryList value:#( '???' ).
    self minorKeys   value:#( standardUserPanel ).
!

userDefinedHelpText

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

userDefinedSpec
    |cls spc idx|

    (cls := userClass) notNil ifTrue:[
        cls isBehavior ifFalse:[
            cls := Smalltalk at:cls asSymbol
        ].
        (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::ExampleUserDefinedGallery class methodsFor:'user defined gallery'!

clocksSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:UISelectionPanel::ExampleUserDefinedGallery andSelector:#clocksSpec
     UISelectionPanel::ExampleUserDefinedGallery new openInterface:#clocksSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'Interface Builder'
              #'bounds:' #(#Rectangle 0 0 380 271)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ArbitraryComponentSpec
                    #'name:' 'arbitraryComponent1'
                    #'layout:' #(#LayoutFrame 11 0 11 0 125 0 123 0)
                    #'component:' #ClockView
                    #'hasHorizontalScrollBar:' false
                    #'hasVerticalScrollBar:' false
                    #'hasBorder:' false
                    #'miniScrollerHorizontal:' false
                    #'miniScrollerVertical:' false
                )
                 #(#ArbitraryComponentSpec
                    #'name:' 'arbitraryComponent2'
                    #'layout:' #(#LayoutFrame 136 0 10 0 240 0 33 0)
                    #'component:' #DigitalClockView
                    #'hasHorizontalScrollBar:' false
                    #'hasVerticalScrollBar:' false
                    #'hasBorder:' false
                    #'miniScrollerHorizontal:' false
                    #'miniScrollerVertical:' false
                )
              )
          )
      )
!

funSpec
    "this window spec was automatically generated by the ST/X UIPainter"

    "do not manually edit this - the painter/builder may not be able to
     handle the specification if its corrupted."

    "
     UIPainter new openOnClass:UISelectionPanel::ExampleUserDefinedGallery andSelector:#funSpec
     UISelectionPanel::ExampleUserDefinedGallery new openInterface:#funSpec
    "

    <resource: #canvas>

    ^
     
       #(#FullSpec
          #'window:' 
           #(#WindowSpec
              #'name:' 'uIPainterView'
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
              #'label:' 'Interface Builder'
              #'bounds:' #(#Rectangle 0 0 393 182)
          )
          #'component:' 
           #(#SpecCollection
              #'collection:' 
               #(
                 #(#ArbitraryComponentSpec
                    #'name:' 'arbitraryComponent1'
                    #'layout:' #(#LayoutFrame 54 0 27 0 287 0 145 0)
                    #'hasHorizontalScrollBar:' false
                    #'hasVerticalScrollBar:' false
                    #'hasBorder:' false
                    #'miniScrollerHorizontal:' false
                    #'miniScrollerVertical:' false
                )
              )
          )
      )
!

listOfLabels
    ^ #( 'clocks' 'fun')


!

listOfSelectors
    ^ #( clocksSpec funSpec )


! !

!UISelectionPanel class methodsFor:'documentation'!

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