ValHolder.st
author claus
Tue, 09 May 1995 02:23:22 +0200
changeset 69 225a9efd50f5
parent 68 43b867285d01
child 71 5b34cd877517
permissions -rw-r--r--
.

ValueModel subclass:#ValueHolder 
	 instanceVariableNames:'value'
	 classVariableNames:''
	 poolDictionaries:''
	 category:'Interface-Support'
!

!ValueHolder class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 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.
"
!

version
"
$Header: /cvs/stx/stx/libview2/Attic/ValHolder.st,v 1.4 1995-05-09 00:22:53 claus Exp $
"
!

documentation
"
    a valueHolder can be used as a model for editFields, buttons etc.
    It stores some value internally, and sends update messages to its
    dependents when changed.

    Notice: this class was implemented using protocol information
    from alpha testers - it may not be complete or compatible to
    the corresponding ST-80 class. If you encounter any incompatibilities,
    please forward a note to the ST/X team.
"
! !

!ValueHolder class methodsFor:'instance creation'!

with:anObject
    "return a new ValueHolder holding anObject as initial value"

    ^ (super new) setValue:anObject
!

newString
    "return a new ValueHolder holding an empty string as initial value"

    ^ self with:''
!

newBoolean
    "return a new ValueHolder holding false as initial value"

    ^ self with:false
!

newNumber
    "return a new ValueHolder holding 0 as initial value"

    ^ self with:0 
!

newFraction
    "return a new ValueHolder holding 0.0 as initial value.
     The name is somewhat missleading - actually it should be called newFloat."

    ^ self with:0.0 
! !

!ValueHolder methodsFor:'accessing'!

setValue:anObject
    "set my value without notification."

    value := anObject.
!

value
    "return my value"

    ^ value
! !