FileBrowserV2PanelView.st
author Claus Gittinger <cg@exept.de>
Tue, 15 Oct 2002 18:43:23 +0200
changeset 4004 f97168a68093
parent 3892 321c1729db5b
child 4360 959719f86629
permissions -rw-r--r--
*** empty log message ***

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

VariablePanel subclass:#FileBrowserV2PanelView
	instanceVariableNames:'whichView visibilityHolder oldOrigin oldCorner'
	classVariableNames:'BarHeight'
	poolDictionaries:''
	category:'Interface-Tools-File'
!

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

!FileBrowserV2PanelView methodsFor:'accessing'!

visible:aState
    |view1 view2 state|

    state := aState ? true.

    (state == self isVisible or:[subViews size ~~ 2]) ifTrue:[
        ^ self
    ].

    view1 := subViews at:1.
    view2 := subViews at:2.

    state ifTrue:[
        "
        MAKE VISIBLE
        "
        barHeight := BarHeight.
        view1 origin:0.0@0.0   corner:oldCorner.
        view2 origin:oldOrigin corner:1.0@1.0.
        self  resizeSubviews.
    ] ifFalse:[
        "
        MAKE INVISIBLE
        "
        BarHeight := barHeight.
        barHeight := 0.
        oldCorner := view1 relativeCorner.
        oldOrigin := view2 relativeOrigin.

        orientation == #vertical ifTrue:[
            whichView == #first ifTrue:[
                view1 origin:0.0@0.0 corner:1.0@0.0.
                view2 origin:0.0@0.0 corner:(view2 corner).
            ] ifFalse:[
                view1 origin:0.0@0.0 corner:1.0@1.0.
                view2 origin:0.0@1.0 corner:(view2 corner).
            ].
        ] ifFalse:[
            whichView == #first ifTrue:[
                view1 origin:0.0@0.0 corner:0.0@1.0.
                view2 origin:0.0@0.0 corner:1.0@1.0.
            ] ifFalse:[
                view1 origin:0.0@0.0 corner:1.0@1.0.
                view2 origin:1.0@0.0 corner:1.0@1.0.
            ]
        ]
    ].
    visibilityHolder notNil ifTrue:[visibilityHolder value:state]
!

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

    ^ whichView
!

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

    whichView := something.
! !

!FileBrowserV2PanelView methodsFor:'accessing mvc'!

visibilityHolder
    ^ visibilityHolder
!

visibilityHolder:aHolder
    visibilityHolder removeDependent:self.

    (visibilityHolder := aHolder) notNil ifTrue:[
        visibilityHolder addDependent:self.

        realized ifTrue:[
            self visible:(visibilityHolder value)
        ]
    ]
! !

!FileBrowserV2PanelView methodsFor:'actions'!

toggleVisibility

    self visible:(self isVisible not)
! !

!FileBrowserV2PanelView methodsFor:'change & update'!

update:what with:aPara from:chgObj

    chgObj == visibilityHolder ifTrue:[
	^ self visible:(chgObj value)
    ].
    ^ super update:what with:aPara from:chgObj

! !

!FileBrowserV2PanelView methodsFor:'initialization'!

destroy
    visibilityHolder removeDependent:self.
    super destroy
!

initialize
    orientation := #vertical.
    whichView   := #first.

    super initialize
!

realize
    super realize.

    visibilityHolder notNil ifTrue:[
        self visible:(visibilityHolder value)
    ]
! !

!FileBrowserV2PanelView methodsFor:'queries'!

anyNonRelativeSubviews
    "return true, if any of my subviews has no relative origin/extent"

    "/ cg asking ca: "whats the reason for this ?"
    "/ ^ subViews notNil
    ^ super anyNonRelativeSubviews.
!

isVisible
    ^ barHeight ~~ 0
!

specClass
    ^ FileBrowserV2UISpecifications panelSpecClass
! !

!FileBrowserV2PanelView class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/FileBrowserV2PanelView.st,v 1.1 2002-09-25 07:58:30 penk Exp $'
! !