MenuItem.st
author Claus Gittinger <cg@exept.de>
Tue, 25 Feb 1997 19:53:41 +0100
changeset 451 95064b26ded1
child 453 e06bf3866328
permissions -rw-r--r--
intitial checkin

Object subclass:#MenuItem
	instanceVariableNames:'enabled label value nameKey'
	classVariableNames:''
	poolDictionaries:''
	category:'Views-Support'
!

Object subclass:#MenuItemAdornment
	instanceVariableNames:'color indication submenu'
	classVariableNames:''
	poolDictionaries:''
	privateIn:MenuItem
!

!MenuItem class methodsFor:'documentation'!

documentation
"
    not yet finished MenuItem class - this will eventually replace
    most of the MenuView and PopUpMenu stuff.
    (and hopefully be ST-80 compatible ...)

    For now, only a subset of the full protocol is implemented.

    [author:]
        Claus Gittinger

    [see also:]
        MenuItem
        PopUpMenu
"

! !

!MenuItem methodsFor:'accessing'!

disable
    enabled := false

    "Created: 25.2.1997 / 19:39:09 / cg"
!

enable
    enabled := true

    "Created: 25.2.1997 / 19:39:00 / cg"
!

enabled:aBoolean
    enabled := aBoolean

    "Created: 25.2.1997 / 19:39:27 / cg"
!

isEnabled
    ^ enabled ? true

    "Created: 25.2.1997 / 19:39:17 / cg"
!

label
    ^ label

    "Created: 25.2.1997 / 19:48:16 / cg"
!

rawLabel:aString
    label := aString

    "Created: 25.2.1997 / 19:11:02 / cg"
!

value
    ^ value

    "Created: 25.2.1997 / 19:50:14 / cg"
!

value:something
    value := something

    "Created: 25.2.1997 / 19:11:13 / cg"
! !

!MenuItem methodsFor:'converting'!

fromLiteralArrayEncoding:aLiteralEncodedArray
    "read my contents from a aLiteralEncodedArray"

    2 to:aLiteralEncodedArray size by:2 do:[:i |
        |selector value|

        selector := aLiteralEncodedArray at:i.
        value := (aLiteralEncodedArray at:i+1) decodeAsLiteralArray.

        self perform:selector with:value
    ].

    "
     #( #MenuItem #rawLabel: 'left' #value: #left )
         decodeAsLiteralArray
    "

    "Modified: 25.2.1997 / 19:24:22 / cg"
! !

!MenuItem class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.1 1997-02-25 18:53:41 cg Exp $'
! !