ClickMenuView.st
author Claus Gittinger <cg@exept.de>
Sat, 11 Nov 1995 17:23:54 +0100
changeset 174 d80a6cc3f9b2
parent 127 462396b08e30
child 202 01f3cbb8e20e
permissions -rw-r--r--
uff - version methods changed to return stings

"
 COPYRIGHT (c) 1991 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.
"

MenuView subclass:#ClickMenuView
       instanceVariableNames:''
       classVariableNames:''
       poolDictionaries:''
       category:'Views-Menus'
!

!ClickMenuView class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1991 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/libwidg/ClickMenuView.st,v 1.6 1995-11-11 16:19:18 cg Exp $'
!

documentation
"
    ClickMenuViews are like menuViews, but deselects automatically
    after clicked on an entry.
    ClickMenuViews can be used as static menus (i.e. non-popping); 
    for example, the old launcher uses an instance of ClickMenuView.
"
!

examples 
"
    |top menu1 menu2|

    top := StandardSystemView new.
    menu1 := ClickMenuView 
		labels:#(
			 'foo'
			 'bar'
			 'baz '
			 '-'
			 'more foo'
			 '='
			 'quit'
			)
		selectors:#(
			foo
			bar
			baz
			nil
			moreFoo
			nil
			destroy
		       )
		receiver:top.

    menu1 subMenuAt:#moreFoo put:(
	PopUpMenu labels:#(
			    'more1 '
			    'more2 '
			    'more3'
			   )
	       selectors:#(
			    more1
			    more2
			    more3
			   )
		receiver:self
    ).
    menu1 resize; open.
    top add:menu1.
    top openWithExtent:(menu1 extent).
"
! !

!ClickMenuView methodsFor:'event handling'!

buttonRelease:button x:x y:y
    super buttonRelease:button x:x y:y.
    self selection:nil
! !