ColorInspectorView.st
author Claus Gittinger <cg@exept.de>
Thu, 04 Aug 2005 11:59:27 +0200
changeset 6372 d59bab947578
parent 3199 5478ca0ac71f
child 6375 b4f3981447a7
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 1994 by Claus Gittinger
	      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' }"

InspectorView subclass:#ColorInspectorView
	instanceVariableNames:'colorView'
	classVariableNames:''
	poolDictionaries:''
	category:'Interface-Inspector'
!

!ColorInspectorView class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1994 by Claus Gittinger
	      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.
"
! !

!ColorInspectorView methodsFor:'accessing'!

inspect:anObject
    super inspect:anObject.
    realized ifFalse:[^ self].

    colorView viewBackground:anObject.
    colorView clear
! !

!ColorInspectorView methodsFor:'initialization'!

initialize
    |newPanel sub|

    super initialize.

    newPanel := VariableVerticalPanel in:self.
    newPanel origin:0.0 @ 0.0 corner:1.0 @ 1.0.

    sub := subViews first.
    self removeSubView:sub.
    sub origin:0.0@0.0 corner:1.0@0.8.
    newPanel addSubView:sub.

    colorView := View in:newPanel.
    colorView origin:(0.0 @ 0.8) corner:(1.0 @ 1.0).

    "
     ColorInspectorView inspect:(Color yellow)
     ColorInspectorView inspect:(Color name:'brown') lightened)
    "
! !

!ColorInspectorView methodsFor:'private'!

displayStringForValue:someValue 
    "return the values displayString"

    |sel|

    sel := listView at:selectionIndex.

    (sel startsWith:$-) ifTrue:[
        (sel startsWith:'-rgb') ifTrue:[
            ^ '#' , (inspectedObject rgbValue printStringRadix:16)
        ].
    ].
    ^ super displayStringForValue:someValue
!

pseudoFieldList
    ^ #( 
            '-rgb'
    )
!

valueForSpecialLine:line
    (line startsWith:'-rgb') ifTrue:[
        ^ inspectedObject rgbValue
    ].
    ^ super valueForSpecialLine:line
! !

!ColorInspectorView class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/ColorInspectorView.st,v 1.9 2005-08-04 09:59:27 cg Exp $'
! !