Menu.st
changeset 950 01920811b83b
parent 940 418cfd9b298d
child 972 09bc0765dbc1
equal deleted inserted replaced
949:0eb888b21192 950:01920811b83b
   183 
   183 
   184 lastItem
   184 lastItem
   185     "returns last item
   185     "returns last item
   186     "
   186     "
   187     ^ items notNil ifTrue:[items last] ifFalse:[nil]
   187     ^ items notNil ifTrue:[items last] ifFalse:[nil]
   188 
       
   189     "Created: / 21.5.1998 / 16:42:40 / cg"
       
   190 !
   188 !
   191 
   189 
   192 lines
   190 lines
   193     "return the indexes of the menu items that are the last menu item in their group (except the very last)."
   191     "return the indexes of the menu items that are the last menu item in their group (except the very last)."
   194 
   192 
   459     "
   457     "
   460     anIndex <= items size ifTrue:[
   458     anIndex <= items size ifTrue:[
   461         ^ items removeAtIndex:anIndex
   459         ^ items removeAtIndex:anIndex
   462     ].
   460     ].
   463     ^ nil
   461     ^ nil
   464 
       
   465     "Created: / 21.5.1998 / 16:42:41 / cg"
       
   466 ! !
   462 ! !
   467 
   463 
   468 !Menu methodsFor:'converting'!
   464 !Menu methodsFor:'converting'!
   469 
   465 
   470 fromLiteralArrayEncoding:aLiteralEncodedArray
   466 fromLiteralArrayEncoding:aLiteralEncodedArray
   616      If none of the evaluations returns true, return the result of the
   612      If none of the evaluations returns true, return the result of the
   617      evaluation of the exceptionBlock
   613      evaluation of the exceptionBlock
   618     "
   614     "
   619     ^ self detectItem:aBlock ifNone:[self errorNotFound]
   615     ^ self detectItem:aBlock ifNone:[self errorNotFound]
   620 
   616 
   621     "Created: / 21.5.1998 / 16:42:40 / cg"
       
   622 !
   617 !
   623 
   618 
   624 detectItem:aBlock ifNone:exceptionBlock
   619 detectItem:aBlock ifNone:exceptionBlock
   625     "evaluate the argument, aBlock for each item in the menu until the
   620     "evaluate the argument, aBlock for each item in the menu until the
   626      block returns true; in this case return the item which caused the
   621      block returns true; in this case return the item which caused the
   630     "
   625     "
   631     items notNil ifTrue:[
   626     items notNil ifTrue:[
   632         ^ items detect:aBlock ifNone:exceptionBlock
   627         ^ items detect:aBlock ifNone:exceptionBlock
   633     ].
   628     ].
   634     ^ exceptionBlock value
   629     ^ exceptionBlock value
   635 
       
   636     "Created: / 21.5.1998 / 16:42:40 / cg"
       
   637 !
   630 !
   638 
   631 
   639 itemsDo:aOneArgBlock
   632 itemsDo:aOneArgBlock
   640     "evaluate the block for each item in the current menu
   633     "evaluate the block for each item in the current menu
   641     "
   634     "
   844 ! !
   837 ! !
   845 
   838 
   846 !Menu class methodsFor:'documentation'!
   839 !Menu class methodsFor:'documentation'!
   847 
   840 
   848 version
   841 version
   849     ^ '$Header: /cvs/stx/stx/libview2/Menu.st,v 1.30 1998-05-21 14:43:07 cg Exp $'
   842     ^ '$Header: /cvs/stx/stx/libview2/Menu.st,v 1.31 1998-05-28 13:23:08 ca Exp $'
   850 ! !
   843 ! !