FileBrowserV2UISpecifications.st
author Claus Gittinger <cg@exept.de>
Tue, 08 Feb 2011 09:12:12 +0100
changeset 9738 7dd722970a40
parent 7920 5fe560f6a741
child 12123 4bde08cebd48
child 15612 8c9467f951db
permissions -rw-r--r--
changed: #readAspects:from: no need for change messages when reading aspect values

"
 COPYRIGHT (c) 2002 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.
"
"{ Package: 'stx:libtool' }"

Object subclass:#FileBrowserV2UISpecifications
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Tools-File'
!

VariablePanelSpec subclass:#PanelSpec
	instanceVariableNames:'whichView orientation visibility'
	classVariableNames:''
	poolDictionaries:''
	privateIn:FileBrowserV2UISpecifications
!

!FileBrowserV2UISpecifications class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2002 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
"
    copy of the Panel from CBrowser , if a better HorizontalPanel and VerticalPanel is available
    the new version can be used here
"
! !

!FileBrowserV2UISpecifications class methodsFor:'classAccess'!

panelSpecClass

    ^ PanelSpec
! !

!FileBrowserV2UISpecifications class methodsFor:'interface specs'!

listSpec
    "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:FileBrowserV2UISpecifications andSelector:#listSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: listSpec
        window: 
       (WindowSpec
          label: 'Graphs'
          name: 'Graphs'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 449 234)
        )
        component: 
       (SpecCollection
          collection: (
           (HierarchicalListViewSpec
              name: 'HierarchicalListModel'
              layout: (LayoutFrame 225 0 7 0 398 0 79 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              miniScrollerHorizontal: true
              highlightMode: line
            )
           (LabelSpec
              label: 'HierarchicalList'
              name: 'HierarchicalListLabel'
              layout: (Point 252 15)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (SelectionInListModelViewSpec
              name: 'SelectionInListModel'
              layout: (LayoutFrame 6 0 7 0 179 0 79 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              miniScrollerHorizontal: true
              highlightMode: line
            )
           (LabelSpec
              label: 'SelectionInList'
              name: 'SelectionInListLabel'
              layout: (Point 33 15)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           (ListModelViewSpec
              name: 'ListModel'
              layout: (LayoutFrame 6 0 100 0 179 0 172 0)
              hasHorizontalScrollBar: true
              hasVerticalScrollBar: true
              miniScrollerHorizontal: true
            )
           (LabelSpec
              label: 'ListModel'
              name: 'ListModelLabel'
              layout: (Point 33 109)
              style: (FontDescription helvetica medium roman 10)
              resizeForLabel: true
              adjust: left
              canUIDrag: false
            )
           )
         
        )
      )
!

othersSpec
    "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:FileBrowserV2UISpecifications andSelector:#othersSpec
    "

    <resource: #canvas>

    ^ 
     #(#FullSpec
        #name: #othersSpec
        #window: 
       #(#WindowSpec
          #label: 'Panel Specs'
          #name: 'Panel Specs'
          #layout: #(#LayoutFrame 119 0 66 0 536 0 215 0)
          #level: 0
          #min: #(#Point 10 10)
          #bounds: #(#Rectangle 119 66 537 216)
          #usePreferredExtent: false
          #returnIsOKInDialog: true
          #escapeIsCancelInDialog: true
        )
        #component: 
       #(#SpecCollection
          #collection: #(
           #(#LabelSpec
              #label: 'Wrapper'
              #name: 'WrapperLabel'
              #layout: #(#Point 9 6)
              #style: #(#FontDescription #helvetica #medium #roman 10)
              #resizeForLabel: true
              #adjust: #left
              #canUIDrag: false
            )
           #(#'FileBrowserV2UISpecifications::WrapperSpec'
              #name: 'Wrapper'
              #layout: #(#LayoutFrame 6 0 26 0 179 0 98 0)
            )
           #(#LabelSpec
              #label: 'Panel'
              #name: 'PanelLabel'
              #layout: #(#Point 201 6)
              #style: #(#FontDescription #helvetica #medium #roman 10)
              #resizeForLabel: true
              #adjust: #left
              #canUIDrag: false
            )

           #(#'FileBrowserV2UISpecifications::PanelSpec'
              #name: 'Panel'
              #layout: #(#LayoutFrame 198 0 26 0 376 0 98 0)
              #level: 0
              #whichView: #first
              #orientation: #vertical
              #component: 
             #(#SpecCollection
                #collection: #(
                 #(#LabelSpec
                    #label: 'A'
                    #name: 'Label1'
                    #layout: #(#LayoutFrame 0 0.0 0 0.0 0 0.5 0 1.0)
                    #level: 2
                    #canUIDrag: false
                  )
                 #(#LabelSpec
                    #label: 'B'
                    #name: 'Label2'
                    #layout: #(#LayoutFrame 0 0.5 0 0.0 0 1.0 0 1.0)
                    #level: 2
                    #canUIDrag: false
                  )
                 )
               
              )
            )
           )
         
        )
      )
! !

!FileBrowserV2UISpecifications class methodsFor:'setup'!

setup
"
FileBrowserV2UISpecifications setup.

"
    |listSpec othersSpec|

    UISelectionPanel galleryClass removeUserSpecWithLabel:'Graphs'.
    UISelectionPanel galleryClass removeUserSpecWithLabel:'Clocks etc.'.
    UISelectionPanel galleryClass removeUserSpecWithLabel:'Business Graphics'.
    UISelectionPanel galleryClass removeUserSpecWithLabel:'C-Lists'.
    UISelectionPanel galleryClass removeUserSpecWithLabel:'C-Others'.

    listSpec := ValueHolder new.
    listSpec value:(self listSpec).

    UISelectionPanel galleryClass addUserSpecHolder:listSpec
                label:'C-Lists'.

    othersSpec := ValueHolder new.
    othersSpec value:(self othersSpec).

    UISelectionPanel galleryClass addUserSpecHolder:othersSpec
                label:'C-Others'.
! !

!FileBrowserV2UISpecifications::PanelSpec class methodsFor:'interface specs'!

detailsEditSpec
    "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:FileBrowserV2UISpecifications::PanelSpec andSelector:#detailsEditSpec
    "

    <resource: #canvas>

    ^ 
     #(FullSpec
        name: detailsEditSpec
        window: 
       (WindowSpec
          label: 'Panel Detail Spec'
          name: 'Panel Detail Spec'
          min: (Point 10 10)
          bounds: (Rectangle 14 46 452 420)
        )
        component: 
       (SpecCollection
          collection: (
           (UISubSpecification
              name: 'SubSpecification1'
              layout: (LayoutFrame 1 0 0 0.0 0 1.0 183 0)
              majorKey: ViewSpec
              minorKey: detailsEditSpec
            )
           (FramedBoxSpec
              label: 'Handles'
              name: 'FramedBox2'
              layout: (LayoutFrame 0 0.0 169 0 0 1.0 284 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'Bar Width:'
                    name: 'BarWidthLabel'
                    layout: (AlignmentOrigin 88 0 13 0 1 0.5)
                    activeHelpKey: barWidth
                    translateLabel: true
                    resizeForLabel: true
                    adjust: left
                  )
                 (InputFieldSpec
                    name: 'BarWidthField'
                    layout: (LayoutFrame 90 0 0 0 140 0 22 0)
                    activeHelpKey: barWidth
                    tabable: true
                    model: barWidth
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'Bar Level:'
                    name: 'BarLevelLabel'
                    layout: (AlignmentOrigin 244 0 13 0 1 0.5)
                    activeHelpKey: barLevel
                    translateLabel: true
                    resizeForLabel: true
                    adjust: left
                  )
                 (InputFieldSpec
                    name: 'BarLevelField'
                    layout: (LayoutFrame 246 0 0 0 296 0 22 0)
                    activeHelpKey: barLevel
                    tabable: true
                    model: barLevel
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'Show Handles:'
                    name: 'ShowHandlesLabel'
                    layout: (AlignmentOrigin 85 0 38 0 1 0.5)
                    activeHelpKey: showHandle
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (PopUpListSpec
                    label: 'Default'
                    name: 'ShowHandlesPopUpList'
                    layout: (AlignmentOrigin 90 0 38 0 0 0.5)
                    activeHelpKey: showHandle
                    resizeForLabel: true
                    tabable: true
                    model: showHandleIdx
                    menu: showHandleList
                    useIndex: true
                  )
                 (LabelSpec
                    label: 'Snap Mode:'
                    name: 'SnapLabel'
                    layout: (LayoutFrame 0 0 54 0 86 0 76 0)
                    activeHelpKey: snapMode
                    translateLabel: true
                    adjust: right
                  )
                 (PopUpListSpec
                    label: 'none'
                    name: 'SnapModePopUpList'
                    layout: (LayoutFrame 90 0 54 0 236 0 75 0)
                    activeHelpKey: snapMode
                    adjust: center
                    tabable: true
                    model: snapModeIdx
                    menu: snapModeList
                    useIndex: true
                  )
                 (LabelSpec
                    label: 'Position:'
                    name: 'HandlePositionLabel'
                    layout: (AlignmentOrigin 293 0 38 0 1 0.5)
                    activeHelpKey: handlePosition
                    translateLabel: true
                    resizeForLabel: true
                    adjust: right
                  )
                 (PopUpListSpec
                    label: 'Default'
                    name: 'HandlePositionPopUpList'
                    layout: (AlignmentOrigin 298 0 38 0 0 0.5)
                    activeHelpKey: handlePosition
                    resizeForLabel: true
                    tabable: true
                    model: handlePositionIdx
                    menu: handlePositionList
                    useIndex: true
                  )
                 )
               
              )
            )
           (FramedBoxSpec
              label: 'Visibility'
              name: 'FramedBox1'
              layout: (LayoutFrame 0 0.0 287 0 0 1.0 371 0)
              labelPosition: topLeft
              translateLabel: true
              component: 
             (SpecCollection
                collection: (
                 (LabelSpec
                    label: 'orientation:'
                    name: 'orientation'
                    layout: (AlignmentOrigin 85 0 13 0 1 0.5)
                    activeHelpKey: borderWidth
                    resizeForLabel: true
                    adjust: left
                  )
                 (ComboListSpec
                    name: 'orientationList'
                    layout: (LayoutFrame 85 0 2 0 194 0 24 0)
                    model: orientation
                    comboList: orientationList
                    useIndex: false
                  )
                 (LabelSpec
                    label: 'which:'
                    name: 'visibilityOf'
                    layout: (AlignmentOrigin 248 0 13 0 1 0.5)
                    activeHelpKey: borderWidth
                    resizeForLabel: true
                    adjust: left
                  )
                 (ComboListSpec
                    name: 'whichViewList'
                    layout: (LayoutFrame 247 0 2 0 0 1.0 24 0)
                    model: whichView
                    comboList: whichViewList
                    useIndex: false
                  )
                 (InputFieldSpec
                    name: 'visibility'
                    layout: (LayoutFrame 85 0 29 0 0 1.0 51 0)
                    activeHelpKey: canvas
                    model: visibility
                    group: inputGroup
                    acceptChannel: acceptChannel
                    modifiedChannel: modifiedChannel
                    acceptOnPointerLeave: false
                  )
                 (LabelSpec
                    label: 'visibility:'
                    name: 'visibilityLabel'
                    layout: (AlignmentOrigin 85 0 40 0 1 0.5)
                    resizeForLabel: true
                  )
                 )
               
              )
            )
           )
         
        )
      )
! !

!FileBrowserV2UISpecifications::PanelSpec class methodsFor:'interface-painter'!

addBindingsTo:env for:anInstance channel:aChannel 
    "add bindings as required to allow the GUI Painter to operate on an instance of me"

    super addBindingsTo:env for:anInstance channel:aChannel.

    self adaptApects:#( visibility ) to:env for:anInstance channel:aChannel converter:#symbolOrNil.
    self adaptApects:#( whichView orientation ) to:env for:anInstance channel:aChannel.

    env at:#whichViewList put:#( #first #last ) asValue.
    env at:#orientationList put:#( #horizontal #vertical ) asValue.



! !

!FileBrowserV2UISpecifications::PanelSpec methodsFor:'accessing'!

orientation
    "return the value of the instance variable 'orientation' (automatically generated)"

    ^ orientation ? #vertical
!

orientation:something
    "set the value of the instance variable 'orientation' (automatically generated)"
    something notNil ifTrue:[
	orientation := something asSymbol
    ] ifFalse:[
	orientation := something.
    ]
!

visibility
    "return the value of the instance variable 'orientation' (automatically generated)"

    ^ visibility
!

visibility:something
    "set the value of the instance variable 'visibility' (automatically generated)"

    visibility := something.
!

whichView
    "return the value of the instance variable 'whichView' (automatically generated)"

    ^ whichView ? #first
!

whichView:something
    "set the value of the instance variable 'whichView' (automatically generated)"

    whichView := something.
! !

!FileBrowserV2UISpecifications::PanelSpec methodsFor:'building'!

aspectSelectors
    "add more aspect selectors (these generate aspect methods in the definer)"

    |more|

    more := super aspectSelectors.
    visibility notNil ifTrue:[more add:visibility].
    ^ more
!

setAttributesIn:aView with:aBuilder
    "set my attributes to aView
    "
    super setAttributesIn:aView with:aBuilder.

    aView        whichView:(self whichView).
    aView      orientation:(self orientation).
    aView visibilityHolder:(self getBindingIn:aBuilder binding:visibility).



! !

!FileBrowserV2UISpecifications::PanelSpec methodsFor:'computation'!

recomputeHandlesIn:aPanel
    |subs isVertical|

    (subs := aPanel subViews) notNil ifTrue:[
	isVertical := self isVertical.
	^ subs 
	    collect:
		[:v | |rel|
		    rel := v relativeCorner. 
		    isVertical ifTrue:[ rel y] ifFalse:[ rel x ].
		]
    ].
    ^ nil
!

setLayoutsInLayoutContainer:aPanel
    |x y subs isVertical|

    ((subs := aPanel subViews) notNil and:[subs size == handles size]) ifTrue:[
	isVertical := self isVertical.
	y := x := 0.0.
	subs keysAndValuesDo:[:i :v|
	    isVertical ifTrue:[
		v relativeOrigin:(0.0 @ y).
		y := handles at:i.
		v relativeCorner:(1.0 @ y).
	    ] ifFalse:[
		v relativeOrigin:(x @ 0.0).
		x := handles at:i.
		v relativeCorner:(x @ 1.0).
	    ]
	]
    ]
!

setupInitialLayoutFor:aView
    |superView|

    aView geometryLayout:nil.

    (    aView relativeOrigin isNil 
     or:[aView relativeExtent isNil 
	 and:[aView relativeCorner isNil]]
    ) ifTrue:[
	superView := aView superView.

	self isVertical ifTrue:[
	    aView corner:0@0.
	    aView origin:0.0@0.0.
	    aView extent:1.0@0.3.
	    superView notNil ifTrue:[
		superView setupSubviews.
		superView resizeSubviews.
	    ]
	] ifFalse:[
	    aView origin:0.0@0.0.
	    aView extent:0.3@1.0.
	    superView notNil ifTrue:[
		superView setupSubviews
	    ]
	]
    ]
! !

!FileBrowserV2UISpecifications::PanelSpec methodsFor:'converting'!

skippedInLiteralEncoding
    |l|

    l := super skippedInLiteralEncoding asOrderedCollection.
    visibility isNil ifTrue:[l add:#visibility].
  ^ l
! !

!FileBrowserV2UISpecifications::PanelSpec methodsFor:'queries'!

isVertical
    ^ self orientation == #vertical

!

viewClass
    "return the corresponding view class of the spec"

    ^ FileBrowserV2PanelView
! !

!FileBrowserV2UISpecifications class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2UISpecifications.st,v 1.6 2008-01-10 13:00:21 cg Exp $'
! !